필터 지우기
필터 지우기

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