[magick-users] Auto alignment of shifted images

Anthony Thyssen anthony at griffith.edu.au
Thu Sep 13 16:56:41 PDT 2007


Claus Cyrny on  wrote...
| Hi Johnson,
| 
| Johnson Lau wrote:
| > Dear All,
| >
| > I have two images.
| > One is a blank questionnaire : http://www.comminn.net/ftp/a.jpg
| > Another one is a completed questionnaire: http://www.comminn.net/ftp/b.jpg
| > I have a program which could help me to enter the data automatically.
| > However, as you can see, b.jpg is slightly shifted and not completely
| > match a.jpg, and the data entry software could not tolerate. Since I
| > have thousands of such questionnaires, and they have different type of
| > slight shifting and rotation, I need a solution which could help me
| > align all images automatically. I would like to know if ImageMagick or
| > any other software could do this? Thanks very much!
| >
| Imho, this  can only be done if /all/ of the images have the /same/
| offset; otherwise one would have to write something that analyzes
| each image and gives out the offset in relation to a reference
| image (like 'a.jpg'). I'm not sure if IM could accomplish this.
| 
Or the image is distorted to FIX the offsets. However that will still
require something to look for 'registration marks' on the page to
align it right.

| My guess is that 'convert -fx' would /maybe/ be able to accomplish
| at least the correction of the offset, but I'm not sure about the proper
| syntax for the options. I tried 'convert b.jpg -fx 'i[-5]' 'j[-30]'
| b_mod.png',
| since 'b.jpg' has an offset of x=5/y=30 px, but this resulted in a syntax
| error. IM didn't recognize the 'i[-5]' part. Does anyone know how to
| invoke IM here properly?
| 
Use -distort on the latest sets of IM.  It is still being finailised and
developed so expect some monor changes. but it is getting there.

Once the image is 'normalized' you can just -crop the various parts of
the image.


  Anthony Thyssen ( System Programmer )    <A.Thyssen at griffith.edu.au>
 -----------------------------------------------------------------------------
    Kite(n):  An offering to the wind gods proffered on a line that
       they find sufficiently attractive to accept when it is dangled
       in front of them.          -- Anne Sloboda, c/o <ecurtis at icis.on.ca>
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/


More information about the Magick-users mailing list