Hey guys! I'm new on matlab and I'm trying to do one thing, but I do not get it. The problem is that, for example, imagine there is a table and we take a photo. After this we put some element above the table ,for example, an apple and we take another photo. So, the question is, How can I determine the ROI (Region Of Interest) from the difference between the two images?
I was reading about roifilt2, roicolor... but I do not know how to apply that to it.
Thank you, kss!! =)

 Akzeptierte Antwort

Image Analyst
Image Analyst am 3 Mai 2015

1 Stimme

Try simply subtracting the images.
diffImage = double(image1) - double(image2);
imshow(diffImage, []);
Casting to double is important otherwise you will never get negative numbers. Also, the [] in imshow() lets you see both positive and negative numbers. If you want a binary image and have a color image, then you can use the max function, something like
diffImage = max(abs(diffImage), [], 3) % For a color image.
Nothing more to do for a gray scale image. Then
binaryImage = abs(diffImage) > 5; % Or whatever number works.

Weitere Antworten (0)

Kategorien

Mehr zu Read, Write, and Modify Image finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by