Help Stitching Photos Together

조회 수: 15 (최근 30일)
Andreas Grothues
Andreas Grothues 2016년 8월 8일
댓글: Ahmed Sewify 2021년 5월 17일
I am trying to stitch 2 photos together using the reference code found here almost verbatim http://www.mathworks.com/help/vision/examples/feature-based-panoramic-image-stitching.html
Some differences:
My photos are already greyscale, so I skip line:
grayImage = rgb2gray(I);
and just have:
grayImage = I;
I have only 2 photos of identical size (in pixels), so I am retaining the transformation of the second image relative to the first image, i.e. totally skipping the code in the example that "invert[s] the transform for the center image and apply[s] that transform to all the others." This means that tforms(1) remains an identity matrix as created by the initializing statement:
tforms(buildingScene.Count) = projective2d(eye(3));
I don't get any errors until almost the last line:
Error using AlphaBlender/step
The Image 1 and Image 2 inputs must have the same number of dimensions.
Error in stitchCntl (line xxx)
panorama = step(blender, panorama, warpedImage, warpedImage(:,:,1));
I have goggled the error message with no hits, and am at a loss as to how to proceed. Any help is greatly appreciated.
Thank you to all!

채택된 답변

Andreas Grothues
Andreas Grothues 2016년 8월 8일
편집: Andreas Grothues 2016년 8월 9일
OK, I have something...
I changed....
% Initialize the "empty" panorama.
panorama = zeros([height width 3], 'like', I)
To...
panorama = zeros([height width], 'like', I)
I now get two stitched-together photos. I think this was because I have grayscale photos, not color photos as in the example.
Unfortunatley, matchFeatures() did a horrible job finding common features and so the splice is terrible, but I guess that is a different story entirely.

추가 답변 (1개)

Congwei Ni
Congwei Ni 2019년 10월 19일
Can i ask how do you stitch two images using this method?
  댓글 수: 2
John D'Errico
John D'Errico 2019년 10월 19일
Please learn to use comments to make a comment.
Ahmed Sewify
Ahmed Sewify 2021년 5월 17일
Have you figured it out, yet? I'm also trying to stitch 2 images together.

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

카테고리

Help CenterFile Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by