How to combine thresholded images

2 Ansichten (letzte 30 Tage)
msij
msij am 18 Aug. 2014
Beantwortet: Image Analyst am 18 Aug. 2014
Hi,
I was following one of the tutorials on thresholding colour images and I am having trouble with one step. It is a colour jpg image and I am trying to remove background noise, large & small outlying spots and then count the number of spots.
Basically I separate the image into R , G and B components and then generate a threshold value and use the im2bw function. This step works fine, but when I try to combine them together to analyse the final binary image I am not getting the right thing.
The function I am using to combine the three is rgb=(r&g&b) . When I combine just r and g everything works fine and I see the red spots and the green spots come together. But when I include b in the function, it subtracts spots from the final image.
Is there something I am doing wrong, does this function not serve my purpose or is there something better I can do?
Thank you.

Akzeptierte Antwort

Image Analyst
Image Analyst am 18 Aug. 2014
Please post your image and code. rgb is a very bad name for an image that is not RGB - it's deceptive. Your rgb image is actually a binary (logical) image, NOT an RGB image. What you did was to create a binary image that is true/white/1 ONLY where it's true/white/1 in the r binary image AND the g binary image AND the b binary image. Perhaps you want OR, I don't know. I can't really say more until you post your image(s) and code.

Weitere Antworten (1)

Meshooo
Meshooo am 18 Aug. 2014
Use cat
RGB = cat(3, R, G, B)
  3 Kommentare
Adam
Adam am 18 Aug. 2014
Use 'image' with the result of cat
Image Analyst
Image Analyst am 18 Aug. 2014
Bearbeitet: Image Analyst am 18 Aug. 2014
He has that image - that's just his original! If you did the same thing with lower case r,g,b you'd get an image with values around 0 and 1 and it would be so dark you could not see anything. So it's not a problem of whether he used imshow() or image(). And of course using bwlabel in that is just nonsense. So it's just a matter of doing the wrong thing(s) instead of the right thing(s). And you don't want to use cat() on the lower case r, g, b binary images.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help 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