1 /* Function dispatch tables for mosaicing.
2  *
3  * J. Cupitt, 23/2/95
4  */
5 
6 /*
7 
8     This file is part of VIPS.
9 
10     VIPS is free software; you can redistribute it and/or modify
11     it under the terms of the GNU Lesser General Public License as published by
12     the Free Software Foundation; either version 2 of the License, or
13     (at your option) any later version.
14 
15     This program is distributed in the hope that it will be useful,
16     but WITHOUT ANY WARRANTY; without even the implied warranty of
17     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18     GNU Lesser General Public License for more details.
19 
20     You should have received a copy of the GNU Lesser General Public License
21     along with this program; if not, write to the Free Software
22     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23     02110-1301  USA
24 
25  */
26 
27 /*
28 
29     These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
30 
31  */
32 
33 #ifdef HAVE_CONFIG_H
34 #include <config.h>
35 #endif /*HAVE_CONFIG_H*/
36 #include <vips/intl.h>
37 
38 #include <stdio.h>
39 
40 #include <vips/vips.h>
41 #include <vips/vips7compat.h>
42 #include <vips/internal.h>
43 #include <vips/transform.h>
44 
45 /* Merge args.
46  */
47 static im_arg_desc merge_args[] = {
48 	IM_INPUT_IMAGE( "ref" ),
49 	IM_INPUT_IMAGE( "sec" ),
50 	IM_OUTPUT_IMAGE( "out" ),
51 	IM_INPUT_INT( "dx" ),
52 	IM_INPUT_INT( "dy" ),
53 	IM_INPUT_INT( "mwidth" )
54 };
55 
56 /* Merge1 args.
57  */
58 static im_arg_desc merge1_args[] = {
59 	IM_INPUT_IMAGE( "ref" ),
60 	IM_INPUT_IMAGE( "sec" ),
61 	IM_OUTPUT_IMAGE( "out" ),
62 	IM_INPUT_INT( "xr1" ),
63 	IM_INPUT_INT( "yr1" ),
64 	IM_INPUT_INT( "xs1" ),
65 	IM_INPUT_INT( "ys1" ),
66 	IM_INPUT_INT( "xr2" ),
67 	IM_INPUT_INT( "yr2" ),
68 	IM_INPUT_INT( "xs2" ),
69 	IM_INPUT_INT( "ys2" ),
70 	IM_INPUT_INT( "mwidth" )
71 };
72 
73 /* Mosaic args.
74  */
75 static im_arg_desc mosaic_args[] = {
76 	IM_INPUT_IMAGE( "ref" ),
77 	IM_INPUT_IMAGE( "sec" ),
78 	IM_OUTPUT_IMAGE( "out" ),
79 	IM_INPUT_INT( "bandno" ),
80 	IM_INPUT_INT( "xr" ),
81 	IM_INPUT_INT( "yr" ),
82 	IM_INPUT_INT( "xs" ),
83 	IM_INPUT_INT( "ys" ),
84 	IM_INPUT_INT( "halfcorrelation" ),
85 	IM_INPUT_INT( "halfarea" ),
86 	IM_INPUT_INT( "balancetype" ),
87 	IM_INPUT_INT( "mwidth" )
88 };
89 
90 /* Mosaic1 args.
91  */
92 static im_arg_desc mosaic1_args[] = {
93 	IM_INPUT_IMAGE( "ref" ),
94 	IM_INPUT_IMAGE( "sec" ),
95 	IM_OUTPUT_IMAGE( "out" ),
96 	IM_INPUT_INT( "bandno" ),
97 	IM_INPUT_INT( "xr1" ),
98 	IM_INPUT_INT( "yr1" ),
99 	IM_INPUT_INT( "xs1" ),
100 	IM_INPUT_INT( "ys1" ),
101 	IM_INPUT_INT( "xr2" ),
102 	IM_INPUT_INT( "yr2" ),
103 	IM_INPUT_INT( "xs2" ),
104 	IM_INPUT_INT( "ys2" ),
105 	IM_INPUT_INT( "halfcorrelation" ),
106 	IM_INPUT_INT( "halfarea" ),
107 	IM_INPUT_INT( "balancetype" ),
108 	IM_INPUT_INT( "mwidth" )
109 };
110 
111 /* Call im_lrmosaic via arg vector.
112  */
113 static int
lrmosaic_vec(im_object * argv)114 lrmosaic_vec( im_object *argv )
115 {
116 	int bandno = *((int *) argv[3]);
117 	int xr = *((int *) argv[4]);
118 	int yr = *((int *) argv[5]);
119 	int xs = *((int *) argv[6]);
120 	int ys = *((int *) argv[7]);
121 	int halfcorrelation = *((int *) argv[8]);
122 	int halfarea = *((int *) argv[9]);
123 	int balancetype = *((int *) argv[10]);
124 	int mwidth = *((int *) argv[11]);
125 
126 	return( vips__lrmosaic( argv[0], argv[1], argv[2],
127 		bandno,
128 		xr, yr, xs, ys,
129 		halfcorrelation, halfarea,
130 		balancetype, mwidth ) );
131 }
132 
133 /* Call im_lrmosaic1 via arg vector.
134  */
135 static int
lrmosaic1_vec(im_object * argv)136 lrmosaic1_vec( im_object *argv )
137 {
138 	int bandno = *((int *) argv[3]);
139 	int xr1 = *((int *) argv[4]);
140 	int yr1 = *((int *) argv[5]);
141 	int xs1 = *((int *) argv[6]);
142 	int ys1 = *((int *) argv[7]);
143 	int xr2 = *((int *) argv[8]);
144 	int yr2 = *((int *) argv[9]);
145 	int xs2 = *((int *) argv[10]);
146 	int ys2 = *((int *) argv[11]);
147 	int halfcorrelation = *((int *) argv[12]);
148 	int halfarea = *((int *) argv[13]);
149 	int balancetype = *((int *) argv[14]);
150 	int mwidth = *((int *) argv[15]);
151 
152 	return( im_lrmosaic1( argv[0], argv[1], argv[2],
153 		bandno,
154 		xr1, yr1, xs1, ys1,
155 		xr2, yr2, xs2, ys2,
156 		halfcorrelation, halfarea,
157 		balancetype, mwidth ) );
158 }
159 
160 /* Description of im_lrmosaic.
161  */
162 static im_function lrmosaic_desc = {
163 	"im_lrmosaic", 			/* Name */
164 	"left-right mosaic of ref and sec",/* Description */
165 	IM_FN_TRANSFORM | IM_FN_PIO,	/* Flags */
166 	lrmosaic_vec, 			/* Dispatch function */
167 	IM_NUMBER( mosaic_args ), 		/* Size of arg list */
168 	mosaic_args 			/* Arg list */
169 };
170 
171 static im_arg_desc find_overlap_args[] = {
172 	IM_INPUT_IMAGE( "ref" ),
173 	IM_INPUT_IMAGE( "sec" ),
174 	IM_INPUT_INT( "bandno" ),
175 	IM_INPUT_INT( "xr" ),
176 	IM_INPUT_INT( "yr" ),
177 	IM_INPUT_INT( "xs" ),
178 	IM_INPUT_INT( "ys" ),
179 	IM_INPUT_INT( "halfcorrelation" ),
180 	IM_INPUT_INT( "halfarea" ),
181 	IM_OUTPUT_INT( "dx0" ),
182 	IM_OUTPUT_INT( "dy0" ),
183 	IM_OUTPUT_DOUBLE( "scale1" ),
184 	IM_OUTPUT_DOUBLE( "angle1" ),
185 	IM_OUTPUT_DOUBLE( "dx1" ),
186 	IM_OUTPUT_DOUBLE( "dy1" )
187 };
188 
189 /* Call im__find_lroverlap via arg vector.
190  */
191 static int
find_lroverlap_vec(im_object * argv)192 find_lroverlap_vec( im_object *argv )
193 {
194 	int bandno = *((int *) argv[2]);
195 	int xr = *((int *) argv[3]);
196 	int yr = *((int *) argv[4]);
197 	int xs = *((int *) argv[5]);
198 	int ys = *((int *) argv[6]);
199 	int halfcorrelation = *((int *) argv[7]);
200 	int halfarea = *((int *) argv[8]);
201 	int *dx0 = (int *) argv[9];
202 	int *dy0 = (int *) argv[10];
203 	double *scale1 = (double *) argv[11];
204 	double *angle1 = (double *) argv[12];
205 	double *dx1 = (double *) argv[13];
206 	double *dy1 = (double *) argv[14];
207 
208 	IMAGE *t;
209 	int result;
210 
211 	if( !(t = im_open( "find_lroverlap_vec", "p" )) )
212 		return( -1 );
213 	result = vips__find_lroverlap( argv[0], argv[1], t,
214 		bandno,
215 		xr, yr, xs, ys,
216 		halfcorrelation, halfarea,
217 		dx0, dy0, scale1, angle1, dx1, dy1 );
218 	im_close( t );
219 
220 	return( result );
221 }
222 
223 /* Description of im__find_lroverlap.
224  */
225 static im_function find_lroverlap_desc = {
226 	"im__find_lroverlap",		/* Name */
227 	"search for left-right overlap of ref and sec",/* Description */
228 	IM_FN_TRANSFORM | IM_FN_PIO,	/* Flags */
229 	find_lroverlap_vec, 		/* Dispatch function */
230 	IM_NUMBER( find_overlap_args ),	/* Size of arg list */
231 	find_overlap_args 		/* Arg list */
232 };
233 
234 /* Description of im_lrmosaic1.
235  */
236 static im_function lrmosaic1_desc = {
237 	"im_lrmosaic1",			/* Name */
238 	"first-order left-right mosaic of ref and sec",/* Description */
239 	IM_FN_TRANSFORM | IM_FN_PIO,	/* Flags */
240 	lrmosaic1_vec, 			/* Dispatch function */
241 	IM_NUMBER( mosaic1_args ), 	/* Size of arg list */
242 	mosaic1_args 			/* Arg list */
243 };
244 
245 /* Call im_tbmosaic via arg vector.
246  */
247 static int
tbmosaic_vec(im_object * argv)248 tbmosaic_vec( im_object *argv )
249 {
250 	int bandno = *((int *) argv[3]);
251 	int x1 = *((int *) argv[4]);
252 	int y1 = *((int *) argv[5]);
253 	int x2 = *((int *) argv[6]);
254 	int y2 = *((int *) argv[7]);
255 	int halfcorrelation = *((int *) argv[8]);
256 	int halfarea = *((int *) argv[9]);
257 	int balancetype = *((int *) argv[10]);
258 	int mwidth = *((int *) argv[11]);
259 
260 	return( vips__tbmosaic( argv[0], argv[1], argv[2],
261 		bandno,
262 		x1, y1, x2, y2,
263 		halfcorrelation, halfarea,
264 		balancetype, mwidth ) );
265 }
266 
267 /* Call im_tbmosaic1 via arg vector.
268  */
269 static int
tbmosaic1_vec(im_object * argv)270 tbmosaic1_vec( im_object *argv )
271 {
272 	int bandno = *((int *) argv[3]);
273 	int xr1 = *((int *) argv[4]);
274 	int yr1 = *((int *) argv[5]);
275 	int xs1 = *((int *) argv[6]);
276 	int ys1 = *((int *) argv[7]);
277 	int xr2 = *((int *) argv[8]);
278 	int yr2 = *((int *) argv[9]);
279 	int xs2 = *((int *) argv[10]);
280 	int ys2 = *((int *) argv[11]);
281 	int halfcorrelation = *((int *) argv[12]);
282 	int halfarea = *((int *) argv[13]);
283 	int balancetype = *((int *) argv[14]);
284 	int mwidth = *((int *) argv[15]);
285 
286 	return( im_tbmosaic1( argv[0], argv[1], argv[2],
287 		bandno,
288 		xr1, yr1, xs1, ys1,
289 		xr2, yr2, xs2, ys2,
290 		halfcorrelation, halfarea,
291 		balancetype, mwidth ) );
292 }
293 
294 /* Call im__find_tboverlap via arg vector.
295  */
296 static int
find_tboverlap_vec(im_object * argv)297 find_tboverlap_vec( im_object *argv )
298 {
299 	int bandno = *((int *) argv[2]);
300 	int xr = *((int *) argv[3]);
301 	int yr = *((int *) argv[4]);
302 	int xs = *((int *) argv[5]);
303 	int ys = *((int *) argv[6]);
304 	int halfcorrelation = *((int *) argv[7]);
305 	int halfarea = *((int *) argv[8]);
306 	int *dx0 = (int *) argv[9];
307 	int *dy0 = (int *) argv[10];
308 	double *scale1 = (double *) argv[11];
309 	double *angle1 = (double *) argv[12];
310 	double *dx1 = (double *) argv[13];
311 	double *dy1 = (double *) argv[14];
312 
313 	IMAGE *t;
314 	int result;
315 
316 	if( !(t = im_open( "find_tboverlap_vec", "p" )) )
317 		return( -1 );
318 	result = vips__find_tboverlap( argv[0], argv[1], t,
319 		bandno,
320 		xr, yr, xs, ys,
321 		halfcorrelation, halfarea,
322 		dx0, dy0, scale1, angle1, dx1, dy1 );
323 	im_close( t );
324 
325 	return( result );
326 }
327 
328 /* Description of im__find_tboverlap.
329  */
330 static im_function find_tboverlap_desc = {
331 	"im__find_tboverlap",		/* Name */
332 	"search for top-bottom overlap of ref and sec",/* Description */
333 	IM_FN_TRANSFORM | IM_FN_PIO,	/* Flags */
334 	find_tboverlap_vec, 		/* Dispatch function */
335 	IM_NUMBER( find_overlap_args ),	/* Size of arg list */
336 	find_overlap_args 		/* Arg list */
337 };
338 
339 /* Description of im_tbmosaic.
340  */
341 static im_function tbmosaic_desc = {
342 	"im_tbmosaic", 			/* Name */
343 	"top-bottom mosaic of in1 and in2",/* Description */
344 	IM_FN_TRANSFORM | IM_FN_PIO,	/* Flags */
345 	tbmosaic_vec, 			/* Dispatch function */
346 	IM_NUMBER( mosaic_args ), 		/* Size of arg list */
347 	mosaic_args 			/* Arg list */
348 };
349 
350 /* Description of im_tbmosaic1.
351  */
352 static im_function tbmosaic1_desc = {
353 	"im_tbmosaic1",			/* Name */
354 	"first-order top-bottom mosaic of ref and sec",/* Description */
355 	IM_FN_TRANSFORM | IM_FN_PIO,	/* Flags */
356 	tbmosaic1_vec, 			/* Dispatch function */
357 	IM_NUMBER( mosaic1_args ), 	/* Size of arg list */
358 	mosaic1_args 			/* Arg list */
359 };
360 
361 /* Call im_lrmerge via arg vector.
362  */
363 static int
lrmerge_vec(im_object * argv)364 lrmerge_vec( im_object *argv )
365 {
366 	int dx = *((int *) argv[3]);
367 	int dy = *((int *) argv[4]);
368 	int mwidth = *((int *) argv[5]);
369 
370 	return( im_lrmerge( argv[0], argv[1], argv[2], dx, dy, mwidth ) );
371 }
372 
373 /* Call im_lrmerge1 via arg vector.
374  */
375 static int
lrmerge1_vec(im_object * argv)376 lrmerge1_vec( im_object *argv )
377 {
378 	int xr1 = *((int *) argv[3]);
379 	int yr1 = *((int *) argv[4]);
380 	int xs1 = *((int *) argv[5]);
381 	int ys1 = *((int *) argv[6]);
382 	int xr2 = *((int *) argv[7]);
383 	int yr2 = *((int *) argv[8]);
384 	int xs2 = *((int *) argv[9]);
385 	int ys2 = *((int *) argv[10]);
386 	int mwidth = *((int *) argv[11]);
387 
388 	return( im_lrmerge1( argv[0], argv[1], argv[2],
389 		xr1, yr1, xs1, ys1,
390 		xr2, yr2, xs2, ys2, mwidth ) );
391 }
392 
393 /* Description of im_lrmerge.
394  */
395 static im_function lrmerge_desc = {
396 	"im_lrmerge", 			/* Name */
397 	"left-right merge of in1 and in2",/* Description */
398 	IM_FN_TRANSFORM | IM_FN_PIO,	/* Flags */
399 	lrmerge_vec, 			/* Dispatch function */
400 	IM_NUMBER( merge_args ), 		/* Size of arg list */
401 	merge_args 			/* Arg list */
402 };
403 
404 /* Description of im_lrmerge1.
405  */
406 static im_function lrmerge1_desc = {
407 	"im_lrmerge1", 			/* Name */
408 	"first-order left-right merge of ref and sec",/* Description */
409 	IM_FN_TRANSFORM | IM_FN_PIO,	/* Flags */
410 	lrmerge1_vec, 			/* Dispatch function */
411 	IM_NUMBER( merge1_args ), 		/* Size of arg list */
412 	merge1_args 			/* Arg list */
413 };
414 
415 /* Call im_tbmerge via arg vector.
416  */
417 static int
tbmerge_vec(im_object * argv)418 tbmerge_vec( im_object *argv )
419 {
420 	int dx = *((int *) argv[3]);
421 	int dy = *((int *) argv[4]);
422 	int mwidth = *((int *) argv[5]);
423 
424 	return( im_tbmerge( argv[0], argv[1], argv[2], dx, dy, mwidth ) );
425 }
426 
427 /* Call im_tbmerge1 via arg vector.
428  */
429 static int
tbmerge1_vec(im_object * argv)430 tbmerge1_vec( im_object *argv )
431 {
432 	int xr1 = *((int *) argv[3]);
433 	int yr1 = *((int *) argv[4]);
434 	int xs1 = *((int *) argv[5]);
435 	int ys1 = *((int *) argv[6]);
436 	int xr2 = *((int *) argv[7]);
437 	int yr2 = *((int *) argv[8]);
438 	int xs2 = *((int *) argv[9]);
439 	int ys2 = *((int *) argv[10]);
440 	int mwidth = *((int *) argv[11]);
441 
442 	return( im_tbmerge1( argv[0], argv[1], argv[2],
443 		xr1, yr1, xs1, ys1,
444 		xr2, yr2, xs2, ys2, mwidth ) );
445 }
446 
447 /* Description of im_tbmerge.
448  */
449 static im_function tbmerge_desc = {
450 	"im_tbmerge", 			/* Name */
451 	"top-bottom merge of in1 and in2",/* Description */
452 	IM_FN_TRANSFORM | IM_FN_PIO,	/* Flags */
453 	tbmerge_vec, 			/* Dispatch function */
454 	IM_NUMBER( merge_args ), 		/* Size of arg list */
455 	merge_args 			/* Arg list */
456 };
457 
458 /* Description of im_tbmerge1.
459  */
460 static im_function tbmerge1_desc = {
461 	"im_tbmerge1", 			/* Name */
462 	"first-order top-bottom merge of in1 and in2",/* Description */
463 	IM_FN_TRANSFORM | IM_FN_PIO,	/* Flags */
464 	tbmerge1_vec, 			/* Dispatch function */
465 	IM_NUMBER( merge1_args ), 		/* Size of arg list */
466 	merge1_args 			/* Arg list */
467 };
468 
469 /* match_linear args
470  */
471 static im_arg_desc match_linear_args[] = {
472 	IM_INPUT_IMAGE( "ref" ),
473 	IM_INPUT_IMAGE( "sec" ),
474 	IM_OUTPUT_IMAGE( "out" ),
475 	IM_INPUT_INT( "xref1" ),
476 	IM_INPUT_INT( "yref1" ),
477 	IM_INPUT_INT( "xsec1" ),
478 	IM_INPUT_INT( "ysec1" ),
479 	IM_INPUT_INT( "xref2" ),
480 	IM_INPUT_INT( "yref2" ),
481 	IM_INPUT_INT( "xsec2" ),
482 	IM_INPUT_INT( "ysec2" )
483 };
484 
485 /* Call im_match_linear via arg vector.
486  */
487 static int
match_linear_vec(im_object * argv)488 match_linear_vec( im_object *argv )
489 {
490 	int xref1 = *((int *) argv[3]);
491 	int yref1 = *((int *) argv[4]);
492 	int xsec1 = *((int *) argv[5]);
493 	int ysec1 = *((int *) argv[6]);
494 	int xref2 = *((int *) argv[7]);
495 	int yref2 = *((int *) argv[8]);
496 	int xsec2 = *((int *) argv[9]);
497 	int ysec2 = *((int *) argv[10]);
498 
499 	return( im_match_linear( argv[0], argv[1], argv[2],
500 		xref1, yref1, xsec1, ysec1,
501 		xref2, yref2, xsec2, ysec2 ) );
502 }
503 
504 /* Description of im_match_linear.
505  */
506 static im_function match_linear_desc = {
507 	"im_match_linear", 		/* Name */
508 	"resample ref so that tie-points match",
509 	IM_FN_PIO,			/* Flags */
510 	match_linear_vec, 		/* Dispatch function */
511 	IM_NUMBER( match_linear_args ), 	/* Size of arg list */
512 	match_linear_args 		/* Arg list */
513 };
514 
515 /* match_linear_search args
516  */
517 static im_arg_desc match_linear_search_args[] = {
518 	IM_INPUT_IMAGE( "ref" ),
519 	IM_INPUT_IMAGE( "sec" ),
520 	IM_OUTPUT_IMAGE( "out" ),
521 	IM_INPUT_INT( "xref1" ),
522 	IM_INPUT_INT( "yref1" ),
523 	IM_INPUT_INT( "xsec1" ),
524 	IM_INPUT_INT( "ysec1" ),
525 	IM_INPUT_INT( "xref2" ),
526 	IM_INPUT_INT( "yref2" ),
527 	IM_INPUT_INT( "xsec2" ),
528 	IM_INPUT_INT( "ysec2" ),
529 	IM_INPUT_INT( "hwindowsize" ),
530 	IM_INPUT_INT( "hsearchsize" )
531 };
532 
533 /* Call im_match_linear_search via arg vector.
534  */
535 static int
match_linear_search_vec(im_object * argv)536 match_linear_search_vec( im_object *argv )
537 {
538 	int xref1 = *((int *) argv[3]);
539 	int yref1 = *((int *) argv[4]);
540 	int xsec1 = *((int *) argv[5]);
541 	int ysec1 = *((int *) argv[6]);
542 	int xref2 = *((int *) argv[7]);
543 	int yref2 = *((int *) argv[8]);
544 	int xsec2 = *((int *) argv[9]);
545 	int ysec2 = *((int *) argv[10]);
546 	int hwin = *((int *) argv[11]);
547 	int hsrch = *((int *) argv[12]);
548 
549 	return( im_match_linear_search( argv[0], argv[1], argv[2],
550 		xref1, yref1, xsec1, ysec1,
551 		xref2, yref2, xsec2, ysec2,
552 		hwin, hsrch ) );
553 }
554 
555 /* Description of im_match_linear_search.
556  */
557 static im_function match_linear_search_desc = {
558 	"im_match_linear_search", 	/* Name */
559 	"search sec, then resample so that tie-points match",
560 	IM_FN_PIO,			/* Flags */
561 	match_linear_search_vec, 	/* Dispatch function */
562 	IM_NUMBER( match_linear_search_args ),/* Size of arg list */
563 	match_linear_search_args 	/* Arg list */
564 };
565 
566 /* correl args
567  */
568 static im_arg_desc correl_args[] = {
569 	IM_INPUT_IMAGE( "ref" ),
570 	IM_INPUT_IMAGE( "sec" ),
571 	IM_INPUT_INT( "xref" ),
572 	IM_INPUT_INT( "yref" ),
573 	IM_INPUT_INT( "xsec" ),
574 	IM_INPUT_INT( "ysec" ),
575 	IM_INPUT_INT( "hwindowsize" ),
576 	IM_INPUT_INT( "hsearchsize" ),
577 	IM_OUTPUT_DOUBLE( "correlation" ),
578 	IM_OUTPUT_INT( "x" ),
579 	IM_OUTPUT_INT( "y" )
580 };
581 
582 /* Call im_correl via arg vector.
583  */
584 static int
correl_vec(im_object * argv)585 correl_vec( im_object *argv )
586 {
587 	int xref = *((int *) argv[2]);
588 	int yref = *((int *) argv[3]);
589 	int xsec = *((int *) argv[4]);
590 	int ysec = *((int *) argv[5]);
591 	int cor = *((int *) argv[6]);
592 	int area = *((int *) argv[7]);
593 	int *x = (int *) argv[8];
594 	int *y = (int *) argv[9];
595 	double *correlation = (double *) argv[10];
596 
597 	return( vips__correl( argv[0], argv[1],
598 		xref, yref, xsec, ysec, cor, area, correlation, x, y ) );
599 }
600 
601 /* Description of im_correl.
602  */
603 static im_function correl_desc = {
604 	"im_correl", 			/* Name */
605 	"search area around sec for match for area around ref",
606 	IM_FN_PIO,			/* Flags */
607 	correl_vec, 			/* Dispatch function */
608 	IM_NUMBER( correl_args ), 		/* Size of arg list */
609 	correl_args 			/* Arg list */
610 };
611 
612 /* global_balance args
613  */
614 static im_arg_desc global_balance_args[] = {
615 	IM_INPUT_IMAGE( "in" ),
616 	IM_OUTPUT_IMAGE( "out" ),
617 	IM_INPUT_DOUBLE( "gamma" )
618 };
619 
620 /* Call im_global_balance via arg vector.
621  */
622 static int
global_balance_vec(im_object * argv)623 global_balance_vec( im_object *argv )
624 {
625 	double gamma = *((double *) argv[2]);
626 
627 	return( im_global_balance( argv[0], argv[1], gamma ) );
628 }
629 
630 /* Description of im_global_balance.
631  */
632 static im_function global_balance_desc = {
633 	"im_global_balance",		/* Name */
634 	"automatically rebuild mosaic with balancing",
635 	IM_FN_TRANSFORM | IM_FN_PIO,	/* Flags */
636 	global_balance_vec, 		/* Dispatch function */
637 	IM_NUMBER( global_balance_args ),	/* Size of arg list */
638 	global_balance_args 		/* Arg list */
639 };
640 
641 /* Call im_global_balancef via arg vector.
642  */
643 static int
global_balancef_vec(im_object * argv)644 global_balancef_vec( im_object *argv )
645 {
646 	double gamma = *((double *) argv[2]);
647 
648 	return( im_global_balancef( argv[0], argv[1], gamma ) );
649 }
650 
651 /* Description of im_global_balancef.
652  */
653 static im_function global_balancef_desc = {
654 	"im_global_balancef",		/* Name */
655 	"automatically rebuild mosaic with balancing, float output",
656 	IM_FN_TRANSFORM | IM_FN_PIO,	/* Flags */
657 	global_balancef_vec, 		/* Dispatch function */
658 	IM_NUMBER( global_balance_args ),	/* Size of arg list */
659 	global_balance_args 		/* Arg list */
660 };
661 
662 /* remosaic args
663  */
664 static im_arg_desc remosaic_args[] = {
665 	IM_INPUT_IMAGE( "in" ),
666 	IM_OUTPUT_IMAGE( "out" ),
667 	IM_INPUT_STRING( "old_str" ),
668 	IM_INPUT_STRING( "new_str" )
669 };
670 
671 /* Call im_remosaic via arg vector.
672  */
673 static int
remosaic_vec(im_object * argv)674 remosaic_vec( im_object *argv )
675 {
676 	return( im_remosaic( argv[0], argv[1], argv[2], argv[3] ) );
677 }
678 
679 /* Description of im_remosaic.
680  */
681 static im_function remosaic_desc = {
682 	"im_remosaic",		/* Name */
683 	"automatically rebuild mosaic with new files",
684 	IM_FN_TRANSFORM | IM_FN_PIO,	/* Flags */
685 	remosaic_vec, 		/* Dispatch function */
686 	IM_NUMBER( remosaic_args ),/* Size of arg list */
687 	remosaic_args 		/* Arg list */
688 };
689 
align_bands_vec(im_object * argv)690 static int align_bands_vec( im_object *argv ){
691   return im_align_bands( (IMAGE*)argv[0], (IMAGE*)argv[1] );
692 }
693 
694 static im_arg_desc align_bands_arg_types[]= {
695   IM_INPUT_IMAGE( "in" ),
696   IM_OUTPUT_IMAGE( "out" )
697 };
698 
699 static im_function align_bands_desc= {
700   "im_align_bands",
701   "align the bands of an image",
702   0,
703   align_bands_vec,
704   IM_NUMBER( align_bands_arg_types ),
705   align_bands_arg_types
706 };
707 
maxpos_subpel_vec(im_object * argv)708 static int maxpos_subpel_vec( im_object *argv ){
709   return im_maxpos_subpel( (IMAGE*)argv[0], (double*)argv[1], (double*)argv[2] );
710 }
711 
712 static im_arg_desc maxpos_subpel_arg_types[]= {
713   IM_INPUT_IMAGE( "im" ),
714   IM_OUTPUT_DOUBLE( "x" ),
715   IM_OUTPUT_DOUBLE( "y" )
716 };
717 
718 static im_function maxpos_subpel_desc= {
719   "im_maxpos_subpel",
720   "subpixel position of maximum of (phase correlation) image",
721   IM_FN_PIO,
722   maxpos_subpel_vec,
723   IM_NUMBER( maxpos_subpel_arg_types ),
724   maxpos_subpel_arg_types
725 };
726 
727 /* Package up all these functions.
728  */
729 static im_function *mos_list[] = {
730         &align_bands_desc,
731 	&correl_desc,
732 	&find_lroverlap_desc,
733 	&find_tboverlap_desc,
734 	&global_balance_desc,
735 	&global_balancef_desc,
736 	&lrmerge_desc,
737 	&lrmerge1_desc,
738 	&lrmosaic_desc,
739 	&lrmosaic1_desc,
740 	&match_linear_desc,
741 	&match_linear_search_desc,
742         &maxpos_subpel_desc,
743 	&remosaic_desc,
744 	&tbmerge_desc,
745 	&tbmerge1_desc,
746 	&tbmosaic_desc,
747 	&tbmosaic1_desc
748 };
749 
750 /* Package of functions.
751  */
752 im_package im__mosaicing = {
753 	"mosaicing",
754 	IM_NUMBER( mos_list ),
755 	mos_list
756 };
757