필터 지우기
필터 지우기

Finding the contrast ratio of a grayscale image

조회 수: 52 (최근 30일)
iseinas
iseinas 2020년 9월 4일
댓글: Image Analyst 2021년 7월 11일
So as the title says, I want to find the contrast ratio of a grayscale image by Michelson contrast definition. I'm thankful for any help! I'm not sure how to do this. Am I supposed to find the max and min value in each columns or row or the whole matrix?
% Michelson contrast definition
% Imax : the largest value in the image's matrix
% Imin : the smallest value in the image's matrix
contrast = (Imax-Imin)(Imax+Imin)

채택된 답변

Image Analyst
Image Analyst 2020년 9월 6일
Do you need loops, like this is a homework question that requires them? If not, just simply do
Imax = max(I(:))
Imin = min(I(:))
contrast = (Imax - Imin) / (Imax + Imin)
Notice that I'm using the correct formula. You are not. They subtract in the numerator, not divide like you have it.
  댓글 수: 4
Itzhak Mamistvalov
Itzhak Mamistvalov 2021년 7월 11일
Hey, I would like to ask an adition question about contrast ratio.
Im trying to calculate to Contrast Improvment Ratio (CIR) between enhanced and unenhanced images within region of interest R. This is the formula Im using:
where C(x, y) and C¯(x,y)C¯(x,y) are the local contrast values at (x, y) of the unenhanced and enhanced images, respectively.
The Local contrast value C(x, y) computed as
where p and a are the mean values within the center region (3 × 3) pixels and the neighborhood, or surrounding region, (7 × 7) pixels, respectively.
I have a problem to actually write this into a matlab code.
I would appreciate it if you could help, thanks!

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

추가 답변 (1개)

royed
royed 2020년 9월 6일
if the question is about just comapring the max and min in the images. You can find it quite simply by using (max(max(image)) and the same for the minimum which would return the pixel with the max and minimum intensity value.

카테고리

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