[prev in list] [next in list] [prev in thread] [next in thread] 

List:       imagemagick-user
Subject:    Re: [magick-users] Auto alignment of shifted images
From:       "Johnson Lau" <johnsonlau () cuhk ! edu ! hk>
Date:       2007-09-16 6:54:04
Message-ID: 4c14cb0709152354k76926856we672bce3b35b2b41 () mail ! gmail ! com
[Download RAW message or body]

Dear Anthony,

I'm using 6.3.2.0. Is the  IsImageSimilar() function available in this
version? I have also complied the code but I have no idea of how to
use it. Could you give me more hints on doing it? I don't have any
knowledge on C programming. Thanks a lot!

Regards,

Johnson


2007/9/16, Anthony Thyssen <anthony@griffith.edu.au>:
> Claus Cyrny on  wrote...
> | Anthony Thyssen wrote:
> | > Claus Cyrny on  wrote...
> | >
> | > | 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.
> |
> | Does IM have /any/  capabilities to track patterns in an image? At
> | least at first glance, I couldn't find a command that will do that.
> |
> | Claus
> |
> There was some work done in the MagickCore API  (low level C
> programming).
>
> I will include the C code below.  I have not tried it however, so no
> gurantees.
>
>
> You may also be interested in
>   http://www.catenary.com/howto/deskew.html
> Which talks about an algorithm for rectifying (deskewing) a document.
> It will not however re-align a document which is what you need.
>
>
> If you have complete control of the document scanning process, you can
> gurantee the document is correctly de-skewed, by looking for a specific
> sub-image match is specific areas of the document.
>
> For example a particular logo at the top left, or a boc corner at the
> bottom right.
>
>  Anthony Thyssen ( Graphics Enthusiast )    <A.Thyssen@griffith.edu.au>
>  -----------------------------------------------------------------------------
>    A picture may be worth a thousand words,
>                        but a thousand words use a lot less disk space!
>  -----------------------------------------------------------------------------
>         IM Examples               http://www.imagemagick.org/Usage/
>
> /*
> **
> ** Locate a sub-image within a larger image
> **
> ** We added IsImageSimilar() to ImageMagick 6.2.8-4 Beta if anyone wants to
> ** take a look at the solution to locating coordinates of a sub-image within
> ** another image.  It works in all colorspaces and accounts for image masks.
> ** Below a test program for IsImageSimilar().  Compile with:
> **
> ** Cristy <koyaanisqatsi@imagemagick.org>
> **
> **   cc `Magick-config --cflags --cppflags` -o image_similar image_similar.c \
> **     `Magick-config --ldflags --libs`
> */
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #include <time.h>
> #include <magick/MagickCore.h>
>
> int main(int argc,char **argv)
> {
>  ExceptionInfo
>    *exception;
>
>  Image
>    *crop_image,
>    *image;
>
>  ImageInfo
>    *image_info;
>
>  long
>    x,
>    y;
>
>  RectangleInfo
>    region;
>
>  if (argc != 2)
>    {
>      (void) fprintf(stdout,"Usage: %s image image\n",argv[0]);
>      exit(0);
>    }
>  InitializeMagick(*argv);
>  exception=AcquireExceptionInfo();
>  image_info=CloneImageInfo((ImageInfo *) NULL);
>  (void) strcpy(image_info->filename,argv[1]);
>  image=ReadImage(image_info,exception);
>  if (exception->severity != UndefinedException)
>    CatchException(exception);
>  if (image == (Image *) NULL)
>    exit(1);
>  region.width=100;
>  region.height=100;
>  region.x=100;
>  region.y=100;
>  crop_image=CropImage(image,&region,exception);
>  x=0;
>  y=0;
>  IsImageSimilar(image,crop_image,&x,&y,exception);
>  printf("%ld %ld\n",x,y);
>  image=DestroyImageList(image);
>  image_info=DestroyImageInfo(image_info);
>  exception=DestroyExceptionInfo(exception);
>  DestroyMagick();
>  return(0);
> }
>
>
> _______________________________________________
> Magick-users mailing list
> Magick-users@imagemagick.org
> http://studio.imagemagick.org/mailman/listinfo/magick-users
>
>


-- 
Johnson Lau
Research Assistant
School of Public Health
The Chinese University of Hong Kong
Tel: (852) 2252 8705
Fax: (852) 2145 8517
_______________________________________________
Magick-users mailing list
Magick-users@imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic