how to set the background color of this image to 0 and remaining foreground color to 1 to make this image binary?
2 ビュー (過去 30 日間)
古いコメントを表示

0 件のコメント
採用された回答
Image Analyst
2019 年 3 月 30 日
Make a mask:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Now make the mask
mask = ~(recChannel ~= 0 & greenChannel == 0 & blueChannel == 0);
2 件のコメント
Image Analyst
2019 年 3 月 30 日
Your colors are not pure.
When I tried to save the image it looks like this is a labeled image returned from the watershed function, so you should already have the binary image to begin with, so that is what you want. You can also get it from the labeled matrix like
binaryImage = labeledMatrix ~= 0;
but that should not be necessary. Not sure how the white boundary lines got there though.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Modify Image Colors についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
