On Fri, 7 Nov 2008 16:17:15 -0500
"Mike Bruno" <[EMAIL PROTECTED]> wrote:

| Greetings.
|
| I have a program that incorporates ImageMagick to do a perspective
| transformation on a single image.  I give it the requisite coordinates
| and it works extraordinarily well.
|
| Now, I need to move to the next level.  I have a series of images,
| let's call it a movie, on which I would like to do a perspective
| transformation of each frame.  The coordinates will be the same for
| each frame as the camera and the reference points are fixed.  As it
| takes some time to compute the transformation matrix, I was wondering
| if there was a built-in way to calculate the matrix on the first
| frame, then retain the matrix and use it on each successive frame to
| improve efficiency.
|
| I see from the documentation
| (http://www.imagemagick.org/script/command-line-options.php#distort)
| that I can use the -verbose setting to get the internal coefficients
| and an -fx equivalent.  However, I am not sure this -fx equivalent
| would actually save on computation time.
|
| Could anyone enlighten me as to the most efficient way of doing this
| identical perspective transformation on a series of images?  Is
| calculating the transformation matrix even a significant amount of
| time?
|
| Thank you very much, Mike
|
The -verbose setting will give you the PerspectiveProjection coefficents
that should be equivelent to the distortion just done.

The -fx equivelent is the reverse coordinate mapping that is actually
applied as a check on what is going on internally, and as a debuggng
tool.  It would however very VERY VERY VERY slow.

You can either use the same distort control points for each frame, as
compared to the actual distortion process this is quite fast, OR use the
Projection coefficents.  Though the if only four points are used he
amount of calculation IM does is small compared to the calculations
needed for the actual distortion, so the savings would not be great.

See the updates to the IM Examples page on the Perspective Projection
for info on what the coefficents actually mean mathematically.

Howeever did you know you can have IM read in multiple frames, number
depending on the amount of memory in your computer, and have it distort
ALL those frames in one go?

EG:
  convert frame_1034?.png ... \
          -distort .... \
          -scene 10340 new_frame_%05d.png

will distort the ten frames from 10340 to 10349.

If you have a good amount of memory you can increate the number of
frames per command.    I beleieve you can even do this with "mogrify"
but I can't be certain how well it will work as I have never done this.

Please let us know, how you go.

PS: you can also change the distortion slightly from frame to frame.
For example make a 'scene change' that looks like the screen is being
'flipped' over!



--
  Anthony Thyssen ( System Programmer )    <[EMAIL PROTECTED]>
 -----------------------------------------------------------------------------
  Did you ever have the feeling that the world was an AC coffee pot
  and you were DC?                -- Dean Alan Foster, `` Glory Lane ''
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to