Transforming coordinates

int unweaverTransformToOriginal(SEAM_UNWEAVER *weaver, int *xptr, int *yptr);

This function is useful when reconstructing the image that would result from the seam removals performed so far. It translates coordinates in the specified unweaver to coordinates in the original image. Put another way, it takes the coordinates of a pixel in the seam-carved image, and returns the coordinates of that pixel in the original image. So to reconstruct the seam-carved image, all a program need do is iterate over the width and height of the output, translating each position to the corresponding position in the input, where the colour data will be found for that pixel.

For many applications the actual seams removed (as returned in the buffers passed to unweaverNextVertical and unweaverNextHorizontal) can be ignored, and this function used to determine the result of the seam carving.

Pointer to the unweaver to use.
Pointer to the x coordinate to transform.
Pointer to the y coordinate to transform.

Returns nonzero if the transformation was completed successfully. Returns zero if the coordinates were out of range of the unweaver's current size.

Hayden Walles 2015-09-02 Logo