Shape morphing

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Shape morphing

Post by dognose »

Image

I think it'd be neat to be able to do this w/ im. Are there any free programs that can do this?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Shape morphing

Post by anthony »

prehaps if you describe or example what you mean by "shape morphing" I can think of at least three things it could refer to!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Re: Shape morphing

Post by dognose »

Sorry, could you not see my example image?

I want to morph one thing into another. Something beyond the "dissolving" method used now.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Shape morphing

Post by fmw42 »

I don't think that IM can do that now. But it would be interesting to know how you generated your example or where you got it. I think what is being asked is what the technique was that was used. Control points were picked? How were they interpolated? etc.


There are other programs out there is you just search the Internet. For example, see the External Links on http://en.wikipedia.org/wiki/Morphing
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Shape morphing

Post by anthony »

Sorry no I did not see your example then, I can now. (UPDATE: example is now pointing to a 'contact webmaster' page)

What you are showing is true 'morphing' Specifically both spatial and color morphing.
What IM currently provides is purely a color or 'dissolved' morph.

HOWEVER. the new additions added for image distortions are working toward the ability to do proper spatial morphing as your example shows, as well as what you see in movies. But it still has a ways to go before it will reach that complexity.

Even if it does achieve this ability, you would still need to define 'register' lots of points which are to correspond to similar points in the final image.

In the mean time have a look on the net for Xmorph which is a free public domain package that is designed to specifically do this type of effect.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Shape morphing

Post by fmw42 »

I have been working on a UNIX bash script using IM to do something like this using one control point (nose to nose) and the four fixed corners of the image. I borrowed your images for a test. Here is the result of my first cut at the script, not yet finalized with 20 frames including the two originals plus additional 18 frame reversal for a total of 38 frames. It took about 6min on my Mac mini 1.42GHz PPC.

Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Shape morphing

Post by fmw42 »

I just uploaded my script, shapemorph, to my web site. If anyone is interested, it can be downloaded at
http://www.fmwconcepts.com/imagemagick/index.html

Note that the script if very slow due to the extensive use of -fx.
goldskif
Posts: 22
Joined: 2012-02-19T03:51:30-07:00
Authentication code: 8675308

Re: Shape morphing

Post by goldskif »

Excellent script!!
Tell fmw42, and they can keep the images in the form of individual images, without merging?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Shape morphing

Post by fmw42 »

goldskif wrote:Excellent script!!
Tell fmw42, and they can keep the images in the form of individual images, without merging?

Thanks about the script. But what do you mean by "they can keep the images in the form of individual images, without merging"? In what context is your comment?
goldskif
Posts: 22
Joined: 2012-02-19T03:51:30-07:00
Authentication code: 8675308

Re: Shape morphing

Post by goldskif »

Sorry, wrong translation (((.
It is desirable to save as a separate figure 0.png, 1 png, 2 png, ..... (or jpg, tiff....)
And have a custom -blend

Then this script is perfect as a commercial for photographers 3D
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Shape morphing

Post by fmw42 »

goldskif wrote:Sorry, wrong translation (((.
It is desirable to save as a separate figure 0.png, 1 png, 2 png, ..... (or jpg, tiff....)
And have a custom -blend

Then this script is perfect as a commercial for photographers 3D

You can always separate the animated output into individual images

convert animation.gif +adjoin figure_%d.tiff

PNG and JPG do not require +adjoin as they do not allow multi-frame images as do gif and tiff

What do you mean by custom blend? Each frame is a weighted blend of the two input images. The weight of each image is determined by what the frame number is. That is in addition to the shape distortion (inverse distance weighted -- Shepard's method). So it is morphing both shape and color between the two images.

At some point in the future, I might try to extend the morphing to allow multiple points. But that would be better done when IM gets some kind of triangular mesh interpolation. Right now the interpolation is done using Shepard's inverse distance weighted averaging.
goldskif
Posts: 22
Joined: 2012-02-19T03:51:30-07:00
Authentication code: 8675308

Re: Shape morphing

Post by goldskif »

I need two photos to make a 10 and keep everything as jpg, png ..
Then cut them into strips.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Shape morphing

Post by fmw42 »

goldskif wrote:I need two photos to make a 10 and keep everything as jpg, png ..
Then cut them into strips.
Sorry, I don't understand. Are you asking for a morph from two images to generate 10 frames and then interleave them to the lenticular format. If so, just process the morph image and process into the lenticular image using -sample and my interleave script as described in viewtopic.php?f=1&t=20357&start=15#p81197
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Shape morphing

Post by fmw42 »

I just uploaded a new shapemorph2 script that allows any number of control points. see link below.
Post Reply