怎么用matlab画多项式拟合函数图像,数字图像处理matlab实验图像增强-( 二 )
large(x,y,c) = mypoly(x,y,c,small);
end
end
end
5、幕布并输出large图像
figure
large = mat2gray(large);
large = uint8(large*255);
imshow(large),title('拟合放大图像')
6、自定义函数像素赋值函数mypoly的定义
function value = https://www.08ts.cn/mypoly(x,y,c,small)
small_x = floor((x+1)/2);
small_y = floor((y+1)/2);
if small_x==(x+1)/2 && small_y==(y+1)/2
value = https://www.08ts.cn/small(small_x,small_y,c);
return;
end
f1=int32(0);
f2=int32(0);
f3=int32(0);
f4=int32(0);
f5=int32(0);
f6=int32(0);
for localx=-2:1:2
for localy=-2:1:2
f1=f1+int32(localx^2*int32(small(uint32(small_x+localx),uint32(small_y+localy),c)));
f2=f2+int32(localy^2*int32(small(uint32(small_x+localx),uint32(small_y+localy),c)));
【怎么用matlab画多项式拟合函数图像,数字图像处理matlab实验图像增强-】f3=f3+int32(localx*localy*int32(small(uint32(small_x+localx),uint32(small_y+localy),c)));
f4=f4+int32(localx*int32(small(uint32(small_x+localx),uint32(small_y+localy),c)));
f5=f5+int32(localy*int32(small(uint32(small_x+localx),uint32(small_y+localy),c)));
f6=f6+int32(small(uint32(small_x+localx),uint32(small_y+localy),c));
end
end
A = [170 100 0 0 0 50;100 170 0 0 0 50;0 0 100 0 0 0;0 0 0 50 0 0;0 0 0 0 50 0;50 50 0 0 0 25];
D = [double(f1);double(f2);double(f3);double(f4);double(f5);double(f6)];
C = A\D;
a = C(1,1);
b = C(2,1);
c1 = C(3,1);
d = C(4,1);
e = C(5,1);
h = C(6,1);
if small_x<(x+1)/2 && small_y==(y+1)/2
value = https://www.08ts.cn/a/4-d/2+h;
return;
end
if small_x==(x+1)/2 && small_y<(y+1)/2
value = https://www.08ts.cn/b/4-e/2+h;
return;
end
if small_x<(x+1)/2 && small_y<(y+1)/2
value = https://www.08ts.cn/a/4+b/4+c/4-d/2-e/2+h;
return;
end
end
至此,拟合实验完毕,具体思想就是“分而治之”,在小图中划分出所有3*3小方格(实际上像素值构成矩阵),根据最小误差拟合出每两个像素点中间点的值,依次填入大图 。
最后附上拟合成功图像
文章插图
推荐阅读
- 家用电烧烤炉子哪个牌子最好?家用烧烤电烤炉哪个品牌好_1
- 广告推广点击怎么收费的?付费推广怎么做
- 把苹果自动续费关掉?苹果怎么关闭每个月自动续费
- 胃酸|赫莲娜绿宝瓶和海蓝之谜精华露哪个好用?从成分到功效对比测评
- 30字左右的个人离职申请怎么写?
- 手机QQ怎么设置自动回复?
- 核桃分心木的功效与作用
- 冰冻榴莲怎么做好吃
- 榴莲怎么炖汤?做法怎么做
- 南北杏川贝炖雪梨怎么做