How to crop uneven image (with random black margins/spaces) automatically?

5 views (last 30 days)
I'm making a code to stitch a set of images. When I transform the second image to fit the first using imwarp(), the output pixels outside the input image boundaries show as a consistent black or white color, so I get the stitched image which looks like this. When I have to stitch another image to this new panorama it causes a lot of problems.
Is there any way to crop this black outer portion to the axis I have shown automatically? By automatically I mean can I write a code that'll work for any image with such black outer regions.
imclearborder() just gives me an all black image.
But the answers makes no sense to me.
  2 Comments
Image Analyst
Image Analyst on 9 Jun 2015
Can we always assume that the image on the left will be the smaller one and aligned with the axes?
Sarita8_8
Sarita8_8 on 11 Jun 2015
The image on the right is warped and then stitched, so yes we can assume the one on the left is always aligned. But I don't think it will always be the smaller one...
Thanks!

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!