怎么用matlab画多项式拟合函数图像-数字图像处理matlab实验图像增强-( 二 )
[row,col,ch] = size(img);
large = zeros(size(img));
【怎么用matlab画多项式拟合函数图像-数字图像处理matlab实验图像增强-】4、在large放大图像中进行三重for循环拟合所有的未定义像素点
for c=1:ch
for y=5:col-5
for x=5:row-532
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)));
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小方格(实际上像素值构成矩阵),根据最小误差拟合出每两个像素点中间点的值,依次填入大图 。
最后附上拟合成功图像

文章插图
推荐阅读
- 常山赵子龙关羽叫什么?别人说常山赵子龙我怎么接
- 怎么进设置u盘启动?如何设置开机u盘启动装系统步骤
- 快乐假期的内容怎么写?快乐假期的优美句子
- 怎么把多个图片拼接到一起,怎样把多张图片拼接到一张图片-_2
- 开机后鼠标不动了怎么办?电脑开机正常鼠标不动怎么啦
- 张裕珍藏版五星白兰地金奖白兰地38度-张裕珍藏版五星白兰地怎么样-
- 人参泡水喝的方法
- 如果有一天,我从你的世界消失了,你会怎么样-?如果有一天,我从你的世界消失了,别难过,别回头
- 宝宝成语故事大全100篇?儿童故事大全成语故事文字版
- 华帝i11135油烟机怎么样?华帝i11134油烟机好吗_3
