how can i find the number of the overlapped white pixels between 2 black and white images?
Mostrar comentarios más antiguos
Hi all
i have 2D images (BW), i performed transformation on one of them ,while keeping one without any changes , after that i need to find the number of the overlapped white pixels between imag1 and transformed imag2 ? how can i do this in matlab ?
please , i need simple illustration .
regards
Respuestas (1)
Sven
el 15 de Feb. de 2012
Im1 = rand(50,50)>0.2; % your first image
Im2 = rand(50,50)>0.6; % your transformed image
overlapIm = Im1 & Im2;
numSharedWhitePixels = nnz(overlapIm);
Is that what you were looking for?
5 comentarios
mmm ssss
el 15 de Feb. de 2012
Ashish Uthama
el 16 de Feb. de 2012
Those are examples Sven used to convey the idea of using '& and nnz. Think of Im1 as the 'keeping one without any changes' and Im2 as the 'performed transformation on one of them' from your description.
mmm ssss
el 16 de Feb. de 2012
Image Analyst
el 16 de Feb. de 2012
If the images are not of the same size, you need to rethink what you're attempting to do. Why did it change size? Just what kind of transform are you doing? Maybe you can resize one of the images to match the other.
mmm ssss
el 17 de Feb. de 2012
Categorías
Más información sobre Image Arithmetic en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!