- What are the inputs? "my picture" could be a painting, a JPG file or an indexed image loaded into Matlab already with 3 different colors.
- What exactly is "green"? Did you specify this already? Note that there are a lot of shadings between green and brown, such that you have to define the method to distinct them.
- What did you try so far and which problems occurred? Show your own effort to motivate others to help you. Currently your question is short and does not define the problem exactly. But a meaningful answer must be long, complicated, consider different interpretations of your description of the wanted solution and a lot of code.
How to make green region red
1 回表示 (過去 30 日間)
古いコメントを表示
In my picture i have green parts,brown region,in that i want to make green regions as red and brown region as yellow and if other regions are there they must be coloured as majenta,plz help
2 件のコメント
Jan
2012 年 11 月 30 日
編集済み: Jan
2012 年 11 月 30 日
@Pat: You are not a beginner in this forum. Please follow the standard procedure:
This is a public forum and not an English to M-function machine. Therefore it is a good strategy to spend time and energy to formulate questions as clear as possible, to allow for the efficient creation of answers.
回答 (1 件)
Image Analyst
2012 年 11 月 30 日
Pat, we can't run that. You didn't supply se(). But why not just convert to HSV colorspace, and threshold the image to find the green and brown pixels? Then use those masks as masks to replace the green pixels with red pixels and the brown pixels with yellow pixels. Since this sounds pretty much useless in the real world but sounds extremely like what a class exercise would be I can't do it for you but it's pretty much done in my demo http://www.mathworks.com/matlabcentral/fileexchange/28512-simple-color-detection-by-hue Otherwise all I can say is that your code is wrong somehow but I can't figure it out because we can't run it, but I don't really see any replacement of colors going on.
3 件のコメント
Image Analyst
2012 年 11 月 30 日
Yes, like this
imageBlock(:,:,1) = seaColor(1); % Assign the red component.
imageBlock(:,:,2) = seaColor(2); % Assign the green component.
imageBlock(:,:,3) = seaColor(3); % Assign the blue component.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!