throbber
Distorting -- IM v6 Examples
`4/11/22, 10:56 PM
`The Wayback Machine - https://web.archive.org/web/20120329131929/http://www.imagemagick.org:80/Usage/dist…
`
`ImageMagick v6 Examples --
`
` Distorting Images
`
`Index
`
` ImageMagick Examples Preface and Index
` General Distortion Techniques
`
`Forward or Direct Pixel Mapping
`Reversed Pixel Mapping
`Interpolated Pixel Lookup
`Super-Sampling, Improved Results
`Area Resampling, the next step
`
`
`
`
`
`
`
`
`
` Affine Matrix Transforms (separate sub-directory)
`
` Generalized Distortion Operator
`
`Distort Options, Controls, and Settings
`Best Fit (+distort) Option
`Image Filters and Color Determination
`
`Virtual Pixels and Tiling
`Missed and Invalid Pixels
`EWA Resampling and Filters
`Interpolated Color Lookup
`
`Verbose Distortion Summary
`Viewport, Where Distort Looks
`
`Centered Square Crop
`
`Output Scaling, and Super-Sampling
`
` Introduction to Distortion Methods
`
`SRT Distortion (scale,rotate,translate)
`
`Methods of Rotating Images
`Distortions Using Control Points
`Image Coordinates vs Pixel Coordinates
`Control Points using Percent Escapes
`Control Point Least Squares Fit
`Control Point Files
`
` Affine (Three Point) Distortion Methods
`
`Affine Distortion
`Affine Projection Distortion
`Affine Distortion Examples
`
`Affine Tiling
`3D Cubes, using Affine Layering
`3D Shadows, using Affine Shears
`3D Shadows, using Perspective
`
`Resize Distortion
`
` Four Point Distortion Methods
`
`Perspective Distortion
`
`Viewing Distant Horizons
`3D Boxes, using Perspective Layering
`
`Perspective Projection Distortion
`Perspective Internals
`Bilinear Distortion Metjods
`
`BilinearForward
`BilinearReverse
`Bilinear Tiling
`Bilinear Internals
`
` Polynomial Distortion
` Circular and Radial Distortion Methods
`
`Arc Distortion (images in circular arcs)
`
`Arc into Full Circle Rings
`Arc Distortion Examples
`Arc, Center Point Placement
`Polar Distortion (full circle distort)
`DePolar Distortion (polar to cartesian)
`Depolar-Polar Cycle Technique
`
`Depolar-Polar Problem
`Polar Rotation
`Rotational Blur
`Radial Streaks
`Barrel Distortion (lens correction)
`BarrelInverse Distortion (alternative barrel)
`
`https://web.archive.org/web/20120329131929/http://www.imagemagick.org/Usage/distorts/
`
`1/62
`
`Lightricks Ltd., EX1005, Page 1 of 62
`
`

`

`4/11/22, 10:56 PM
`
`Distorting -- IM v6 Examples
` Projective Distortions
`
`Cylinder 2 Plane
`Plane 2 Cylinder
`
` Multi-Point and Freeform Distorts
`
`Shepards Distortion (taffy pulling!)
`
`Shepards and Image Rotations
`Shepards Summary
`
`Having looked at the simple set of built-in image wrapping and distortion operators IM has provided since its early
`days, here we go deeper and look at the internal mechanics and more complex mathematical distortions of images.
`
`From this deeper understanding, we then looks at a more generalize image distortion operator. This includes
`distortions, from complex rotations, scaling and shearing, to perspective or 3D distortions, to warping to and from
`circular arcs, camera lens distortions, and finally to more general morph-like distortions.
`
`General Distortion Techniques
`
`Now that we have been introduce to the simple distortion operators that IM provides, lets take a step back and look at
`the nitty-gritty, and see how image distortions actually work, and how you can improve the way you use them.
`
`Later we'll go forward to much more complex ways of distortion images, including methods that are not directly built
`into ImageMagick.
`
`There are only a few basic ways an image processor can distort images.
`
`The Simple Distortion operators for example are achieved by Pixel Swapping. That is, individual pixels or even
`whole rows and columns of pixels are just swapped around to Flip, Roll, Transpose and even Rectangular Rotates of
`images. No color changes are made, and the number of pixels remains the same.
`
`The next method of distorting images is by Shifting or Shearing the columns and rows of pixels either horizontally
`or vertically, such as what IM does with Image Shearing and the Wave Distortion above. The shears in turn providing
`one method to Rotate Images by any given angle, in a manner that should be quite fast.
`
`However pixel shifting methods are limited to those basic distortions. It can not scale an image to a different size for
`example. You also have very little control over the handling of areas in the resulting image that was not covered by
`the original source image. In the above mentioned functions IM just sets the missing areas to the current background
`color.
`
`To be able to distort images in a much more general way you need to use a more general distortion technique known
`as Reverse Pixel Mapping. For example this method is used by the more complex Circular Distortions such as
`Imploding and Swirling images.
`Forward or Direct Pixel Mapping
`
`The first thing people think of when attempting to distort an image is to just take each pixel in the source image and
`move it directly to its new location in the destination image.
`
`In fact this is sort of what actually happens for Simple Distorts, Image Cropping and even for distorting Vector
`Images. Each pixel (or coordinate) is is just moved to its new position in the final image.
`
`https://web.archive.org/web/20120329131929/http://www.imagemagick.org/Usage/distorts/
`
`2/62
`
`Page 2 of 62
`
`

`

`Distorting -- IM v6 Examples
`4/11/22, 10:56 PM
`Unfortunately this has problems when you try to do this for anything but a simple distortion. For example here I take
`a Enumerated Pixel list of a small image, and just change the location of each pixel, so as to rotate it to its new
`location.
`
` # Rotate by 17 degrees -- get the Sine and Cosine of this angle
` sin=`convert xc: -format "%[fx:sin( 17 *pi/180)]" info:`
` cos=`convert xc: -format "%[fx:cos( 17 *pi/180)]" info:`
`
` # For each Pixel, rotate that pixels coordinates
` convert koala.gif txt:- | sed '2,$ s/,/:/' |\
` gawk -F: 'NR == 1 { print }
` NR > 1 { x = $1-32; y = $2-32;
` nx = int( c*x - s*y + 32 );
` ny = int( s*x + c*y + 32 );
` printf( "%d,%d: %s\n", nx, ny, $3 );
` }' s=$sin c=$cos - |\
` convert -background black txt:- koala_rotated_direct.gif
`
`The distortion is a simple rotation of just 17 degrees, but the results are not very nice at all.
`
`First of all each new pixel location is a floating point value, but pixels can only exist in an integer grid, so the above
`simply junks the non-integer fraction of the results.
`
`The second problem is that the result is full of holes where no pixel landed. In fact for every hole in the image, you
`will probably also find two pixels landed on the same coordinate. That is you have a third problem of overlapping
`pixels, which pixel value should you use?
`
`In other words the resulting image is incomplete, where each pixel in the destination could have multiple results or no
`results at all. This is a serious problem, and one that can not be easily solved when forward mapping pixels from the
`source image directly to the destination image.
`
`That is not to say that it can not work, and many research papers using a technique known as 'splatting'. Basically
`they take each input pixel, transform its location, and then draw it with appropriate spreading and mixing of pixel
`colors in the new location. This technique is especially useful when dealing with 3-D digitization, of real world
`objects where none of the point locations have structure to them. That is the input is just a 'cloud' of individual points
`on a 3-D surface. Splatting however is beyond IM's scope of handling 2-D raster images.
`
`Reverse Pixel Mapping
`
`Rather than trying to map pixels into the final image, you can map the coordinate of each pixel in the destination
`image to the corresponding location in the source image, and from the source image lookup the color that pixel
`should contain. This is known as a Reverse Pixel Mapping and is what just about every image distortion program
`does.
`
`As each and every destination image pixel is processed, we can be sure that every pixel in the destination gets one
`and only one color. So as long as we can figure out the 'source' location for each destination pixel, we can distort a
`source image to the destination image using any mathematical formula you can imagine.
`
`In Summary, a distortion mapping (reverse mapping) does the following.
`For each pixel (I,J) in the destination or output image
`
`https://web.archive.org/web/20120329131929/http://www.imagemagick.org/Usage/distorts/
`
`3/62
`
`Page 3 of 62
`
`

`

`4/11/22, 10:56 PM
`
`Distorting -- IM v6 Examples
` Map the I,J pixel position to a X,Y pixel position in the original image
` Look up the Color of the original image at position X,Y
` Using color interpolation, work out the appropriate color.
` Or the virtual-pixel setting, if it misses the actual source image.
` Set the destination images color for pixel I,J
`
`Note that I used the variable names 'I,J' and 'X,Y' in the above as these variables map into the variables name that you
`would typically use in the FX DIY Operator.
`
`For example here I simulate the same 17 degree rotation I attempted before, but this time use the "-fx" operator to
`look up the nearest pixel to that location in the source image.
`
` # Rotate by 17 degrees -- get the Sine and Cosine of this angle
` sin=`convert xc: -format "%[fx:sin( 17 *pi/180)]" info:`
` cos=`convert xc: -format "%[fx:cos( 17 *pi/180)]" info:`
` cx=37; cy=37; # center of rotation
`
` convert -size 75x75 xc: koala.gif \
` -virtual-pixel Black -interpolate NearestNeighbor \
` -fx "ii = i - $cx; jj = j - $cy;
` xx = $cos*ii +$sin*jj + $cx;
` yy = -$sin*ii +$cos*jj + $cy;
` v.p{xx,yy}" \
` koala_rotated_fx.gif
`
`You can get more detail about the above DIY example in the sub-section on DIY Affine Distortion Mapping.
`
`As you can see we no longer have 'holes' in our image as a color is looked up for each and every pixel in the
`destination. It still does not look very good, but that is a matter of adjusting exactly what color should be placed into
`each pixel.
`
`That is Reverse Pixel Mapping does not generate either holes, or overlapping pixels. Each pixel has a properly
`defined color producing a complete image.
`
`The distinction between forward and reverse mapping is important as most mathematical transformations are defined
`as forward mappings, mapping a single source (X,Y) position to a destination (I,J) position. And indeed a 'forward
`mapping' works well for vector graphics, and drawing lines where you can just map the ends of the line and draw it.
`This is especially true for any linear transformation, such as rotations, where lines remain straight. It is in fact what is
`done for all vector based languages such as such as postscript and SVG.
`
`But for a general raster image, you must use a 'reverse mapping' to distort the image, so that you can be certain that
`you 'fill in' all the pixels of the destination image.
`
`For example if you look the mathematics that was used to map the coordinates in the above two cases, you will find
`they look almost exactly the same. The reverse mapping of a 'rotate' is another 'rotate', just in the opposite direction. If
`you look closely you will see that the 'sin' constant is negated to the forward mapped version, and that is enough to
`reverse the direction of rotation. This detail is important and critical.
`
`The problem is not all forward mapping transforms, work well as a reversed transform. Some forward mappings in
`fact have no simple direct solutions.
`
`On the other hand some image transformations work very well when directly used as a reverse mapping, where they
`would fail badly if used on forward mapped vector images.
`
`As an FYI here is the faster equivalent to the above using a General Distortion, SRT method that does the same
`rotation of the image.
`
`https://web.archive.org/web/20120329131929/http://www.imagemagick.org/Usage/distorts/
`
`4/62
`
`Page 4 of 62
`
`

`

`Distorting -- IM v6 Examples
`4/11/22, 10:56 PM
`Again the color lookup is restricted to just the color of the closest pixel to the mapped position by using 'point'
`interpolation. This means that no new colors are added to the image (other than when we 'missed' the source image),
`but you also get severe aliasing effects.
`
` convert koala.gif -virtual-pixel Black -interpolate NearestNeighbor \
` -filter point -distort SRT 17 koala_rotated_srt.gif
`
`For an alternative discussion of distortion transforms, see Leptonica, Affine Implementation and specifically its discussion
`of 'point-wise' method. The other method, 'sequential', is essentially how IM implements its Rotate and Shear distortion
`operators.
`
`What's in a name?
`
`During my study I found that there is no real clear naming of this image processing method. The actual algorithmic
`process is known a 'Reverse Pixel Mapping', while the use of mathematical equations is known as a 'Geometric
`Transformation'. If the distortion is controlled by the movement of various control points, it often known a 'Image
`Warping' or 'Rubber Sheeting'. The process of defining specific points, usually to find equivalent points between two
`or more images is known as 'Image Registration'.
`
`Images can also be subdivided into smaller simpler units which are individually distorted using a technique called
`'Gridding' (quadrilaterals) and 'Triangular Meshing' (triangles). By using small incremental distortions with blending
`of colors from two images you can generate animated 'Image Morphs' such as you see in movies and music videos.
`
`In the 3d modeling, and in 3d computer games, the same techniques are also used to give some type of colored pattern
`to flat and curved surfaces in a method known as 'Texture Mapping'. This can involve sub-dividing images into grids
`and meshes that approach a single pixel. Then you have viewing of a object that is defined in terms of millions of
`single points using a technique called 'Point Splatting', though that is typically applied using a forward mapping
`distortion.
`
`All the above are very closely related, and most basically involve the look up of a pixels color based on mapping a
`final destination coordinate, to the source image (or object). In other words mapping destination to Source. What term
`should be used... Take your pick.
`
`Pixel Color Lookup
`
`There are still a few problems with the above Reverse Pixel Mapping technique. First of all is that when mapping a
`pixel from a fixed integer position in the destination, you can end up with a non-integer position in the source image.
`That is a location that falls somewhere between the individual pixels on the source image. To determine what color
`should be returned a process called Interpolation is used to determine the final color for that real position by mixing
`the colors of the surrounding pixels.
`
`The Interpolation setting will also handle the case when a part of a distorted image becomes 'stretched out' so that a
`single source pixel becomes smeared over a large area of the destination image. However the opposite is not handled
`very well by a simple interpolation method. And that requires other techniques which we will look at below.
`
`For example here we again rotate our koala, but this time use a "-interpolate Mesh" setting to mix the four nearby
`pixels so as to produce a better, more correct, color from the lookup.
`
` convert koala.gif -virtual-pixel Black -interpolate Mesh \
` -filter point -distort SRT 17 koala_rotated_mesh.gif
`
`As you can see but using a simple merger of neighboring colors surrounding the lookup point, you can greatly
`improve the look of the distorted image.
`
`Their are other problems involved...
`
`https://web.archive.org/web/20120329131929/http://www.imagemagick.org/Usage/distorts/
`
`5/62
`
`Page 5 of 62
`
`

`

`Distorting -- IM v6 Examples
`4/11/22, 10:56 PM
`For example what do you do when the mapped position 'misses' the source image completely. In this case, what color
`should be returned is determined by the Virtual Pixel setting. This setting will pick a color, such as the nearest edge of
`the source image, pretend the source image is infinitely tiled (or mirror tiled) across the plain, or use some specific
`color such as 'white', 'black', or 'transparent' or the user defined background color.
`
`There is also the possibility that there is no mathematically valid coordinate for a specific destination position being
`mapped. For example the pixel looks into the 'sky' of a perspective 'plane' (See Viewing Distant Horizons), and thus
`does not even see the 'plane' in which the source image lies.
`
`In this case a Virtual Pixel is useless as it does 'hit' the source image plane in a N-dimensional space. That is the
`destination pixel is completely invalid! In this case IM uses the current "-matte" setting for the pixel color. If it is a
`'near-miss' IM will anti-alias this invalide color with a neighbouring colors of the image plane.
`
`Super Sampling
`
`Interpolation works well for simple image distortions. But if part of the source image gets compressed into a much
`smaller area, each destination pixel could actually require a merging of a much larger area of the source image.
`Remember pixels are not really points, but represent a rectangular area of a real image.
`
`This means in some cases we really should be trying to compress a large area of the source image into a single
`destination pixel. When this happens a simple Pixel Lookup will fail, as it only looks up the color at a single 'point' in
`the source image (using the surrounding pixel neighbourhood), and does not merge and combine all the colors of the
`input image that may have to be compressed into that single pixel.
`
`The result of this is that a destination pixel could end up with an essentially random color from the source image,
`rather than an average of all the colors involved. The results are seemingly random, isolated pixels, Moire effects, and
`'stair-casing' along the edges of sharp color changes. Thin lines also start to look more like dotted lines (see examples
`for the Sample Operator), or could disappear entirely. All these effects are known collectively as Aliasing Artifacts
`(see image resizing).
`
`One solution to this to lookup more color readings from the source image, for each and every pixel in the destination,
`so as to try and determine a more correct color for each pixel in the destination image. The simplest technique to do
`this is generally know as super-sampling, or over-sampling. See the Wikipedia Entry on Super-Sampling.
`
`By taking more samples from the source image for each destination pixel, the final color of the individual pixel will
`become a more accurate representation of distorted image at that point. The more color samples you make, the more
`accurate the final color will be, and a smoother more realistic look will be generated.
`
`Remember this technique only really improves the general look of the destination in areas where the source image
`becomes compressed by more than 50%. In areas where the distortion magnifies the source image, or keeps it about
`the same scale, a Interpolated Look Up of the source image look up will generally produce a good result with just one
`single lookup.
`
`In the Imploding Images warping examples (and many other examples thought), I touched briefly on the simplest
`method of 'super-sampling'. Enlarging the size of the output image (in this case by enlarging the input image), and
`then performing the distortion. After the distortion is complete we then resize the image back to its normal size again.
`
`For example...
`
` convert -size 94x94 xc:red -bordercolor white -border 3 \
` -virtual-pixel tile -implode 4 \
` implode_tiled_box.gif
` convert -size 94x94 xc:red -bordercolor white -border 3 \
` -virtual-pixel tile -resize 400% -implode 4 -resize 25% \
` implode_tiled_ss.gif
`
`https://web.archive.org/web/20120329131929/http://www.imagemagick.org/Usage/distorts/
`
`6/62
`
`Page 6 of 62
`
`

`

`4/11/22, 10:56 PM
`
`Distorting -- IM v6 Examples
`
`
`
`
`
`Normal Implosion of a Box Image
`
`Super Sampled Implosion
`
`Of course rather than enlarging the image, you could either use a higher quality (larger) source image, or generate one
`during your previous processing steps.
`
`This is especially useful when rotating text, which often has very fine detail that needs to be uniformly preserved to
`ensure a good high quality look in the final image. For examples of this see the Polaroid Transform.
`
`As of IM v6.4.2-6, the General Distortion Operator, can directly generate an enlarged output image, which you can scale
`(or resize) back down so as to merge and super-sample the resulting pixels. See distortion scale setting, as well as the next
`example.
`
`This is only one method of super sampling (known as the 'grid' method), there are however many other variations on
`this method. Eventually these methods may be implemented more directly in ImageMagick, but for now simple
`enlargement and scaling of images work quite well, without any additional coding need.
`
`One final word of warning. Super-sampling is limited by the number of samples that was used for each pixel in the
`final image, and thus the amount of scaling used in the final resize. This determines the final 'quality' of the distorted
`image. But by using larger scaling factors, the distorted image will of course be much much slower to generate, but
`have even higher quality. Unfortunately even this has limits.
`
`In the extreme, super-sampling will not handle image distortions that involves infinities (such as in the center of an
`imploded image). In such cases a completely different technique is needed, such as one that is provided by Area
`Resampling (see below).
`
`In summary, super-sampling can improve the look of images with only minor distortions, such as rotations, and
`shears. But it has limits to the types of distortions that it can improve.
`
`Adaptive Sampling
`
`The super-sampling technique can be expanded further. Rather than just using a fixed number of color lookups for
`each pixel, a check is made on either the distance between the lookups in the source image, or on the colors returned,
`to see if we should make more samples for that specific pixel.
`
`That is the amount of super-sampling could be made responsive to needs of the distortion, without knowing anything
`about the specifics of the distortion itself. This is known as Adaptive Super-Sampling.
`
`This technique is actually very common in Ray Tracers, where it is next to impossible to determine just how complex
`the resulting image is at specific points. In this case it is often restricted to the use of 'color differences' to determine
`when more samples are needed.
`
`IM does not currently support adaptive super-sampling at this time. Though it is quite possible to add alternative
`sampling methods into the General Distortion Operator (see below). It will require some functional rearrangement of
`the code, so may not be added anytime soon.
`
`Area Resampling, for better Distortions
`
`The best alternative to super-sampling methods is Area Re-sampling.
`
`Rather than distorting a larger image and averaging the results by resizing, Or just taking and averaging more samples
`from the image, we actually determine exactly how many pixels from the source image should be merged together
`
`https://web.archive.org/web/20120329131929/http://www.imagemagick.org/Usage/distorts/
`
`7/62
`
`Page 7 of 62
`
`

`

`Distorting -- IM v6 Examples
`4/11/22, 10:56 PM
`(based on the 'scale' of the distortion at that point) to generate each specific output pixel. That is figure out a rough
`'area' within the source image, each output pixel represents, and merge (filter) all those pixels together.
`
`In fact this is exactly what the ImageMagick Resize Operator (in reality a very specific type of image distortion) does
`to generate such good results. However for resize, you only need to calculate the scale and area needed to be sampled,
`once for the whole image, and the areas to be samples are rectangular.
`
`When area re-sampling a distorted image, the area of pixel being generate covers will change with position. Some
`pixel may only need to merge a few source image colors, or even just one single interpolated color lookup, while
`another pixel elsewhere in the image, may need to sample a very large number of pixels to generate the correct final
`color.
`
`Also the area that a destination pixel represents in the source image, may not be a simple square or circle, but may
`actually be a highly distorted shape, according to the distortion being used. Calculating and handling such awkward
`shapes can be very time consuming, or near impossible to achieve.
`
`For example here is a diagram showing how a round pixel in
`various parts of the final image needs to use all the colors from a
`larger, elliptical area in the source image.
`
`Using an elliptical area of the source image to calculate colors for
`each destination pixel, is a method known as Elliptical Weighted
`Average (EWA) Re-sampling, and was outlined in the PDF research
`paper "Fundamentals of Texture Mapping and Image Warping" by
`Paul Heckbert. This was then used to define the new Generalized
`Distortion Operator (see below).
`
`The results of this algorithm is especially good for extreme scale
`reductions such as produced by perspective distortions. For
`example here are all three re-sampling methods for an infinitely
`tiled perspective image. See Viewing Distant Horizons below for
`details.
`
` # input image: special checkerboard with a gold outline.
` convert -size 90x90 pattern:checkerboard -normalize -fill none \
` -stroke gold -strokewidth 3 -draw 'rectangle 0,0 89,89' \
` -fill red -draw 'color 20,20 floodfill' \
` -fill lime -draw 'color 40,70 floodfill' \
` -fill dodgerblue -draw 'color 70,40 floodfill' \
` checks.png
`
` # Using Interpolated Lookup
` convert checks.png -filter point \
` -virtual-pixel tile -mattecolor DodgerBlue \
` -distort Perspective '0,0 20,60 90,0 70,63 0,90 5,83 90,90 85,88' \
` horizon_tile_point.png
`
` # Using Grid Super Sampling
` convert checks.png -filter point -set option:distort:scale 10 \
` -virtual-pixel tile -mattecolor DodgerBlue \
` -distort Perspective '0,0 20,60 90,0 70,63 0,90 5,83 90,90 85,88' \
` -scale 10% horizon_tile_super.png
`
` # Using Area Resampling (default)
` convert checks.png -virtual-pixel tile -mattecolor DodgerBlue \
`
`https://web.archive.org/web/20120329131929/http://www.imagemagick.org/Usage/distorts/
`
`8/62
`
`Page 8 of 62
`
`

`

`4/11/22, 10:56 PM
`
`Distorting -- IM v6 Examples
` -distort Perspective '0,0 20,60 90,0 70,63 0,90 5,83 90,90 85,88' \
` horizon_tile.png
`
`
`
`
`
`
`
`
`
`Check Image
`
`Interpolated
`Lookup
`
`Super Sampling
`x10
`
`Elliptical Weighted Area
`(EWA) Resampling
`
`The last image was generated using the default EWA settings of the Generalized Distortion Operator (see below). It
`took 4.6 seconds to generate. Which is rather reasonable.
`
`The first image however is exactly the same, except that EWA resampling has been turned off by using a "-filter
`point" setting. This forces it to use Direct Interpolated Lookup for each pixel. As such this image was generated
`extremely fast in comparison (.51 seconds).
`
`The middle image is like the first image but with the distorted output image being enlarged by a factor of 10, before
`being scaled back to the original size. That is more than 100 pixels were looked up for each destination pixel, so as to
`Super Sample the result. It is quite fast to generate (1.2 seconds), and while it improves the quality of the image in
`general, that improvement is limited, and depends on how much super-sampling was provided. The ×10 used in the
`above example is very heavy, far exceeding the more typical 3 or 4 times scaling used for super-sampling.
`
`The biggest difference is that super-sampling only does a general improvement in quality uniformly over the whole
`image. As the distortion gets more sever it starts to break down. The result is the highly visible Resizing Artifacts in
`the middle ground, and a line of server moire effects just before the horizon. The moire effect is caused when when
`the 10 samples across per pixel closely matches the gross checker board pattern of the image.
`
`On the other hand area-resampling concentrates more on the problem pixels closer to the horizon (where it spends
`almost all of its time), than on foreground pixels. For simple distortions, EWA lookup remains slower than a direct
`sampled image, but is usually a lot faster than super-sampling as it avoids doing excessive sampling where it is not
`need. But it becomes very slow when distortions become very sever, as it needs to merge more pixels to get the color
`right.
`
`Basically the above is a very extreme distortion, and the time EWA lookup takes is commensurate. More commonly it
`generates much better results than a single interpolated lookup, while not using too many samples on every pixel as
`super-sampling does.
`
`A simple ellipse used by EWA, may not be perfect for all distortions. For example the "DePolar" distortion actually requires
`a curved circular arc for its ideal resampling area, rather than an ellipse. Because of this you may better off using a Super
`Sampling for these distortions.
`
`Generalized Distortion Operator
`
`With the generation of these examples, the ensuing discussions in the IM Forums, and multiple requests from users
`for easier and faster ways to do perspective and other distortions, a new operator was added to IM v6.3.5-1 to allow
`us to more easily add image distortions, of many different types.
`
`This Generalized Distortion Operator is called "-distort", and you can see what distortion methods it has available
`on your IM version using "-list Distort".
`
` convert -list distort
`
`https://web.archive.org/web/20120329131929/http://www.imagemagick.org/Usage/distorts/
`
`9/62
`
`Page 9 of 62
`
`

`

`Distorting -- IM v6 Examples
`4/11/22, 10:56 PM
`The "-distort" operator takes two arguments, one of the distortion methods as given by the above, and a second
`string argument consisting of comma or space separated list of floating point values, that is used to control the
`specific distortion method.
`
` convert ... -distort {method} "{list_of_floating_point_values}" ...
`
`The number floating point values given is however highly dependant on the distortion method being used, and their
`meanings also depend not only on the method chosen, but can also depend on the exact number of control points or
`attributes needed for a particular method.
`
`This is especially the case for the 'Scale-Rotate-Translate' (or 'SRT' for short) distortion, which really combines three
`separate 'Affine' distortions into a single distortion.
`
`Many distortion methods take a list of control points (in Image Coordinates), and typically these are given as pairs of
`coordinates which control how the distortion is to modify the image. These pairs of coordinates are detailed more
`fully later in Distortions Using Control Points.
`
`Distortion Options, Controls and Settings
`
`Best Fit +Distort Flag
`
`By default "-distort" will usually distort the source image(s) into an image that is the same size as the original
`image. There are exceptions to this, such as the 'Arc' distortion (a polar mapping variant) where the input source
`image size really does not have much meaning in the distorted form of the image (see Arc Distortion below for
`details).
`
`The other form of the operator, "+distort" (Added to IM v6.3.5-7), will attempt resize the distorted image so it will
`contain the whole of the input image (if possible), much like what the older Rotate and Shearing operators do.
`
`However this particular 'mode' of operation also goes further and also sets the Virtual Canvas Offset (page) of the
`resulting image. This way you can later Layers Merge this image onto another image, at the correct position
`according to your control points.
`
`Also (depending on the distortion method) a "+distort" will attempt to take into account any existing Virtual Canvas
`Offset that may be present in the source image, and use it as part of the distortion process. See the notes about the
`individual disortion methods.
`
`As such you may need to make judicious use of the "+repage" attribute setting operator to clear or adjust that offset
`before using the 'best-fit' "+distort" form of the General Distortion Operator. You am may need to use it after if the
`virtual canvas and offset is not required. See also Removing Canvas/Page Geometry.
`
`The normal "-distort" will just ignore any existing offset present in the source image in terms of the distortion itself

This document is available on Docket Alarm but you must sign up to view it.


Or .

Accessing this document will incur an additional charge of $.

After purchase, you can access this document again without charge.

Accept $ Charge
throbber

Still Working On It

This document is taking longer than usual to download. This can happen if we need to contact the court directly to obtain the document and their servers are running slowly.

Give it another minute or two to complete, and then try the refresh button.

throbber

A few More Minutes ... Still Working

It can take up to 5 minutes for us to download a document if the court servers are running slowly.

Thank you for your continued patience.

This document could not be displayed.

We could not find this document within its docket. Please go back to the docket page and check the link. If that does not work, go back to the docket and refresh it to pull the newest information.

Your account does not support viewing this document.

You need a Paid Account to view this document. Click here to change your account type.

Your account does not support viewing this document.

Set your membership status to view this document.

With a Docket Alarm membership, you'll get a whole lot more, including:

  • Up-to-date information for this case.
  • Email alerts whenever there is an update.
  • Full text search for other cases.
  • Get email alerts whenever a new case matches your search.

Become a Member

One Moment Please

The filing “” is large (MB) and is being downloaded.

Please refresh this page in a few minutes to see if the filing has been downloaded. The filing will also be emailed to you when the download completes.

Your document is on its way!

If you do not receive the document in five minutes, contact support at support@docketalarm.com.

Sealed Document

We are unable to display this document, it may be under a court ordered seal.

If you have proper credentials to access the file, you may proceed directly to the court's system using your government issued username and password.


Access Government Site

We are redirecting you
to a mobile optimized page.





Document Unreadable or Corrupt

Refresh this Document
Go to the Docket

We are unable to display this document.

Refresh this Document
Go to the Docket