diff --git a/libvips/deprecated/mosaicing_dispatch.c b/libvips/deprecated/mosaicing_dispatch.c index b8f7b121..bf7a6ed6 100644 --- a/libvips/deprecated/mosaicing_dispatch.c +++ b/libvips/deprecated/mosaicing_dispatch.c @@ -123,7 +123,7 @@ lrmosaic_vec( im_object *argv ) int balancetype = *((int *) argv[10]); int mwidth = *((int *) argv[11]); - return( vips_lrmosaic( argv[0], argv[1], argv[2], + return( vips__lrmosaic( argv[0], argv[1], argv[2], bandno, xr, yr, xs, ys, halfcorrelation, halfarea, @@ -257,7 +257,7 @@ tbmosaic_vec( im_object *argv ) int balancetype = *((int *) argv[10]); int mwidth = *((int *) argv[11]); - return( vips_tbmosaic( argv[0], argv[1], argv[2], + return( vips__tbmosaic( argv[0], argv[1], argv[2], bandno, x1, y1, x2, y2, halfcorrelation, halfarea, @@ -594,7 +594,7 @@ correl_vec( im_object *argv ) int *y = (int *) argv[9]; 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 ) ); } diff --git a/libvips/include/vips/internal.h b/libvips/include/vips/internal.h index 524097d8..84030580 100644 --- a/libvips/include/vips/internal.h +++ b/libvips/include/vips/internal.h @@ -276,30 +276,25 @@ VipsWindow *vips_window_take( VipsWindow *window, 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 hwindowsize, int hsearchsize, 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 } #endif /*__cplusplus*/ diff --git a/libvips/mosaicing/Makefile.am b/libvips/mosaicing/Makefile.am index 9d7b4035..6e6420bf 100644 --- a/libvips/mosaicing/Makefile.am +++ b/libvips/mosaicing/Makefile.am @@ -6,20 +6,20 @@ libmosaicing_la_SOURCES = \ mosaic.c \ match.c \ mosaic1.c \ + chkpair.c \ matrixinvert.c \ global_balance.c \ lrmerge.c \ tbmerge.c \ + lrmosaic.c \ + tbmosaic.c \ + remosaic.c \ im_avgdxdy.c \ - im_chkpair.c \ im_clinear.c \ im_improve.c \ im_initialize.c \ im_lrcalcon.c \ - im_lrmosaic.c \ im_tbcalcon.c \ - im_remosaic.c \ - im_tbmosaic.c \ global_balance.h \ pmosaicing.h diff --git a/libvips/mosaicing/im_chkpair.c b/libvips/mosaicing/chkpair.c similarity index 94% rename from libvips/mosaicing/im_chkpair.c rename to libvips/mosaicing/chkpair.c index 5472f5d1..a7de1e8c 100644 --- a/libvips/mosaicing/im_chkpair.c +++ b/libvips/mosaicing/chkpair.c @@ -59,8 +59,7 @@ #include "pmosaicing.h" -/** - * vips_correl: +/* vips__correl: * @ref: reference image * @sec: secondary image * @xref: position in reference image @@ -86,19 +85,19 @@ * parts needed. Correlation is done with vips_spcor(); the position of * 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 */ int -vips_correl( VipsImage *ref, VipsImage *sec, +vips__correl( VipsImage *ref, VipsImage *sec, int xref, int yref, int xsec, int ysec, int hwindowsize, int hsearchsize, double *correlation, int *x, int *y ) { VipsImage *surface = vips_image_new(); VipsImage **t = (VipsImage **) - vips_object_local_array( VIPS_OBJECT( surface ), 4 ); + vips_object_local_array( VIPS_OBJECT( surface ), 4 ); VipsRect refr, secr; VipsRect winr, srhr; @@ -130,9 +129,11 @@ vips_correl( VipsImage *ref, VipsImage *sec, /* Extract window and search area. */ 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], - srhcr.left, srhcr.top, srhcr.width, srhcr.height, NULL ) ) { + srhcr.left, srhcr.top, srhcr.width, srhcr.height, + NULL ) ) { g_object_unref( surface ); return( -1 ); } @@ -205,7 +206,7 @@ vips__chkpair( VipsImage *ref, VipsImage *sec, TiePoints *points ) for( i = 0; i < points->nopoints; i++ ) { /* 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], hcor, harea, diff --git a/libvips/mosaicing/im_lrmosaic.c b/libvips/mosaicing/lrmosaic.c similarity index 99% rename from libvips/mosaicing/im_lrmosaic.c rename to libvips/mosaicing/lrmosaic.c index 975a062e..8d736c2d 100644 --- a/libvips/mosaicing/im_lrmosaic.c +++ b/libvips/mosaicing/lrmosaic.c @@ -242,7 +242,7 @@ vips__find_lroverlap( VipsImage *ref_in, VipsImage *sec_in, VipsImage *out, } int -vips_lrmosaic( VipsImage *ref, VipsImage *sec, VipsImage *out, +vips__lrmosaic( VipsImage *ref, VipsImage *sec, VipsImage *out, int bandno, int xref, int yref, int xsec, int ysec, int hwindowsize, int hsearchsize, diff --git a/libvips/mosaicing/match.c b/libvips/mosaicing/match.c index 38821ebc..c56fa07e 100644 --- a/libvips/mosaicing/match.c +++ b/libvips/mosaicing/match.c @@ -128,7 +128,7 @@ vips_match_build( VipsObject *object ) int xs, ys; 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->hwindow, match->harea, &cor, &xs, &ys ) ) @@ -136,7 +136,7 @@ vips_match_build( VipsObject *object ) match->xs1 = xs; 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->hwindow, match->harea, &cor, &xs, &ys ) ) diff --git a/libvips/mosaicing/mosaic1.c b/libvips/mosaicing/mosaic1.c index 379ed5ec..ddf9160e 100644 --- a/libvips/mosaicing/mosaic1.c +++ b/libvips/mosaicing/mosaic1.c @@ -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 * 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, halfcorrelation, halfarea, &cor1, &xs5, &ys5 ) ) 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, halfcorrelation, halfarea, &cor2, &xs6, &ys6 ) ) return( -1 ); diff --git a/libvips/mosaicing/mosaicing.c b/libvips/mosaicing/mosaicing.c index 5689cb7e..6b1660b8 100644 --- a/libvips/mosaicing/mosaicing.c +++ b/libvips/mosaicing/mosaicing.c @@ -58,21 +58,17 @@ * * The mosaicing functions can be grouped into layers: * - * The lowest level functions are vips_correl() and vips_merge(). - * vips_correl() - * searches a large image for a small sub-image, returning - * the position of the best sub-image match. vips_merge() + * The lowest level operation is vips_merge() which * joins two images together * left-right or up-down with a smooth seam. * - * Next, vips_mosaic() use the - * search function plus the two low-level merge operations to join two images + * Next, vips_mosaic() uses + * search functions plus the two low-level merge operations to join two images * given just an approximate overlap as a start point. * - * The functions vips_lrmosaic1() and vips_tbmosaic1() are - * first-order - * analogues of the basic mosaic functions: they take two approximate - * tie-points and use + * vips_mosaic1() is a first-order + * analogue of the basic mosaic functions: it takes two approximate + * tie-points and uses * them to rotate and scale the right-hand or bottom image before starting to * join. * diff --git a/libvips/mosaicing/pmosaicing.h b/libvips/mosaicing/pmosaicing.h index adaf8457..2acbdeb5 100644 --- a/libvips/mosaicing/pmosaicing.h +++ b/libvips/mosaicing/pmosaicing.h @@ -122,10 +122,12 @@ void *vips__start_merge( VipsImage *out, void *, void * ); int vips__merge_gen( VipsRegion *or, void *seq, void *a, void *, gboolean *stop ); int vips__stop_merge( void *seq, void *, void * ); + 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__lrmerge1( VipsImage *ref, VipsImage *sec, VipsImage *out, double a, double b, double dx, double dy, int mwidth ); @@ -133,6 +135,10 @@ int vips__tbmerge1( VipsImage *ref, VipsImage *sec, VipsImage *out, double a, double b, double dx, double dy, 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 AREAS (3) diff --git a/libvips/mosaicing/im_remosaic.c b/libvips/mosaicing/remosaic.c similarity index 100% rename from libvips/mosaicing/im_remosaic.c rename to libvips/mosaicing/remosaic.c diff --git a/libvips/mosaicing/im_tbmosaic.c b/libvips/mosaicing/tbmosaic.c similarity index 99% rename from libvips/mosaicing/im_tbmosaic.c rename to libvips/mosaicing/tbmosaic.c index 2d3a85ee..dac7b7a8 100644 --- a/libvips/mosaicing/im_tbmosaic.c +++ b/libvips/mosaicing/tbmosaic.c @@ -213,7 +213,7 @@ vips__find_tboverlap( VipsImage *ref_in, VipsImage *sec_in, VipsImage *out, } int -vips_tbmosaic( VipsImage *ref, VipsImage *sec, VipsImage *out, +vips__tbmosaic( VipsImage *ref, VipsImage *sec, VipsImage *out, int bandno, int xref, int yref, int xsec, int ysec, int hwindowsize, int hsearchsize, diff --git a/po/POTFILES.in b/po/POTFILES.in index 2b1843eb..c3dc94dc 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -349,25 +349,25 @@ libvips/morphology/morph.c libvips/morphology/morphology.c libvips/morphology/nearest.c libvips/morphology/rank.c +libvips/mosaicing/chkpair.c libvips/mosaicing/global_balance.c libvips/mosaicing/im_avgdxdy.c -libvips/mosaicing/im_chkpair.c libvips/mosaicing/im_clinear.c libvips/mosaicing/im_improve.c libvips/mosaicing/im_initialize.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_tbmerge.c -libvips/mosaicing/im_tbmosaic.c +libvips/mosaicing/lrmerge.c +libvips/mosaicing/lrmosaic.c libvips/mosaicing/match.c libvips/mosaicing/matrixinvert.c libvips/mosaicing/merge.c libvips/mosaicing/mosaic1.c libvips/mosaicing/mosaic.c libvips/mosaicing/mosaicing.c +libvips/mosaicing/remosaic.c +libvips/mosaicing/tbmerge.c +libvips/mosaicing/tbmosaic.c libvips/resample/affine.c libvips/resample/bicubic.cpp libvips/resample/interpolate.c