Compare two images( Gold standard black vs regular black) using RGB?
1 次查看(过去 30 天)
显示 更早的评论
I have two images. I am comparing one to a gold standard pure black image from edmunds. I'm not sure how I would go about comparing them. I think I want a sort of correction factor that can say how dark a specific pigment is in relation to another.
Here is the code for 12 images that we at the lab are using now.
str = 'C:\Users\Jake\Desktop\MATLAB IMAGES\IMAGES\Edmund-polymer comparison_ABR\'; % Purpose???
imagefiles = dir('C:\Users\Jake\Desktop\MATLAB IMAGES\IMAGES\Edmund-polymer comparison_ABR\*.jpg'); % accesses folder
nfiles = length(imagefiles); % Number of files found
for i = 1:nfiles
currentfilename = [str imagefiles(i).name]; % sets file name with string
currentimage = imread(currentfilename); % reads image
subplot(2,nfiles,i); % plots image with (?) and (?)
imshow(currentfilename); % shows image
subplot(2,nfiles,i+12); % plots below (?) and (i +12?)
imshow(currentimage(:,:,3)); %shows the image at the plot location
% YOLO TOTALLY WORKED AND I JUST WINGED IT, TIME TO CELEBRATE
% 1 next step needs each pic to have name
% 2 ENLARGE
% 3 How to compare mathematically?? (correction factor that patil
% discussed for noise??)
% 4 format axes? somehow
%Split into RGB Channels
Red = currentimage(:,:,1);
Green = currentimage(:,:,2);
Blue = currentimage(:,:,3);
%Get histValues for each channel
[yRed, x] = imhist(Red);
[yGreen, x] = imhist(Green);
[yBlue, x] = imhist(Blue);
%Plot them together in one plot
plot(x, yRed, 'Red', x, yGreen, 'Green', x, yBlue, 'Blue');
title_text = imagefiles(i).name;
title(title_text, 'Fontsize', 6, 'Position', [120,2.7*10^6]);
xlim([0,255]);
ylim([0,2.5*10^6]);
xlabel('Color'); % how to autoformat
ylabel('# of Pixels'); % how to autoformat
end;
if true
% code
end
1 个评论
Image Analyst
2016-7-7
If you still need help, attach your two images so we can visualize what you are talking about.
回答(1 个)
Prasad Mendu
2016-7-7
The MATLAB function "immse" compares two images using the color values (RGB) to calculate the Mean Squared Error (MSE) of two images.
For example it is executed as:
err = immse(X,Y)
Refer to the link below for more information on this:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!