Subtraction of 2 images

46 views
Skip to first unread message

Siddhartha gupta

unread,
Sep 8, 2012, 6:34:33 PM9/8/12
to cs498-...@googlegroups.com
So I filtered a colored image with a low pass gaussian filter, and then subtracted the result from the original giving me a white image. When I did the same procedure for a black and white image, I got an edges intensive picture as expected. Shouldn't the difference of the colored images shown some result as well?

Hoiem, Derek W

unread,
Sep 8, 2012, 7:45:55 PM9/8/12
to cs498-...@googlegroups.com

Good question.  The difference might be happening in the display function.  The two main image display functions are:

 

imshow: always assumes that an image has a natural range of values (e.g., 0 to 1 if floating, 0 to 255 if uint8)

 

imagesc: if the image has only one band (size of third dimension is 1), by default scales values so that lowest value is black and highest value is white (or blue/red depending on the colormap); if the image has three color bands, displays similarly to imshow, without scaling. 

 

I would expect that if you try to show (original – smooth) for the RGB image, the resulting image would be almost black, though, not white.  If you want to see if the RGB laplacian image is correct, try displaying each band separately, e.g.,

figure(1), for b = 1:3, subplot(1,3,b), imagesc(lapim(:, :, b)); axis image, colormap gray; end

 

Derek

--
 
 

Siddhartha gupta

unread,
Sep 9, 2012, 1:07:59 PM9/9/12
to cs498-...@googlegroups.com
I used imagesc..thanks for the info I'll try it out.
Reply all
Reply to author
Forward
0 new messages