필터 지우기
필터 지우기

darkest pixel in image

조회 수: 9 (최근 30일)
nagini
nagini 2013년 2월 26일
i want to get the darkest pixel in an image. the histogram represents the tonal distributions. the pixels that are darkest of all will be at the first line in histogram. how to get the pixels values that are in the darkest gray levels from an histogram. Please anybody help me.

채택된 답변

ChristianW
ChristianW 2013년 2월 26일
X = rand(100);
[C,I] = min(X(:));

추가 답변 (1개)

Tijmen
Tijmen 2013년 2월 26일
If you only have a gray-value image, then the following command will suffice:
darkestPixelValue = min(image(:));
If you have a color image, you first need to convert it to gray-values:
imageGray = im2gray(image);
darkestPixelValue = min(imageGray(:));
If you also would like to find the indices of the pixels in the image, you can use the following command:
[rowVal, colVal] = find(image == darkestPixelValue);
This returns an array of row- and column values corresponding to points at which the pixels are darkest.
  댓글 수: 1
Image Analyst
Image Analyst 2013년 2월 26일
Right, just remember not to use "image" as the name of your variable. Call it rgbImage or something so you don't blow away the built in image() function.

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

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by