⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 combined_corr.m

📁 这是一个去马赛克工具软件
💻 M
字号:
function CLab=combined_corr(Tfilename,Csize,I,M)
%This function calculates the combined correlations, which is the sum of
%the correlation of the L components, the a components and the b
%components.

%Load template in the specified size and convert it to Lab space.

T=image_resize(['../caras/',Tfilename],Csize);
T=applycform(T,M);
[tx,ty,tz]=size(T);
[imx,imy,imz]=size(I);

%Calculate the normalized cross correlation of each component, and crop the
%result such that it has the same size as the original image.

CL=normxcorr2(T(:,:,1),I(:,:,1));
CL=CL(round(tx/2):(imx+round(tx/2)-1),round(ty/2):(imy+round(ty/2)-1));
CL(1:round(tx/2),:)=-1.*ones(size(CL(1:round(tx/2),:)));
CL((imx-round(tx/2)):imx,:)=-1.*ones(size(CL((imx-round(tx/2)):imx,:)));
CL(:,1:round(ty/2))=-1.*ones(size(CL(:,1:round(ty/2))));
CL(:,(imy-round(ty/2)):imy)=-1.*ones(size(CL(:,(imy-round(ty/2)):imy)));
Ca=normxcorr2(T(:,:,2),I(:,:,2));
Ca=Ca(round(tx/2):(imx+round(tx/2)-1),round(ty/2):(imy+round(ty/2)-1));
Ca(1:round(tx/2),:)=-1.*ones(size(CL(1:round(tx/2),:)));
Ca((imx-round(tx/2)):imx,:)=-1.*ones(size(CL((imx-round(tx/2)):imx,:)));
Ca(:,1:round(ty/2))=-1.*ones(size(CL(:,1:round(ty/2))));
Ca(:,(imy-round(ty/2)):imy)=-1.*ones(size(CL(:,(imy-round(ty/2)):imy)));
Cb=normxcorr2(T(:,:,3),I(:,:,3));
Cb=Cb(round(tx/2):(imx+round(tx/2)-1),round(ty/2):(imy+round(ty/2)-1));
Cb(1:round(tx/2),:)=-1.*ones(size(CL(1:round(tx/2),:)));
Cb((imx-round(tx/2)):imx,:)=-1.*ones(size(CL((imx-round(tx/2)):imx,:)));
Cb(:,1:round(ty/2))=-1.*ones(size(CL(:,1:round(ty/2))));
Cb(:,(imy-round(ty/2)):imy)=-1.*ones(size(CL(:,(imy-round(ty/2)):imy)));

%Compute combined correlation.

CLab=CL+Ca+Cb;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -