To Mark Matched Blue Pixels in 2 Images
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I would like to mark matched blue pixels in 2 images.
The images are attached. Here, what I want to have is to mark matched points which are blue. (I am not sure if the blue is the correct approach because the colors are not the same)
As a result , I would like to see it as below with the red marks on the matched pixels;
I need to use rgb2hsv convertion but it didn't work.
My current code is:
startingFolder = 'C:\Users\Development\Desktop\dneme';
if ~exist(startingFolder, 'dir')
% If that folder doesn't exist, just start in the current folder.
startingFolder = pwd;
end
defaultFileName = fullfile(startingFolder, '*.jpg');
[baseFileName, folder] = uigetfile(defaultFileName, 'Select a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
original = imread(fullFileName);
startingFolder = 'C:\Users\Development\Desktop\dneme';
if ~exist(startingFolder, 'dir')
% If that folder doesn't exist, just start in the current folder.
startingFolder = pwd;
end
defaultFileName = fullfile(startingFolder, '*.jpg');
[baseFileName, folder] = uigetfile(defaultFileName, 'Select a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName2 = fullfile(folder, baseFileName)
original = imread(fullFileName2);
i1 = imread(fullFileName);
i2 = imread(fullFileName2);
i3 = xor(i1, i2);
imagesc(i3);
d = sum(i3(:)) / numel(i3);
This code seems right way but red points are not at the true positions and i prefer having the result on the input images not black background.
Does anyone have an idea on the subject?
2 comentarios
KALYAN ACHARJYA
el 29 de Ag. de 2018
Can you clarify the question again? What is the input, what result are you expecting? Don't provide the confusing data and terms.
Respuestas (1)
Image Analyst
el 29 de Ag. de 2018
Editada: Image Analyst
el 29 de Ag. de 2018
I'm not sure what you mean by "matched". Like you said, the colors are different. So I guess you'll have to define how close can they be and still be considered "matched". To do that you need to compute the Delta E color difference. For that, use my Delta E program here: https://www.mathworks.com/matlabcentral/fileexchange/31118-color-segmentation-by-delta-e-color-difference
You could also do a pixel-by-pixel delta E. Simply use rgb2lab() on each image, then compute the square root of the sum of the squares of the L, A, and B channels. Then threshold at some value to discriminate between "matched" and "not a close match".
8 comentarios
Image Analyst
el 4 de Sept. de 2018
I suggest you go back to my demo and look at creating a mask from thresholding the delta E image. If you insist on doing the segmentation in RGB color space, then threshold one of the color channels.
Ver también
Categorías
Más información sobre Particle & Nuclear Physics en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!