Extract color of image
조회 수: 24 (최근 30일)
이전 댓글 표시
I want to extract red part and green part of attached image. I want to extract Red part is to one image and green part is to next image. Please help me.
댓글 수: 0
답변 (3개)
Walter Roberson
2016년 10월 11일
IM = imread('red_rose.jpeg');
R_only = IM;
R_only(:,:,[2 3]) = 0;
imshow(R_only);
pause;
G_only = IM;
G_only(:,:,[1 3]) = 0;
imshow(G_only);
댓글 수: 2
SREERAG k
2017년 11월 21일
how can i identify a picture uploaded is a leaf or not
댓글 수: 6
Walter Roberson
2017년 11월 24일
이동: DGM
2023년 2월 12일
Please stop posting your responses as new Answers. Instead, click on one of the "Comment on this Answer" links to add the information there.
You have to define what it means for a color to be "green". See https://blog.xkcd.com/2010/05/03/color-survey-results/ for partial information on differences in how some people define green.
When I say you have to define what it means for a color to be green, I mean that you need to give us rules that allow us to test any given RGB pixel and determine Yes, or No, "Does this color count as green?". It has to be able to make firm decisions. For example, does RGB [0, 1/255, 0] count as "green", or does it count as "black" ? Does [242/255, 255/255, 242/255] count as "green" but [252/255, 255/255, 252/255] counts as "grey" ? If the green channel is full intensity, then exactly what is the maximum that the R and B channels can be set to and still have the color count as "green"? We need hard rules with all of the boundary conditions described, not just the word "green".
Yushuo
2022년 6월 28일
편집: Yushuo
2022년 6월 28일
I use the attached code to extract red color (it use LAB color, you can change the LAB value of the color you want in LMean aMean bMean) and you can change the tolerance as well. Parts code from https://se.mathworks.com/matlabcentral/fileexchange/31118-color-segmentation-by-delta-e-color-difference
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!