开发者

subtracting one image from another

how开发者_如何学Go can i subtract one image from another either row wise or column wise ?


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.


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


Here is a possible solution:

[file path]=uigetfile('*.jpg');
I=imread([path file]);
[file path]=uigetfile('*.jpg');
J=imread([path file]);
K=I-J;
figure;
imshow(K);
title('SUBTRACTED IMAGE ');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜