Image Remapping Matrix

158 views
Skip to first unread message

Bob

unread,
Nov 9, 2009, 2:36:39 AM11/9/09
to hugin and other free panoramic software
Hello,everyone.
I tried to develope a image remaping module. So I need to modify the
existing remapping modules's code(like nona,PTmender) to get the
remapping matrix between the images calculated by the nona,and feed
the matrices to the remapping modules I developed.

So where is the code of the image remapping matrix calculation of the
nona or PTmender?
I debug step-by-step the nona and PTmender using the 'simpleStitch' of
libpano12,but I couldn't find the code out.

Can anybody help me?

Cheers

Bob

Jim Watters

unread,
Nov 9, 2009, 11:37:54 AM11/9/09
to hugi...@googlegroups.com
Do a file search for all instances of one of the pano defines in
panorama.h like _mercator.
What I believe you are looking for is in adjust.c and math.c

--
Jim Watters

jwat...@photocreations.ca
http://photocreations.ca

Bob

unread,
Nov 9, 2009, 9:18:22 PM11/9/09
to hugin and other free panoramic software
Thanks Jim,
I found the code in nona, it's in Stitcher.h
but I drop finding the code in PTmender,because I failed to compile
the PTmender by VS2008 and got the errors below:
.....
1>pano13vc.def : error LNK2001: unresolved external symbol DLLInit
1>pano13vc.def : error LNK2001: unresolved external symbol DispPrg
....
> jwatt...@photocreations.cahttp://photocreations.ca- 隐藏被引用文字 -
>
> - 显示引用的文字 -

Tom Sharpless

unread,
Nov 10, 2009, 9:21:04 PM11/10/09
to hugin and other free panoramic software
Hi Bob

There is no "remapping matrix" in PanoTools. It uses a sequence of
functions that perform parts of the overall remapping. Those
functions all have the same argument list format and are called
automatically in the required order once placed in the "function
stack", i.e. a list of function pointers and pointers to optional
arguments. As Jim points out, these functions are defined in filter.c
and math.c; adjust.c has code that sets up stacks. Each invocation of
a stack maps one output pixel to an interpolation point in an input
image.

Each function maps a 2D coordinate pair into another one. There are
functions for mapping each way between most pairs of the many
projection types known to libpano, and one special one that performs
the alignment operation by mapping equirectangular to equirectangular
through a 3D rotation. Also a few utility mappings like shear and
radial stretch according to a polynomial. The sequence of functions
for a typical stitching operation is something like this: 1)
destination projection to equirectangular; 2) rotate in 3D; 3)
equirectangular to ideal lens projection (for example rectilinear); 4)
radial polynomial to model lens distortion. The coordinates are
scaled "as radians" thoughout; conversion from/to pixel coordinates
happens outside the stack.

If by "remapping matrix" you mean a table of source positions
corresponding to given destination pixels, the optional "fast
remapping" module generates one of those for a grid with a spacing of
several destination pixels each way. I think that code is in
resample.c; at least the code that uses the table is there. You could
probably export the table to a file for transfer to your app.

Hope this helps, Tom

Bob

unread,
Nov 12, 2009, 2:23:32 AM11/12/09
to hugin and other free panoramic software
Thanks Tom,
Forgive my mistake,mapping matrix is just correct.
Mapping matrix meas transforming matrix(like homography,affine
transform matrix,etc),
like P' = P x H, among them P' is the destination mapped point
corresponding to the source point P,
and H is the homography matrix(mapping matrix)

I developed a image mosaic system before,using OpenCV and VS2008,
I first use SIFT to get the control points of the images,
then calculate the homographies using the control points,
next step is to warp(map) the image into a same plane using the
homographies,
and finally blending the warped images into a mosaic image.

> Each function maps a 2D coordinate pair into another one. There are
> functions for mapping each way between most pairs of the many
> projection types known to libpano, and one special one that performs
> the alignment operation by mapping equirectangular to equirectangular
> through a 3D rotation. Also a few utility mappings like shear and
> radial stretch according to a polynomial. The sequence of functions
> for a typical stitching operation is something like this: 1)
> destination projection to equirectangular; 2) rotate in 3D; 3)
> equirectangular to ideal lens projection (for example rectilinear); 4)
> radial polynomial to model lens distortion. The coordinates are
> scaled "as radians" thoughout; conversion from/to pixel coordinates
> happens outside the stack.

You mean each function maps a a 2D coordinate pair into another one.
So if I want map a image(640x560) to equirectangular ,
there will be only one mapping function for this operation or there
will be 640x560 functions for this operation?

How PanoTools calculate the mapping parameters for this alignment
operation?
By the control points matched?or the camera parameter?
You know,my mosaic system,I calculate the mapping parameters by
control points(SIFT)

Cheers,
Bob

BTW,I nearly got insane for compiling the PTmender using VS2008 in
Windows,
I got the link error below:
.....
1>pano13vc.def : error LNK2001: unresolved external symbol DLLInit
1>pano13vc.def : error LNK2001: unresolved external symbol DispPrg
....
Do you know how to handle this?
> > Bob- 隐藏被引用文字 -
>
> - 显示引用的文字 -
Reply all
Reply to author
Forward
0 new messages