how to get number of pixels of red color in an image??

7 views (last 30 days)
i am taking an image through web cam, how to recognize how many pixels are there for specific colour such as red

Answers (2)

Walter Roberson
Walter Roberson on 10 Mar 2013
The first step is to rigorously define "red". By the time you have finished doing that, you will be due to retire.

Image Analyst
Image Analyst on 11 Mar 2013
swapna, please check out my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862. I show several ways to segment out pixels of certain colors. You can adapt the code to select as narrow or as wide a range of colors as you want. Also check out the general File Exchange. It seems that tracking colored objects (balls, lasers, etc.) must be one of the most common student projects.
  2 Comments
Medical Imaging
Medical Imaging on 28 Jul 2017
Dear sir I have one ground truth image(image 1) and other segmented image(image 2). I want to compute the number of pixel for white area for image 1 and number of pixel for red area in image 2. and then want to compute the difference of pixels.
Walter Roberson
Walter Roberson on 28 Jul 2017
In this situation, for each of the images, you can just calculate
nnz(TheImage(:,:,1))

Sign in to comment.

Categories

Find more on Images in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!