fish eye

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
User avatar
leos2009
Posts: 15
Joined: 2015-08-25T07:50:55-07:00
Authentication code: 1151
Location: Ukraine, Kiev
Contact:

fish eye

Post by leos2009 »

Hello world of IM!
I have a new task on enlarging lips on the pic. I'm going to use Fish eye effect, but it is to be done at a certain area of the pic, like in previous forum branch viewtopic.php?f=1&t=28246.
Could you please tell me the algorithm? As earlier I'll send the examples of the result. Thank you in advance!

http://joxi.ru/zAN0YzBukBWgm9 region on face
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: fish eye

Post by fmw42 »

You can try my script, bump, at the link below. It is just like the above effect in the link, but only uses -blur without the motion blur.
User avatar
leos2009
Posts: 15
Joined: 2015-08-25T07:50:55-07:00
Authentication code: 1151
Location: Ukraine, Kiev
Contact:

Re: fish eye

Post by leos2009 »

how to move from the center point(x,y) to the right place for me in your script? can i use semi-circle in your script?)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: fish eye

Post by fmw42 »

No, my script does not allow either. But you have the concept from the earlier code in the link you have above and should be able to do the same kind of thing. You just need to create a mask image where you want the changes, then blur it and composite over a gray image, then use it as a displacement map. Do not do the motion-blur.

EDIT: see above
User avatar
leos2009
Posts: 15
Joined: 2015-08-25T07:50:55-07:00
Authentication code: 1151
Location: Ukraine, Kiev
Contact:

Re: fish eye

Post by leos2009 »

UPD: New video with worked algoritm for fish eye in some region in image https://youtu.be/dSAxAq7J3SY

i croped lips region from orig image and applied you script bump. then converted file pasted on the orig image top
i think that is simplest way to solve the task

Code: Select all

<?php
$xpoz = $_POST['xpoz'];
$ypoz = $_POST['ypoz'];
$radius = $_POST['radius'];
$soften = $_POST['soften'];
$dist = $_POST['dist'];
$lips = $_POST['lips'];
$filename = time().'.png';
$path_file = 'files/'.$filename;
$convert = '/opt/local/bin/convert'; //path to IM for MAC OS (#type -a convert)
$myfile = 'files/lady.jpg';
//...previous code for eye brows up....
exec($convert.' '.$path_file.' -crop 84x45+107+223 files/temp.png'.' && '.
'sh /opt/local/bin/bump -a '.$lips.' -r 30 files/temp.png files/9999.png'. ' && '. 
$convert." -draw 'image Over 107,223 84,45 files/9999.png' ".$path_file." ".$path_file);

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

Re: fish eye

Post by fmw42 »

Nice work.
Post Reply