|
Prev: Bloated files when saving large variables to .mat files with -append
Next: Use memset to initialize floats and doubles to 0.0
From: Dawn on 6 May 2008 04:44 Here are 2 images. Original and Processed. Original: http://bp2.blogger.com/_dY9PPdeLapU/SCAXQJWgxYI/AAAAAAAAAKI/ oA9Pewda5rA/s320/original.bmp Processed: http://bp0.blogger.com/_dY9PPdeLapU/SCAYApWgxZI/AAAAAAAAAKQ/ yrSxCKYLlIs/s320/processed.bmp I want to check the white pixels on the Processed Image against the original. If they are white on the original, make it black. If not keep them white. The code I tried is like this: >> [row, col] = find(Processed == 1); %Obtain the coordinates of the white pixels >> if Original(r,c) == 1 %If on the original the they are white Processed(r,c) = 0; %Make it black end Somehow the program doesn't work. It fails to remove any pixel on the Processed Image. Can anyone tell me what is wrong with the code?
From: Dawn on 6 May 2008 04:51 The image links are incompletely highlighted. Please visit: http://dawnllc.blogspot.com/2008/05/matlab-how-to-change- specified-pixel.html to view the images regarding to the question. Thanks very much.
From: us on 6 May 2008 04:57
"Dawn ": <SNIP a matter of logic... one of the many solutions % the images a=zeros(4); % the original... a(2,:)=1; b=a; b(2,[1,end])=0; b(3,:)=1; % the processed... % the engine c=b; c(a&b)=0; % the result a,b,c us |