Distortion
Re: Distortion
Great. what does distort:viewport=800x800-300-300 and -trim and +repeat do?!
Thanks.
Thanks.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Distortion
"+repage", not "+repeat". See http://www.imagemagick.org/script/comma ... ptions.php
snibgo's IM pages: im.snibgo.com
Re: Distortion
my image size is 3264 x 2448 what values should I use for distort:viewport?
Thanks.
Thanks.
Re: Distortion
so that only works with square images. Right?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Distortion
Snibgo's example shows that the distortion has poles (zeros) and goes out of bounds. This is typical of a polynomial expression with negative values. I suspect the distortion works best when the image is kept small enough to avoid going beyond the first pole (zero). That is probably why the image size is typically left unchanged. There is probably no (easy) way to predict where your input bounds would be in the output space. All you can probably do easily is trial and error changing the viewport size until you get what you want.
The viewport dimensions tell you how big to make the output and what offset you need to expand the area. If your input is say 600x600 and you want an output centered that is 800x800, you need a negative Xoffset and Yoffset of half the difference. So 800x800-100-100.
The viewport dimensions tell you how big to make the output and what offset you need to expand the area. If your input is say 600x600 and you want an output centered that is 800x800, you need a negative Xoffset and Yoffset of half the difference. So 800x800-100-100.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Distortion
Images do not have to be square for distort barrel. And you can provide separate arguments for x and for y. See the arguments at http://www.imagemagick.org/Usage/distorts/#barrel
Re: Distortion
IT WORKED. THANK YOU FMW42 AND SNIBGO.
Last edited by alireza on 2016-10-12T08:28:04-07:00, edited 1 time in total.
Re: Distortion
So I guess the way it works is:
my original image is 3264x2448.
by -define distort:viewport=3464x2648-100-100 we define a virtual background that has a border 100 pixel around my original image then we apply distort barrel "0.0301 -.0733 0" and this will only apply to the original image not the one with extended border and then -trim will trim the virtual background to the pixels of undistorted image and +repage dont know wxavctly what it does but it's working,,
I overlayed my undistorted image using this method to the undistorted image (created without using -define distort:viewport:...) and they match.
awesome..
my original image is 3264x2448.
by -define distort:viewport=3464x2648-100-100 we define a virtual background that has a border 100 pixel around my original image then we apply distort barrel "0.0301 -.0733 0" and this will only apply to the original image not the one with extended border and then -trim will trim the virtual background to the pixels of undistorted image and +repage dont know wxavctly what it does but it's working,,
I overlayed my undistorted image using this method to the undistorted image (created without using -define distort:viewport:...) and they match.
awesome..
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Distortion
Actually it is filling the expanded output via the viewport with pixels from the input. Most IM transformations are reverse. They sequence through the output and find a corresponding location in the input from the transformation and then put that pixel color from the input at the location in the output.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Distortion
See http://www.imagemagick.org/Usage/distorts/#mapping for the concept of reverse mapping.
Re: Distortion
Hello.
I wish to calculate the barrel Distortion of a camara c920
https://therandomlab.blogspot.com.ar/20 ... -view.html
I wish to calculate the barrel Distortion of a camara c920
https://therandomlab.blogspot.com.ar/20 ... -view.html
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Distortion
IM contains no tools to automatically calculate barrel distortion of a lens.
The Hugin toolset does.
The Hugin toolset does.
snibgo's IM pages: im.snibgo.com