フィルターのクリア

Compare two images( Gold standard black vs regular black) using RGB?

1 回表示 (過去 30 日間)
Jacob Jakileaszek
Jacob Jakileaszek 2016 年 6 月 27 日
コメント済み: Image Analyst 2016 年 7 月 7 日
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
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
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:

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by