フィルターのクリア

Can we use standard deviation of color image as a contrast value?

27 ビュー (過去 30 日間)
dila suay
dila suay 2023 年 3 月 18 日
コメント済み: Walter Roberson 2023 年 3 月 21 日
Hello,
Is it possible to compare the contrasts of 2 image by comparing std2(rgbimage) or is it necessary to convert to gray scale? Can you describe what is the difference between them?
Thank you

採用された回答

Walter Roberson
Walter Roberson 2023 年 3 月 19 日
That particular kind of contrast is called RMS contrast; there are other contrast measures as well.
YourImage = imread('flamingos.jpg');
c3 = std2(im2double(YourImage), [], [1 2]);
would give you the contrast of each color pane independently, giving you a 1 x 1 x 3 result.
But then what do you with the vector of 3 results? You could interpret them as an RGB color
image(c3)
but does it make sense for "contrast" to be interpreted as a color??
If you examine the other kinds of contrast measures, they mostly work with luminance -- requiring that you convert to grayscale or Lab or similiar first.
  4 件のコメント
dila suay
dila suay 2023 年 3 月 21 日
Thank you so much
Walter Roberson
Walter Roberson 2023 年 3 月 21 日
Thought experiment:
Are the contrasts of all of these the same, or are some different?
[255, 0, 0, 0, 0]
[255, 0, 255, 0, 0]
[255, 255, 0, 0, 0]
[0, 255, 255, 0, 0]
[0, 0, 255, 0, 0]

サインインしてコメントする。

その他の回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 3 月 18 日
Numerically to find the differences of the two imaes (of the same size) and then compute the std of the computed differences are feasible, e.g.:
A = imread('A_RGB.png'); % Size is 1000-by-1200 RGB image
B = imread('B_RGB.png'); % Size is 1000-by-1200 RGB image
diff_AB = A-B;
std_diff=std2(diff_AB); % STD of the difference
  3 件のコメント
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 3 月 18 日
if you're looking for an RMS contrast value, then you can easily implement the calculation equation given here into your code:
Which is applicable for RGB and grey images.
Simple calc of the grey image contrast value is:
IM = imread(GImage);
IM_contrast = max(IM(:))-min(IM(:));
dila suay
dila suay 2023 年 3 月 21 日
The problem with IM_contrast = max(IM(:))-min(IM(:)) is that even I have 1 pixel of black and white, it will give me 'full contrast'. Do you know how can I set a threshold for pixel count?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeExplore and Edit Images with Image Viewer App についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by