Object extraction from stripes image

I have two images. one with stripes and another object with stripes. I would like to extract the object from these two images. These two are uint8 images. Also I want to find the depth of the object by showing images in the surf plot.
Could you give some hint?
I have used imsubtract but it won't give the desire results.
Pprs3 = imread('P1000571-min.JPG'); % Colour Image
Pprs1 = rgb2gray(Pprs3); % Grayscale Image
x = 0:size(Pprs1,2)-1;
y = 0:size(Pprs1,1)-1;
[X,Y] = meshgrid(x,y); % Coordinate Matrices (Not Necessary)
figure(1)
meshc(X, Y, Pprs1) % Mesh Plot
grid on
xlabel('X')
ylabel('Y')
zlabel('Intensity')
colormap(jet)
hold on
a = imread('P1000578-min.JPG'); % Colour Image
b = rgb2gray(a); % Grayscale Image
x = 0:size(b,2)-1;
y = 0:size(b,1)-1;
[X,Y] = meshgrid(x,y); % Coordinate Matrices (Not Necessary)
figure(2)
meshc(X, Y, b) % Mesh Plot
grid on
xlabel('X')
ylabel('Y')
zlabel('Intensity')
colormap(jet)
hold on
c = imsubtract(Pprs1,b);
x = 0:size(c,2)-1;
y = 0:size(c,1)-1;
[X,Y] = meshgrid(x,y); % Coordinate Matrices (Not Necessary)
figure(3)
meshc(X, Y, c) % Mesh Plot
grid on
xlabel('X')
ylabel('Y')
zlabel('Intensity')
colormap(jet)
In the attachment, images are given.

14 件のコメント

KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 5 月 23 日
編集済み: KALYAN ACHARJYA 2021 年 5 月 30 日
Initially forcus on ROI segmentation, surf in just one line code. As both images are not exactly co-alligned images, hence image subtraction may not be work.
Catalytic
Catalytic 2021 年 5 月 23 日
@Ayush singhal We'd rather not have to go digging into an attached .zip file to find your images. Why not insert them into your post so that we can understand the problem right away?
Ayush singhal
Ayush singhal 2021 年 5 月 23 日
Could you tell about How to do ROI segmentation. And If images are not co-alligned then is it possible to extract the object depth or not?
Ayush singhal
Ayush singhal 2021 年 5 月 23 日
Catalytic
Catalytic 2021 年 5 月 23 日
It looks like the camera is in different positions for each of the images. Couldn't you just make life easier on yourself and retake the images with the camera fixed?
Ayush singhal
Ayush singhal 2021 年 5 月 23 日
Yes, I can do that again.
  • Before that could you tell me what'd be the next procedure after having these 2 images? I mean then how to do it? Like what step are you following? I have another images also. So may be i can try with them.I have attached another images.
Matt J
Matt J 2021 年 5 月 23 日
編集済み: Matt J 2021 年 5 月 23 日
I can't see @Catalytic's complete idea, but imsubtract should certainly work much better if the camera perspectives are the same.
Clearly also, the fact that stripe pattern on the hand is shifted relative to the background is supposed to provide some information about the depth.
Ayush singhal
Ayush singhal 2021 年 5 月 23 日
yes. I would like to extract that information. But after using imsubtract the final image also consist some stripes. Not giving complete the object. And is there any other algorithm to extract the depth.
Matt J
Matt J 2021 年 5 月 23 日
What 3D metric information do you have? Can you know the width of the stripes on the screen and the distance from the screen to the grate?
Ayush singhal
Ayush singhal 2021 年 5 月 23 日
Yes. I have this information.
screenWidth = 400
screenHeight =500
stripeWidth = 10; % Pixels
oneCycle = repelem([0,1], stripeWidth);
% Make vertical stripes.
numStripes = floor(screenWidth / ( 2*stripeWidth))
multipleCycles = uint8(255 * repmat(oneCycle, [500, numStripes]));
cmap = [1 1 1; 0 0 0];
S= imrotate(multipleCycles,-30);
G = imshow(S, [], 'ColorMap', cmap)
axis on
I have used this to generate the stripes and by this number of stripes is 20. During taking these images, I zoom in the stripes image.
And the distance between object and projector was 115 cm. camera was also placed around the same position.
The attached pattern was focused by the projector.
Ayush singhal
Ayush singhal 2021 年 5 月 25 日
Hello, as per your suggestion, I captured images again with keeping camera constat.
I have attached images.
Now If I am using imsubtract function, I am getting almost desirable answer. But I like to extract the pixels of hands from the final image. So that I can reconstruct the hand as an object again.
Is it possible to extract the particualr part from a images by their pixels or a masking design.
Ayush singhal
Ayush singhal 2021 年 5 月 30 日
Is there any lead for this?
Thanks.
KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 5 月 30 日
In my spare time, I will try on new uploaded images
Ayush singhal
Ayush singhal 2021 年 5 月 31 日
okah Thanks.
If it is possible for you, can you try it before 15th june? After then I have to submit this task. So it'd be better.
Thanks.

サインインしてコメントする。

回答 (0 件)

質問済み:

2021 年 5 月 23 日

コメント済み:

2021 年 5 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by