Page 1 of 1

Animation, but not floating point?

Posted: 2010-01-23T23:04:54-07:00
by snibgo
I'm using 6.5.8-Q16 on Windows 7, seeing how suitable IM might be for generating frames for a movie from photographs using pan/zoom/etc.

A typical command pastes part of an image to a background:
composite -compose Copy -geometry +22.53+10.673 ( srcB.jpg -resize "54.9399%" ) iv_bgnd.png iv_srcB.png

iv_srcB.png is then blended with other images to make a frame. Frames are assembled with ffmpeg.

The geometry and resize numbers are calculated by software, and change smoothly between frames.

But composite seems to read the geometry offsets as integers, not floating point. So a point on a photo won't move smoothly, but jerks with the quantisation.

Is this a problem in the API, or just the command lines? Are there plans to fix this? Or have I got something wrong?

Re: Animation, but not floating point?

Posted: 2010-01-24T17:43:08-07:00
by snibgo
To answer my own question: I have now looked at the APIs and source code. It seems that pixels are addressed by "unsigned long". This also applies to resizing, so zooming in will also result in quantisation jerks.

Of course, IM is geared towards the production of individual images, rather than frames for a movie. Changing it for floating point adressing of pixels wouldn't be trivial, especially without changing the APIs. The developers may wish to consider this for IM's long-term development.

I may redirect my efforts to generating frames in ActionScript, which does have floating point adressing (but has other problems, of course).

Re: Animation, but not floating point?

Posted: 2010-06-06T21:01:17-07:00
by anthony
Just to clarify and complete this old topic (made while I was away in china.

Many things in image processing is restricted to integers (or longs) Sometimes signed, sometimes unsigned.

Image size for example must be unsigned integers. You can not have half pixel images!
Similarly image page offsets, geometry etc much be in whole pixels, though the position can be negative.

however that does not mean you can not 'translate' an image to a faractional offset! this however requires you to distort the image so that the image becomes re-interpolated (or filtered) to allign it to a grid at the new position.

See Im examples, Affine Distorts
http://www.imagemagick.org/Usage/distorts/#affine
also Affine translations....
http://www.imagemagick.org/Usage/distor ... fine_trans

Resizing also limits itself to whole integers. Though again you can distort an image to fractional sizes. See Resize using distort
http://www.imagemagick.org/Usage/resize/#distort

Re: Animation, but not floating point?

Posted: 2010-06-07T04:39:26-07:00
by snibgo
Yes, I should have put a closing statement here.

I use "-distort SRT" to generate frames for totally smooth panning and zooming to non-integer pixel boundaries. "-distort perspective" also works well.