필터 지우기
필터 지우기

how can i calculate and display the particular range of pixels in the image?

조회 수: 4 (최근 30일)
My main task is to highlight the particular pixel value by changing the color of that pixel. For example; we have a color image. I want to highlight a particular color in the image with the help of range of pixels.Can i have a code for this please.

채택된 답변

Image Analyst
Image Analyst 2017년 3월 17일
Set up a colormap and apply it. For example (untested)
grayImage = imread('cameraman.tif');
imshow(grayImage);
cmap = gray(256);
% Make gray levels 150 - 170 red
cmap(151:191, 1) = 1;
cmap(151:191, 2) = 0;
cmap(151:191, 3) = 0;
colormap(gca, cmap);
colorbar;
hp = impixelinfo();
  댓글 수: 2
ABDUL WAHID MOHAMMED
ABDUL WAHID MOHAMMED 2017년 4월 1일
I can change the selected range of pixels in the image to red.How can i count the area or the count of the 'red color'(the range changed)?
Image Analyst
Image Analyst 2017년 4월 1일
In the above example where you were interested in the range 150-170, and pseudocolored those pixels to red (in the display only, NOT by changing the original image values) by using a colormap, you can use imhist() and sum up those bins
[counts, grayLevels) = imhist(grayImage);
numPixels = sum(counts(151:171))

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Red에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by