大家好,小弟是新手,
目前在做两张等尺寸(160*128)图片叠合,
并因希两张图片之RGB值可以改变,作多种不同比例的叠合,
一张为黑白影像,一张为单纯绿色(R=B=0)
叠合方式希望选取图片每点(pixel)的RGB值较高部分,
RGB较低部分则舍去,由此
生成新的图形,但生成的新图形,一直与原图一样
麻烦各位帮忙解惑了,谢谢
程式码如下
读取1&2张图片
A=imread('s1.bmp');
S1=size(A)
AR=A(:,:,1);
AG=A(:,:,2);
AB=A(:,:,3);
AR1=reshape(AR,1,20480);
AG1=reshape(AG,1,20480);
AB1=reshape(AB,1,20480);
X=imread('20.bmp');
S2=size(X)
XR=X(:,:,1);
XG=X(:,:,2);
XB=X(:,:,3);
XR1=reshape(AR,1,20480);
XG1=reshape(AG,1,20480);
XB1=reshape(AB,1,20480);
决定图1&图2RGB
Glevel=[35 35 35 38]; % [R G B G2]
H=128;
L=160;
imshow(reshape(AR1,H,L))
figure;
imshow(reshape(AG1,H,L))
figure;
imshow(reshape(AB1,H,L))
PR=reshape(AR1,H,L);
PG=reshape(AG1,H,L);
PB=reshape(AB1,H,L);
for j=1:size(Glevel,1)
[row2 clm2]=find((((PR==0)+(PG==0)+(PB==0)))<3); % 改字的辉度
for i=1:length(row2);
PR(row2(i),clm2(i))=Glevel(j,1);
PG(row2(i),clm2(i))=Glevel(j,2);
PB(row2(i),clm2(i))=Glevel(j,3);
end
imshow(PG)
[row clm]=find((((PR==0)+(PG==0)+(PB==0)))==3); % 改底的辉度
for i=1:length(row);
PG(row(i),clm(i))=Glevel(j,4);
end
% imshow(PG)
% figure;
% imshow(PR)
% figure;
% imshow(PB)
end