필터 지우기
필터 지우기

To Mark Matched Blue Pixels in 2 Images

조회 수: 1 (최근 30일)
Murat Kocaman
Murat Kocaman 2018년 8월 29일
댓글: Image Analyst 2018년 9월 4일
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
KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 8월 29일
Can you clarify the question again? What is the input, what result are you expecting? Don't provide the confusing data and terms.
Murat Kocaman
Murat Kocaman 2018년 8월 29일
Yes inputs are the first 2 images:
First image:
Second image:
Result expecting:
I would like to mark matched blue pixels at these 2 input images with red marker.
I hope it is clear now.

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2018년 8월 29일
편집: Image Analyst 2018년 8월 29일
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
Murat Kocaman
Murat Kocaman 2018년 9월 4일
Yes I added a mask definition to what you had adviced. I have already tried some other mask definitions but the result was the same.
So should I change that line and find appropriate masking or what?
Image Analyst
Image Analyst 2018년 9월 4일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by