forked from billkarsh/Alignment_Projects
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThumbs.cpp
94 lines (68 loc) · 2.04 KB
/
Thumbs.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include "CGBL_Thumbs.h"
#include "Thumbs.h"
/* --------------------------------------------------------------- */
/* Thumbs -------------------------------------------------------- */
/* --------------------------------------------------------------- */
// Seek transform A->B composed as: Trgd * Tdfm * Tpretwk.
//
// The output is an entry in the ThmPair_lyrA^lyrB.txt file.
//
// Discussion
// ----------
// See notes in ApproximateMatch.cpp.
//
bool Thumbs(
const PixPair &px,
const ConnRegion &acr,
const ConnRegion &bcr,
FILE* flog )
{
/* ------------------- */
/* Handle bypass modes */
/* ------------------- */
if( GBL.ctx.MODE == 'E' || GBL.ctx.MODE == 'F' )
return true;
/* ------------------- */
/* Handle search modes */
/* ------------------- */
CThmUtil U( GBL.A, acr.id, GBL.B, bcr.id, px,
GBL.Tab, GBL.ctx.OLAP2D, flog );
U.SetParams(
GBL.ctx.HFANGDN, GBL.ctx.HFANGPR, GBL.ctx.RTRSH,
GBL.ctx.OLAP1D, GBL.ctx.MODE, GBL.ctx.LIMXY,
GBL.mch.WTHMPR );
CThmScan S;
CorRec best;
S.Initialize( flog, best );
S.SetTdfm( GBL.ctx.Tdfm );
S.SetRThresh( GBL.ctx.RTRSH );
S.SetNbMaxHt( GBL.ctx.NBMXHT );
S.SetSweepConstXY( true );
S.SetSweepPretweak( GBL.mch.PRETWEAK );
S.SetUseCorrR( true );
S.SetDisc( 0, 0, -1, -1 );
/* ----------------------- */
/* Create image thumbnails */
/* ----------------------- */
OlapRec olp;
ThmRec thm;
int nPriorAngles = U.SetStartingAngle(
GBL.ctx.Tdfm, GBL.arg.CTR );
if( !U.Crop( olp, acr, bcr, GBL.ctx.XYCONF ) )
return false;
if( !U.MakeThumbs( thm, olp, GBL.ctx.THMDEC ) )
return false;
/* ------ */
/* Search */
/* ------ */
if( GBL.ctx.MODE == 'N' ) {
if( !U.Disc( best, S, thm, olp, GBL.mch.PRETWEAK ) )
return false;
}
else if( !U.Sweep( best, S, thm, nPriorAngles ) )
return false;
/* ------ */
/* Finish */
/* ------ */
return U.Finish( best, S, thm, olp, GBL.mch.TWEAKS );
}