HiMI.m
上传用户:xueli1969
上传日期:2022-07-27
资源大小:19k
文件大小:1k
- % -- use a 9th vector as a pixel
- % -- cal MI as stastic on pixels
- function HiMI = HiMI(Is0, It0)
- % - read images
- % load ../MItest/t2.mat;
- %Is0 , It0
- [rt ct]=size(It0);
- [rs cs] = size(Is0);
- if rt>rs ||ct>cs
- x1 = (ct-cs)/2+1;
- x2 = cs+x1-1;
- It0=It0([x1:x2],[x1:x2]);
- end
- % - replace images to 9th images, a pixel-> 9th vector
- Is9 = i_9th(Is0);
- It9 = i_9th(It0);
- % - cal MI over the new images
- % MI0 = calMI_tian_1(double(Is0(2:(r-1),2:(c-1))), double(It0(2:(r-1),2:(c-1))));
- %MI9 = calMI_tian_1(double(Is9), double(It9));
- MI9 = MI(double(Is9), double(It9));
- HiMI = MI9;
- % - disp MI
- % figure, imshow(RIs);
- % RIr = get_Rect(Ir, my_Rect);
- % figure, imshow(RIr);
- % figure,plot(MI);
- function I9 = i_9th(I0)
- [row col]=size(I0);
- %I9=zeros((row-1)*9,(col-1));
- %for i = 2:(row-1)
- % for j=2:(col-1)
- %% p = I0(i,j);
- % i9 = (i-1)*9;
- % j9 = j-1;
- % V = I0((i-1):(i+1),(j-1):(j+1));
- % I9((i9-8):i9,j9) = V(:);
-
- i = [2:(row-1)]; j = [2:(col-1)];
- Pa1 = I0(i-1, j-1)';
- Pa2 = I0(i, j-1)';
- Pa3 = I0(i+1, j-1)';
- Pa4 = I0(i-1, j )';
- Pa5 = I0(i, j )';
- Pa6 = I0(i+1, j )';
- Pa7 = I0(i-1, j+1)';
- Pa8 = I0(i, j+1)';
- Pa9 = I0(i+1, j+1)';
- I9 = [ Pa1(:)'; Pa2(:)';Pa3(:)'; Pa4(:)';...
- Pa5(:)'; Pa6(:)';Pa7(:)'; Pa8(:)'; Pa9(:)'];
- end
- end