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 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 ) );
}

View File

@ -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*/

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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 ) )

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
* 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 );

View File

@ -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.
*

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 *,
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)

View File

@ -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,

View File

@ -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