필터 지우기
필터 지우기

Personalized RGB Masked Image

조회 수: 4 (최근 30일)
Allinone
Allinone 2021년 10월 22일
이동: DGM 2023년 3월 4일
Hi everyone! I'm very new in MatLab Programming.
I have a RGB image and I want that certains color pixels are white, certain pixels are black and the others grey. I used the Threshold Apps (with binary mask), but I have only black or white pixels.

채택된 답변

Image Analyst
Image Analyst 2021년 10월 22일
I'm not sure what you are asking. So what does your original image look like? What do you mean that you want white, black, and gray pixels?
If you use the Color Thresholder app (on the Apps tab of the Tool Ribbon) you can find thresholds to segment out a certain color, like red for example. This will create a mask where it's true/1/white where there are red pixels and false/0/black where the pixels are not red.
Attach your image and explain better if you need more help.
  댓글 수: 14
Image Analyst
Image Analyst 2021년 10월 29일
이동: DGM 2023년 3월 4일
Those images do not have any green, yellow, or brown in them. Again, "Attach the image that has all these colors that you're working with." How can we fix your code if you won't give us the input image?
Allinone
Allinone 2021년 10월 29일
이동: DGM 2023년 3월 4일
It's the same image I attached before. I attached it again.

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Image Analyst
Image Analyst 2021년 10월 29일
Doing the same thing for yellow and brown is easy and straightforward.
  댓글 수: 3
Image Analyst
Image Analyst 2021년 11월 3일
Copy that code multiple times with appropriate changes, or put in in a loop.
Allinone
Allinone 2021년 11월 3일
I have created a function for each pair of colors. I would like to call these functions in the main script and see all the outputs, but I don't know how do i do. Sorry..I'm very new in MatLab..

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2021년 10월 29일
Doing the same thing for yellow and green is easy and straightforward.
See my other answers for different color pairs.
  댓글 수: 1
Allinone
Allinone 2021년 10월 29일
Ok, thank you so much! I wrote the same code, but with different values, so I didn't have the gray levels..

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2021년 10월 29일
See my discriminant analysis color segmentation demo.
Also check out my delta E demo, attached.
I've posted several new answers this session so be sure to see them all.
  댓글 수: 2
Allinone
Allinone 2021년 10월 29일
편집: Allinone 2021년 10월 29일
Your delta E works with all colors?
Could I detect pairs colors with your delta E, or threshold is better?
Image Analyst
Image Analyst 2021년 10월 29일
The delta E demo identifies all pixels that are within a certain color distance of the average color that you outlined. It finds the delta E of all pixels in the image to the average color, and then thresholds it at the delta E you specify to find colors (anywhere in the image) that are close to what you drew. For example here I drew over the red pepper and it found all red pixels that are within a delta E of 21.9 from the average red in the region I drew.
For what it's worth, I'm attaching another, slightly different demo that works with two images.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by