Comparing two binary images: if a pixel is 1 in both images, write a 1 into a new image, otherwise, write a 0.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Julian
il 22 Ott 2012
Commentato: Walter Roberson
il 18 Feb 2022
Hello everyone,
I have a somewhat noisy image and I would like to reduce or clear the noise.
To do so, I performed and opening. Since I don't want to lose any information of the objects' surface, I think it is easiest, to "compare" the two pictures, the original and the opened one. Meaning, when I have a 1 in the original image and a 1 in the opened image, I want to write a 1 into a third, new image. When I have a 1 in the original picture and a 0 in the opened picture I want to write a 0 in the new, third image. And when there are two 0s, I of couse want a 0 in the new image.
If you click on the link, you see the original image on the left and the opened image in the middle. It should look like a mixture of the first to images with all the surface information...
I tried to multipy the images (result=ImgOpen*ImgOrg), which in my opinion should lead to the desired result (1*1=1; 1*0=0), but the result looks like the image on the right...?!
Do you understand what I mean? It's a little hard to describe that in another language. Sorry!
Thank you! Thymes
0 Commenti
Risposta accettata
Walter Roberson
il 22 Ott 2012
result = ImgOpen .* ImgOrg;
The * operator is mathematical matrix multiplication, not element-by-element multiplication.
Note: the answer given for your other question is still correct,
result = ImgOpen & ImgOrg;
2 Commenti
Walter Roberson
il 18 Feb 2022
You should open a new question about that; it is not related to the current topic.
Note: "compare" of two images is not well-defined unless you define it precisely. "FInd 12 mistakes in the second image" is a quite different technique than "Decide which kind of brain tumour this patient has" or "Figure out where in the world this picture was taken".
Più risposte (2)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!