views:

48

answers:

2

how can i subtract one image from another either row wise or column wise ?

A: 

Use OpenCV Have two IPlImage variables point to your two images and subtract them..like this

IplImage im1=your image1;
IplImage im2=your image2;
IplImage im3;
cvSub(im1,im2,im3);

Obviously you need to open the images first. This works because iplimage is a derived structure from mat

Ram Bhat
thanks for the answer but i neeed in matlab if you dont mind giving me in matlab
+1  A: 

I don't quite understand what you mean with 'row-wise' or 'column-wise'. In MATLAB, you can subtract two images from one another directly, as long as they're the same size, of course.

%# load the images
im1 = imread('firstImage.tif')
im2 = imread('secondImage.tif')

%# subtract
deltaImage = im1 - im2;

Note: If you have the image processing toolbox, you can use deltaImage = imsubtract(im1,im2) to deal with underflow if your images are integer arrays.

Jonas
i mean to say that i want to subtract from the pixel wise either from row wise or column wise and to get the difference
Since you don't need to loop in order to subtract images, there is no need to worry about rows/cols.
Jonas