- 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
2 次查看(过去 30 天)
显示 更早的评论
Hello,
For my project I have these 2 photos:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/770036/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/770041/image.jpeg)
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!