How to use index information of one image to derive the other image's values at the same index?
1 次查看(过去 30 天)
显示 更早的评论
I have an image from dataset that shows a gesture:
This image is the result after skin color segmentation. Also, I have depth image of the same image:
What I want to do is:
-save coordinate information of all skin-alike colors of the 1st image; (discard only black color)
-save intensity values of the 2nd(depth) image that match the above coordinates and change not-matched coordinates with black.
I think it is a bit difficult for me, as a foreigner, to describe what I mean. I should get a depth image with unchanged intensity values where the coordinates of those unchanged values should be the same with the coordinates of skin-alike color coordinates from the 1st image.
If the question is comprehensive, how can I approach to this? Thank you!
0 个评论
采纳的回答
Dimitris Iliou
2017-4-21
If I understand you question correctly, you want to get the intensity information of the second image, using coordinate values you extracted from the first image.
You should be able to do that, but you need to make sure that both pictures have the same coordinate "system". Specifically, you need to know that point (10,10) for example, is in the same location in both images.
In case you are using different cameras to get the pictures, or because of the different content (color image vs depth), there might be some registration issues (i.e. misalignment). There are some techniques that might allow you to register the two images so the coordinates will be similar. You can find more information on Image registration in the following documentation link:
Keep in mind that the two images are different (not having very similar features) and you might need to spent some time understanding what is the best registration method to use.
Assuming that the pictures are registered, once you have the coordinates from the first image, it is easy to make the rest of the values black for the second image.
Here is an example:
% Read a test image - This represents your second image
A = imread('TestImage.JPG');
% Assume this is the coordinates that you are interested in from the first image
X = 50:400;
Y = 50:200;
% Initialize the new image to zeros
New_image = zeros(size(A));
% Only copy the coordinates that you are interested in
New_image(X,Y,:) = A(X,Y,:);
% Show the image
imshow(uint8(New_image))
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!