How to combine thresholded images
3 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
採用された回答
Image Analyst
2014 年 8 月 18 日
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.
0 件のコメント
その他の回答 (1 件)
Meshooo
2014 年 8 月 18 日
Use cat
RGB = cat(3, R, G, B)
3 件のコメント
Image Analyst
2014 年 8 月 18 日
編集済み: Image Analyst
2014 年 8 月 18 日
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.
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!