- It's going to be used on other images
- You know what the other images are
- you have a formal description of what the rejection criteria are
Find the best between 2 images
3 ビュー (過去 30 日間)
古いコメントを表示
Hello,
For my project I have these 2 photos:
As you can see there are some differences between these 2 images.
What I want to do is to compare somehow these 2 images and to reject the second one because of the white pixels at the up right corner.
To be more clear, I want to compare these 2 images and to recognize that the second one has many white pixels and reject it.
2 件のコメント
DGM
2021 年 10 月 18 日
編集済み: DGM
2021 年 10 月 18 日
Code that will identify one of these two images is likely going to be a complete waste of time unless:
If all you have are two images and you already know which is rejected, then your task is done.
Otherwise maybe you can do some sort of histogram analysis or saturated pixel count? Without knowing items 2 &3, it's hard to know what is even appropriate.
Re: saturated pixel count, you could look at the images and try to decide what the rejection criteria are supposed to be...
A = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/770036/image.jpeg');
B = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/770041/image.jpeg');
Asat = [nnz(A == 0) nnz(A == 255)] % [black white]
Bsat = [nnz(B == 0) nnz(B == 255)] % [black white]
Which might be adequate to identify and reject B, if you only care about white and if all your pictures have similar content and defects.
Consider the example
X = rgb2gray(imread('peppers.png'));
X = imadjust(X,stretchlim(X,0));
A = imadjust(X,[0 0.89]);
B = imadjust(X,[0.07 1]);
imshow(A)
clf
imshow(B)
Which image is "worse"? Both have been damaged to approximately the same degree.
% total saturated pixels
Asat = [nnz(A == 0) nnz(A == 255)] % [black white]
Bsat = [nnz(B == 0) nnz(B == 255)] % [black white]
% number of pixels contributed by defect
dw = sum(A==255,'all')-sum(X==255,'all') % white pixels clipped in A
db = sum(B==0,'all')-sum(X==0,'all') % black pixels clipped in B
If only overexposure matters, the answer might be clear. In order to get meaningful results, you need to define what's meaningful.
採用された回答
yanqi liu
2021 年 10 月 18 日
sir,may be use some score, such as
clc; clear all; close all;
im1 = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/770036/image.jpeg');
im2 = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/770041/image.jpeg');
score1 = [brisque(im1) niqe(im1)]
score2 = [brisque(im2) niqe(im2)]
2 件のコメント
yanqi liu
2021 年 10 月 19 日
sir, it is No-Reference Image Quality Assessment
so, the value higher and the quality lower
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!