more the rest of mosaicing into private API

chkpair, lr|tbmosaic, etc.
This commit is contained in:
John Cupitt 2020-07-02 12:35:37 +01:00
parent 0803de07e7
commit 3c071a8ebb
12 changed files with 55 additions and 57 deletions

View File

@ -123,7 +123,7 @@ lrmosaic_vec( im_object *argv )
int balancetype = *((int *) argv[10]); int balancetype = *((int *) argv[10]);
int mwidth = *((int *) argv[11]); int mwidth = *((int *) argv[11]);
return( vips_lrmosaic( argv[0], argv[1], argv[2], return( vips__lrmosaic( argv[0], argv[1], argv[2],
bandno, bandno,
xr, yr, xs, ys, xr, yr, xs, ys,
halfcorrelation, halfarea, halfcorrelation, halfarea,
@ -257,7 +257,7 @@ tbmosaic_vec( im_object *argv )
int balancetype = *((int *) argv[10]); int balancetype = *((int *) argv[10]);
int mwidth = *((int *) argv[11]); int mwidth = *((int *) argv[11]);
return( vips_tbmosaic( argv[0], argv[1], argv[2], return( vips__tbmosaic( argv[0], argv[1], argv[2],
bandno, bandno,
x1, y1, x2, y2, x1, y1, x2, y2,
halfcorrelation, halfarea, halfcorrelation, halfarea,
@ -594,7 +594,7 @@ correl_vec( im_object *argv )
int *y = (int *) argv[9]; int *y = (int *) argv[9];
double *correlation = (double *) argv[10]; double *correlation = (double *) argv[10];
return( vips_correl( argv[0], argv[1], return( vips__correl( argv[0], argv[1],
xref, yref, xsec, ysec, cor, area, correlation, x, y ) ); xref, yref, xsec, ysec, cor, area, correlation, x, y ) );
} }

View File

@ -276,30 +276,25 @@ VipsWindow *vips_window_take( VipsWindow *window,
int vips__profile_set( VipsImage *image, const char *name ); int vips__profile_set( VipsImage *image, const char *name );
int vips_correl( VipsImage *ref, VipsImage *sec, int vips__lrmosaic( VipsImage *ref, VipsImage *sec, VipsImage *out,
int bandno,
int xref, int yref, int xsec, int ysec,
int hwindowsize, int hsearchsize,
int balancetype,
int mwidth );
int vips__tbmosaic( VipsImage *ref, VipsImage *sec, VipsImage *out,
int bandno,
int xref, int yref, int xsec, int ysec,
int hwindowsize, int hsearchsize,
int balancetype,
int mwidth );
int vips__correl( VipsImage *ref, VipsImage *sec,
int xref, int yref, int xsec, int ysec, int xref, int yref, int xsec, int ysec,
int hwindowsize, int hsearchsize, int hwindowsize, int hsearchsize,
double *correlation, int *x, int *y ); double *correlation, int *x, int *y );
int vips_lrmerge( VipsImage *ref, VipsImage *sec, VipsImage *out,
int dx, int dy, int mwidth );
int vips_tbmerge( VipsImage *ref, VipsImage *sec, VipsImage *out,
int dx, int dy, int mwidth );
int vips_lrmosaic( VipsImage *ref, VipsImage *sec, VipsImage *out,
int bandno,
int xref, int yref, int xsec, int ysec,
int hwindowsize, int hsearchsize,
int balancetype,
int mwidth );
int vips_tbmosaic( VipsImage *ref, VipsImage *sec, VipsImage *out,
int bandno,
int xref, int yref, int xsec, int ysec,
int hwindowsize, int hsearchsize,
int balancetype,
int mwidth );
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /*__cplusplus*/ #endif /*__cplusplus*/

View File

@ -6,20 +6,20 @@ libmosaicing_la_SOURCES = \
mosaic.c \ mosaic.c \
match.c \ match.c \
mosaic1.c \ mosaic1.c \
chkpair.c \
matrixinvert.c \ matrixinvert.c \
global_balance.c \ global_balance.c \
lrmerge.c \ lrmerge.c \
tbmerge.c \ tbmerge.c \
lrmosaic.c \
tbmosaic.c \
remosaic.c \
im_avgdxdy.c \ im_avgdxdy.c \
im_chkpair.c \
im_clinear.c \ im_clinear.c \
im_improve.c \ im_improve.c \
im_initialize.c \ im_initialize.c \
im_lrcalcon.c \ im_lrcalcon.c \
im_lrmosaic.c \
im_tbcalcon.c \ im_tbcalcon.c \
im_remosaic.c \
im_tbmosaic.c \
global_balance.h \ global_balance.h \
pmosaicing.h pmosaicing.h

View File

@ -59,8 +59,7 @@
#include "pmosaicing.h" #include "pmosaicing.h"
/** /* vips__correl:
* vips_correl:
* @ref: reference image * @ref: reference image
* @sec: secondary image * @sec: secondary image
* @xref: position in reference image * @xref: position in reference image
@ -86,19 +85,19 @@
* parts needed. Correlation is done with vips_spcor(); the position of * parts needed. Correlation is done with vips_spcor(); the position of
* the maximum is found with vips_max(). * the maximum is found with vips_max().
* *
* See also: vips_match(), vips_lrmosaic(). * See also: vips_match(), vips__lrmosaic().
* *
* Returns: 0 on success, -1 on error * Returns: 0 on success, -1 on error
*/ */
int int
vips_correl( VipsImage *ref, VipsImage *sec, vips__correl( VipsImage *ref, VipsImage *sec,
int xref, int yref, int xsec, int ysec, int xref, int yref, int xsec, int ysec,
int hwindowsize, int hsearchsize, int hwindowsize, int hsearchsize,
double *correlation, int *x, int *y ) double *correlation, int *x, int *y )
{ {
VipsImage *surface = vips_image_new(); VipsImage *surface = vips_image_new();
VipsImage **t = (VipsImage **) VipsImage **t = (VipsImage **)
vips_object_local_array( VIPS_OBJECT( surface ), 4 ); vips_object_local_array( VIPS_OBJECT( surface ), 4 );
VipsRect refr, secr; VipsRect refr, secr;
VipsRect winr, srhr; VipsRect winr, srhr;
@ -130,9 +129,11 @@ vips_correl( VipsImage *ref, VipsImage *sec,
/* Extract window and search area. /* Extract window and search area.
*/ */
if( vips_extract_area( ref, &t[0], if( vips_extract_area( ref, &t[0],
wincr.left, wincr.top, wincr.width, wincr.height, NULL ) || wincr.left, wincr.top, wincr.width, wincr.height,
NULL ) ||
vips_extract_area( sec, &t[1], vips_extract_area( sec, &t[1],
srhcr.left, srhcr.top, srhcr.width, srhcr.height, NULL ) ) { srhcr.left, srhcr.top, srhcr.width, srhcr.height,
NULL ) ) {
g_object_unref( surface ); g_object_unref( surface );
return( -1 ); return( -1 );
} }
@ -205,7 +206,7 @@ vips__chkpair( VipsImage *ref, VipsImage *sec, TiePoints *points )
for( i = 0; i < points->nopoints; i++ ) { for( i = 0; i < points->nopoints; i++ ) {
/* Find correlation point. /* Find correlation point.
*/ */
if( vips_correl( ref, sec, if( vips__correl( ref, sec,
points->x_reference[i], points->y_reference[i], points->x_reference[i], points->y_reference[i],
points->x_reference[i], points->y_reference[i], points->x_reference[i], points->y_reference[i],
hcor, harea, hcor, harea,

View File

@ -242,7 +242,7 @@ vips__find_lroverlap( VipsImage *ref_in, VipsImage *sec_in, VipsImage *out,
} }
int int
vips_lrmosaic( VipsImage *ref, VipsImage *sec, VipsImage *out, vips__lrmosaic( VipsImage *ref, VipsImage *sec, VipsImage *out,
int bandno, int bandno,
int xref, int yref, int xsec, int ysec, int xref, int yref, int xsec, int ysec,
int hwindowsize, int hsearchsize, int hwindowsize, int hsearchsize,

View File

@ -128,7 +128,7 @@ vips_match_build( VipsObject *object )
int xs, ys; int xs, ys;
double cor; double cor;
if( vips_correl( match->ref, match->sec, if( vips__correl( match->ref, match->sec,
match->xr1, match->yr1, match->xs1, match->ys1, match->xr1, match->yr1, match->xs1, match->ys1,
match->hwindow, match->harea, match->hwindow, match->harea,
&cor, &xs, &ys ) ) &cor, &xs, &ys ) )
@ -136,7 +136,7 @@ vips_match_build( VipsObject *object )
match->xs1 = xs; match->xs1 = xs;
match->ys1 = ys; match->ys1 = ys;
if( vips_correl( match->ref, match->sec, if( vips__correl( match->ref, match->sec,
match->xr2, match->yr2, match->xs2, match->ys2, match->xr2, match->yr2, match->xs2, match->ys2,
match->hwindow, match->harea, match->hwindow, match->harea,
&cor, &xs, &ys ) ) &cor, &xs, &ys ) )

View File

@ -275,11 +275,11 @@ rotjoin_search( VipsImage *ref, VipsImage *sec, VipsImage *out, joinfn jfn,
* vips__transform_set_area() has set, and move the sec tie-points * vips__transform_set_area() has set, and move the sec tie-points
* accordingly. * accordingly.
*/ */
if( vips_correl( t[0], t[2], xr1, yr1, if( vips__correl( t[0], t[2], xr1, yr1,
xs3 - trn.oarea.left, ys3 - trn.oarea.top, xs3 - trn.oarea.left, ys3 - trn.oarea.top,
halfcorrelation, halfarea, &cor1, &xs5, &ys5 ) ) halfcorrelation, halfarea, &cor1, &xs5, &ys5 ) )
return( -1 ); return( -1 );
if( vips_correl( t[0], t[2], xr2, yr2, if( vips__correl( t[0], t[2], xr2, yr2,
xs4 - trn.oarea.left, ys4 - trn.oarea.top, xs4 - trn.oarea.left, ys4 - trn.oarea.top,
halfcorrelation, halfarea, &cor2, &xs6, &ys6 ) ) halfcorrelation, halfarea, &cor2, &xs6, &ys6 ) )
return( -1 ); return( -1 );

View File

@ -58,21 +58,17 @@
* *
* The mosaicing functions can be grouped into layers: * The mosaicing functions can be grouped into layers:
* *
* The lowest level functions are vips_correl() and vips_merge(). * The lowest level operation is vips_merge() which
* vips_correl()
* searches a large image for a small sub-image, returning
* the position of the best sub-image match. vips_merge()
* joins two images together * joins two images together
* left-right or up-down with a smooth seam. * left-right or up-down with a smooth seam.
* *
* Next, vips_mosaic() use the * Next, vips_mosaic() uses
* search function plus the two low-level merge operations to join two images * search functions plus the two low-level merge operations to join two images
* given just an approximate overlap as a start point. * given just an approximate overlap as a start point.
* *
* The functions vips_lrmosaic1() and vips_tbmosaic1() are * vips_mosaic1() is a first-order
* first-order * analogue of the basic mosaic functions: it takes two approximate
* analogues of the basic mosaic functions: they take two approximate * tie-points and uses
* tie-points and use
* them to rotate and scale the right-hand or bottom image before starting to * them to rotate and scale the right-hand or bottom image before starting to
* join. * join.
* *

View File

@ -122,10 +122,12 @@ void *vips__start_merge( VipsImage *out, void *, void * );
int vips__merge_gen( VipsRegion *or, void *seq, void *a, void *, int vips__merge_gen( VipsRegion *or, void *seq, void *a, void *,
gboolean *stop ); gboolean *stop );
int vips__stop_merge( void *seq, void *, void * ); int vips__stop_merge( void *seq, void *, void * );
int vips__lrmerge( VipsImage *ref, VipsImage *sec, VipsImage *out, int vips__lrmerge( VipsImage *ref, VipsImage *sec, VipsImage *out,
int dx, int dy, int mwidth ); int dx, int dy, int mwidth );
int vips__tbmerge( VipsImage *ref, VipsImage *sec, VipsImage *out, int vips__tbmerge( VipsImage *ref, VipsImage *sec, VipsImage *out,
int dx, int dy, int mwidth ); int dx, int dy, int mwidth );
int vips__lrmerge1( VipsImage *ref, VipsImage *sec, VipsImage *out, int vips__lrmerge1( VipsImage *ref, VipsImage *sec, VipsImage *out,
double a, double b, double dx, double dy, double a, double b, double dx, double dy,
int mwidth ); int mwidth );
@ -133,6 +135,10 @@ int vips__tbmerge1( VipsImage *ref, VipsImage *sec, VipsImage *out,
double a, double b, double dx, double dy, double a, double b, double dx, double dy,
int mwidth ); int mwidth );
int vips_correl( VipsImage *ref, VipsImage *sec,
int xref, int yref, int xsec, int ysec,
int hwindowsize, int hsearchsize,
double *correlation, int *x, int *y );
#define VIPS_MAXPOINTS (60) /* VIPS_MAXPOINTS % AREAS must be zero */ #define VIPS_MAXPOINTS (60) /* VIPS_MAXPOINTS % AREAS must be zero */
#define AREAS (3) #define AREAS (3)

View File

@ -213,7 +213,7 @@ vips__find_tboverlap( VipsImage *ref_in, VipsImage *sec_in, VipsImage *out,
} }
int int
vips_tbmosaic( VipsImage *ref, VipsImage *sec, VipsImage *out, vips__tbmosaic( VipsImage *ref, VipsImage *sec, VipsImage *out,
int bandno, int bandno,
int xref, int yref, int xsec, int ysec, int xref, int yref, int xsec, int ysec,
int hwindowsize, int hsearchsize, int hwindowsize, int hsearchsize,

View File

@ -349,25 +349,25 @@ libvips/morphology/morph.c
libvips/morphology/morphology.c libvips/morphology/morphology.c
libvips/morphology/nearest.c libvips/morphology/nearest.c
libvips/morphology/rank.c libvips/morphology/rank.c
libvips/mosaicing/chkpair.c
libvips/mosaicing/global_balance.c libvips/mosaicing/global_balance.c
libvips/mosaicing/im_avgdxdy.c libvips/mosaicing/im_avgdxdy.c
libvips/mosaicing/im_chkpair.c
libvips/mosaicing/im_clinear.c libvips/mosaicing/im_clinear.c
libvips/mosaicing/im_improve.c libvips/mosaicing/im_improve.c
libvips/mosaicing/im_initialize.c libvips/mosaicing/im_initialize.c
libvips/mosaicing/im_lrcalcon.c libvips/mosaicing/im_lrcalcon.c
libvips/mosaicing/im_lrmerge.c
libvips/mosaicing/im_lrmosaic.c
libvips/mosaicing/im_remosaic.c
libvips/mosaicing/im_tbcalcon.c libvips/mosaicing/im_tbcalcon.c
libvips/mosaicing/im_tbmerge.c libvips/mosaicing/lrmerge.c
libvips/mosaicing/im_tbmosaic.c libvips/mosaicing/lrmosaic.c
libvips/mosaicing/match.c libvips/mosaicing/match.c
libvips/mosaicing/matrixinvert.c libvips/mosaicing/matrixinvert.c
libvips/mosaicing/merge.c libvips/mosaicing/merge.c
libvips/mosaicing/mosaic1.c libvips/mosaicing/mosaic1.c
libvips/mosaicing/mosaic.c libvips/mosaicing/mosaic.c
libvips/mosaicing/mosaicing.c libvips/mosaicing/mosaicing.c
libvips/mosaicing/remosaic.c
libvips/mosaicing/tbmerge.c
libvips/mosaicing/tbmosaic.c
libvips/resample/affine.c libvips/resample/affine.c
libvips/resample/bicubic.cpp libvips/resample/bicubic.cpp
libvips/resample/interpolate.c libvips/resample/interpolate.c