recover color on image
5 ビュー (過去 30 日間)
古いコメントを表示
i am converted rgb color image to im2bw format and gray scale image.
after i am extracted the boundary then i want to stored the the colored image.
please tell how to manage the color then recover or apply color for gray scale image and im2bw image
3 件のコメント
Image Analyst
2012 年 10 月 10 日
I'm not even sure what this means. Once you've thrown away the color info, it's gone, at least in those binary and gray images. Of course you still have the original rgb color image so you don't need to recover anything because you have the original.
Walter Roberson
2012 年 10 月 10 日
I think it means that they want to overlay the boundary lines on the color image.
回答 (1 件)
DGM
2024 年 9 月 25 日
I guess if I'm going to bump threads by fixing the formatting, I could at least try to answer them. This collection of threads is a handful of incomplete code and unclear objectives. I'm just going to assert objectives. We want to create a color composite image between a grayscale processed image and a set of perimeters from bwperim(). I assume that the collected blob properties, image contours, and boundary point lists that were the stars of prior posts were never actually relevant.
The only reason why I thought this was interesting was that this happened 12 years ago. In 2012, imoverlay(), labeloverlay(), and even the original FEX version of imoverlay() weren't options. MIMT was still an unrealized bad idea. Luckily, we can still use bsxfun() like it never went out of style.
% you have a grayscale image
inpict = imread('toyobjects.png');
% you binarize it somehow
mask = inpict~=127;
% you get the blob boundaries using bwperim()
maskp = bwperim(mask);
% do basic multiplicative composition
% since we're living in 2012, this uses bsxfun()
fgcolor = [0 1 0]; % pick a color
compmask = im2double(maskp);
fgc = bsxfun(@times,compmask,permute(fgcolor,[1 3 2]));
bgc = bsxfun(@times,(1-compmask),im2double(inpict));
outpict = im2uint8(bsxfun(@plus,fgc,bgc));
% show it or save it or whatever
imshow(outpict)
By chance, there is one anachonism in this example though. When I went to verify that everything would run in a period version, I found that the test image I had chosen didn't exist. The metadata suggests that toyobjects.png was last modified on October 5, 2012 -- only four days before this post was made. I figured I should leave it just to keep the time travelers on their toes.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!