0

I have an input image. This image may be rotated or not. But I want to make the image as a non rotated image if there is a rotation.

For this I am planning to use a sample template which is not rotated. My intention is to find the best matching between the input image and this template. And find the angle of rotation of the input image to obtain this best matching. So that using this angle I can re-rotate the input image to original non rotated image.

input image

sample template

Neeraj
  • 1,612
  • 7
  • 29
  • 47
  • 2
    Check if image moments are suitable for your images https://en.wikipedia.org/wiki/Image_moment – MBo Jun 02 '16 at 07:02
  • @MBo Finding Principal axis using moments and do the rotation accordingly? Seems to be a good solution. I will try. Thanks – Neeraj Jun 02 '16 at 07:20
  • Possible duplicate of [how to find orientation of a picture with delphi](http://stackoverflow.com/questions/28403979/how-to-find-orientation-of-a-picture-with-delphi) – Spektre Jun 02 '16 at 08:36
  • @Neeraj : You need to use EXIF data of image. – Sagar Patel Jun 02 '16 at 08:39
  • is the template object always within the image and just might be rotated? Or might there be completely different objects in the image? – Micka Jun 02 '16 at 08:43
  • @Mika The input image will be always a shirt. And there will be only one shirt in input image. And the template image will be always same... what I have given here. – Neeraj Jun 02 '16 at 09:07
  • I would compute the cv::minAreaRect of the contour and rotate to align it to the axis. – Micka Jun 02 '16 at 09:10
  • @Micka I will try that... Thanks – Neeraj Jun 02 '16 at 09:15
  • just tested it, minAreaRect doesnt give expected results for shirts =) afaik internally it uses PCA – Micka Jun 02 '16 at 09:25
  • @Micka Yeah I also tested. Not giving desired output – Neeraj Jun 02 '16 at 09:27
  • Background removal and then skeleton matching. – saurabheights Jun 02 '16 at 12:55
  • a few more images may help to find something robust enough – Miki Jun 02 '16 at 13:56
  • @Miki you can take any shirt or t-shirt image as input. But the template will be same that I shared – Neeraj Jun 02 '16 at 14:05
  • Any luck with moments so far? – Miki Jun 02 '16 at 14:08
  • @Miki The internal stripes affecting the output. I think I need to do this with the outer edges only. Check my output https://drive.google.com/file/d/0B5gL866yrGfPMkV1Q1o1SXVqVWs/view?usp=sharing – Neeraj Jun 02 '16 at 14:34
  • You need to compute the moments on the binary mask (i.e. everything that is not green) – Miki Jun 02 '16 at 14:35
  • @Miki next i tried with this input https://drive.google.com/file/d/0B5gL866yrGfPUzdhdU9VNFYtRVk/view?usp=sharing but the output is https://drive.google.com/file/d/0B5gL866yrGfPWF9fbXFEeHZUcFE/view?usp=sharing – Neeraj Jun 02 '16 at 14:37
  • @Miki Ok. I will try with binary mask. – Neeraj Jun 02 '16 at 14:37

0 Answers0