搜索内容 搜索用户

# 5 麦片

050

1主题 0最佳答案

 有没有大神可以帮忙改下程序，主要是使用一个图片给另一个图片进行颜色的迁徙。目前程序可以运行，但是显示图片是全黑的，希望大神可以帮忙改下，谢谢。 %+++++++++++++++++++++++++++++求取目标图像的lab+++++++++++++++++++++++++++++++++++ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ l3=zeros(wid,hei); alpha3=zeros(wid,hei); beta3=zeros(wid,hei); for i=1:wid     for j=1:hei         l3(i,j)=(l2(i,j)-lm2)*sigm1/sigm11+lm1;         alpha3(i,j)=(alpha2(i,j)-am2)*sigm2/sigm22+am1;         beta3(i,j)=(beta2(i,j)-bm2)*sigm3/sigm33+bm1;     end end %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %+++++++++++++++++++++++++++++++反变换到LMS++++++++++++++++++++++++++++++++++++ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ L3=zeros(wid,hei); M3=zeros(wid,hei); S3=zeros(wid,hei); for i=1:wid     for j=1:hei         m=inv(con3*con2)*[l3(i,j);alpha3(i,j);beta3(i,j)];         L3(i,j)=m(1);         M3(i,j)=m(2);         S3(i,j)=m(3);     end end %==================================LMS取指数=============================== L3=power(10,L3); M3=power(10,M3); S3=power(10,S3); %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %++++++++++++++++++++++++++++++转换到RGB++++++++++++++++++++++++++++++++++++++ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ TarR=zeros(wid,hei); TarG=zeros(wid,hei); TarB=zeros(wid,hei); for i=1:wid     for j=1:hei         m=inv(con1)*[L3(i,j);M3(i,j);S3(i,j)];         TarR(i,j)=m(1);         if TarR(i,j)>255            TarR(i,j)=255;         elseif TarR(i,j)<0            TarR(i,j)=0;           end         TarG(i,j)=m(2);         if TarG(i,j)>255            TarG(i,j)=255;         elseif TarG(i,j)<0            TarG(i,j)=0;           end         TarB(i,j)=m(3);         if TarB(i,j)>255            TarB(i,j)=255;         elseif TarB(i,j)<0            TarB(i,j)=0;           end             end end Tar=uint8(cat(3,TarR,TarG,TarB)); imshow(Tar);

 您需要登录后才可以回帖 登录 | 注册 本版积分规则 回帖后跳转到最后一页