Re: alignment of pixels with coordinates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Martin Nordholts writes:
 > Nicolas Robidoux wrote:
 > > My working assumption is that GEGL should be as consistent as possible
 > > with GIMP.
 > 
 > That seems weird to me, why not go for the "best" resampling approach 
 > and ignore how GIMP does it?

Well, it certainly makes my life easier if I don't have to try to be
aligned with how GIMP generally does things.

However, I am a bit concerned that users may expect a certain GENERAL
behavior, and be upset if they don't get it. So, I'd like feedback
regarding: "Coke Classic or New Coke"?

Alignment is more or less independent of "best resampling methods"
(although currently all samplers implemented are "point" samplers and
consequently are more friendly to the "center-based physical
coordinate" approach).

Every resampling method can pretty much be used with every "image
alignment convention." Some resampling methods may be a bit trickier
to implement with one convention than another or may lose some
desirable properties (most notably near the boundary, although this
also depends on the abyss policy). But with a bit of tweaking,
reasonable results can be obtained irregardless of the "image
alignment convention" provided one makes sure that things are
consistent.

To give an example, (classic) ImageMagick uses the usual "exact area
transformation" convention (corner-based physical coordinates, which
are friendly to box filtering) even though most of its many resamplers
are point resamplers (if image is N pixel wide and its geometrical
width is understood to be from 0 to 1, then the first pixel center is
understood to be located at position 1/(2*N)), but I routinely compile
it with minor source code changes so that when scaling an image it
uses the usual "point transformation" convention (center-based
physical coordinates, which are friendly to nearest neighbour) (under
the above conditions, the horizontal position of the center of the
first pixel is 0).

In order to avoid undesirable/unexpected shifts, it is important to
make sure that the convention used inside the sampler is the same as
the one used by, say, a scaling operator.  These issues are addressed,
for example, in

http://www.vtk.org/Bug/view.php?id=6558

>From the sampler code already in GEGL, I assumed that the GEGL
convention is 

"center-based physical coordinates:" image starts at 0, and the first
pixel is centered at 0; in addition, assuming unit inter-pixel
distance, the last pixel is located at N-1 if there are N pixels in
total in the horizontal direction.

The most common alternative being:

"corner-based physical coordinates," which is commonly expressed in
two different ways:

          version 1: image starts at -.5, first pixel is centered at
          0, the last pixel is located at N-1 and the image ends at
          N-.5.

          version 2: image starts at 0, first pixel is centered at .5,
          the last pixel is located at N-.5 and the image ends at N.

So, my questions are:

A) Is "center-based physical coordinates" indeed the intended
convention for GEGL?

B) For GIMP?

C) If the intended conventions are different, should I align GEGL's
convention with GIMP's? Or leave it be?

----------------------------------------------------------------------

Apologies for the longish email, but I'd like to set this issue to
rest.

Nicolas Robidoux
Laurentian University


_______________________________________________
Gegl-developer mailing list
Gegl-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer

[Index of Archives]     [Yosemite News]     [Yosemite Photos]     [gtk]     [GIMP Users]     [KDE]     [Gimp's Home]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux