Differences between two photos

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!! =)

 Respuesta aceptada

Image Analyst
Image Analyst el 3 de Mayo de 2015
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.

Más respuestas (0)

Categorías

Más información sobre Read, Write, and Modify Image en Centro de ayuda y File Exchange.

Preguntada:

el 3 de Mayo de 2015

Respondida:

el 3 de Mayo de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by