17 回归法做图像变化检测——建立图的回归等式(matlab程序)

1.简述

      

       回归是确定两种或两种以上的变量间相互依赖的定量关系的方法。映射到本文就是用我们图像数据去预测该图像上衣服的价格。说直白点,就是通过X与Y确立函数关系式,只不过X换成了图片罢了。

2.代码

 

%%  建立图的回归等式
image1=imread('11.TIF');
image2=imread('22.TIF');

figure,imshow(image1);
figure,imshow(image2);

image1=rgb2gray(image1);
image2=rgb2gray(image2);
same_sample1=image1(1:131,158:364);
same_sample2=image2(1:131,158:364);

same_sample1=double(same_sample1);
same_sample2=double(same_sample2);
figure,imshow(uint8(same_sample1));
[r1,c1]=size(same_sample1);
[r2,c2]=size(same_sample2);
sample1=reshape(same_sample1,1,r1*c1);
sample2=reshape(same_sample2,1,r2*c2);
p=polyfit(same_sample1,same_sample2,1);
norm_image=polyval(p,double(image1));

[rx,cx]=size(image22);

varia_domain=norm_image-double(image22(1:rx,1:cx));
figure,imshow(varia_domain)

 

3.运行结果

3d874b7e0ecf46cda0c6994fae71f849.png

 f36eb5c449154f4eabcdb680210e7ebb.png

 57aaa8f5803e44beb763da26032ef094.png

 573599a64b8a4c1388fdfbe0a6c55459.png

 d293ce6ea4694884844f61e2cdc9d212.png

 8336f72728d543e09dfcb97712ae96ca.png

 6c0f6011c8384a6a859369cd46c12c45.png

 1446af1a48664ee68502f9fdfe2140de.png

猜你喜欢

转载自blog.csdn.net/m0_57943157/article/details/131565141
17