1IM_LRMOSAIC(3) Library Functions Manual IM_LRMOSAIC(3)
2
3
4
6 im_lrmosaic, im_tbmosaic - mosaic two images using a zero order proce‐
7 dure
8
10 #include <vips/vips.h>
11
12 int
13 im_lrmosaic( IMAGE *ref, IMAGE *sec, IMAGE *out,
14 int bandno,
15 int xref, int yref, int xsec, int ysec,
16 int halfcorrelation, int halfarea,
17 int balancetype,
18 int mwidth )
19
20 int
21 im_tbmosaic( IMAGE *ref, IMAGE *sec, IMAGE *out,
22 int bandno,
23 int xref, int yref, int xsec, int ysec,
24 int halfcorrelation, int halfarea,
25 int balancetype,
26 int mwidth )
27
28
30 im_lrmosaic() and im_tbmosaic() are used to mosaic two images (left-
31 right and top-bottom respectively). Both input images are held by the
32 IMAGE descriptors reference and secondary whereas the output is written
33 on the IMAGE descriptor out.
34
35 In order to carry out mosaicing, the coordinates of one tie point are
36 required. The tie point is expected to be in the overlapping area and
37 has coordinates (xref, yref) on the reference image and (xsec, ysec) on
38 the secondary image. The tie-point is not used as a start point for the
39 search, but is used to specify the overlap of the two images.
40
41 The functions split the overlap area into three parts (top, middle and
42 bottom; or left, middle and right) and search the reference image in
43 each part for the 20 best high contrast points. These 60 points are
44 then searched for in the secondary image, giving a set of 60 possible
45 corrected vectors.
46
47 A straight line is fitted through the 60 vectors, and points discarded
48 which lie a significant distance from the line. The line is then refit‐
49 ted to the remaining points, and the process repeated until either all
50 remaining points lie on a straight line, or too many points have been
51 discarded.
52
53 If a good straight line fit is found, ref and sec are joined. If no fit
54 was found, the functions fail with an error message. Note that these
55 functions detect rotation: if the straight line found requires sec to
56 be rotated, they also fail with an error message.
57
58 Each function requires three more parameters:
59
60 halfcorrelationsize - sets the size of the fragments of ref
61 for which the function searches sec. The actual window
62 will be of size 2*halfcorrelationsize+1. We recommend a
63 value of 5.
64
65 halfareasize - sets the size of the area of sec that is
66 searched. The actual area searched will be of size
67 2*halfareasize+1. We recommend a value of 14.
68
69 balancetype - sets the style of the balancing the functions
70 perform. Balancing finds the average value of pixels in
71 the overlap area, and scales the left and right images
72 (or top and bottom images) so as to make the images
73 match in average overlap. Possible values are:
74
75 0 - means do no balancing.
76
77 1 - means keep the left image unadjusted and adjust
78 the contrast of the right image to match the left.
79
80 2 - means keep the right image unadjusted and scale
81 the left image to match it.
82
83 3 - means adjust the contrast of both the left and
84 right images to bring both averages to a middle
85 value. The middle value chosen is weighted by the
86 number of pixels in each image: large images will be
87 adjusted less than small images.
88
89 Balancing is useful for mosaicing frames from photographic or video
90 sources where exact colour control is impossible and exposure varies
91 from frame to frame. Balancing is only allowed for uncoded uchar
92 images.
93
94 The final "mwidth" parameter sets the maximum blend width, see
95 im_lrmerge(3).
96
97 See also im_global_balance() for a better way of balancing large
98 mosaics.
99
100
102 All functions return 0 on success and -1 on error.
103
105 im_lrmerge(3), im_tbmerge(3), im_global_balance(3).
106
107
108
109 13 May 1991 IM_LRMOSAIC(3)