forked from tpgit/Leptonica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaffine_8c.html
1386 lines (1273 loc) · 96.3 KB
/
affine_8c.html
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Leptonica: src/affine.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<script type="text/javascript">
function hasClass(ele,cls) {
return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
if (hasClass(ele,cls)) {
var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
ele.className=ele.className.replace(reg,' ');
}
}
function toggleVisibility(linkObj) {
var base = linkObj.getAttribute('id');
var summary = document.getElementById(base + '-summary');
var content = document.getElementById(base + '-content');
var trigger = document.getElementById(base + '-trigger');
if ( hasClass(linkObj,'closed') ) {
summary.style.display = 'none';
content.style.display = 'block';
trigger.src = 'open.png';
removeClass(linkObj,'closed');
addClass(linkObj,'opened');
} else if ( hasClass(linkObj,'opened') ) {
summary.style.display = 'block';
content.style.display = 'none';
trigger.src = 'closed.png';
removeClass(linkObj,'opened');
addClass(linkObj,'closed');
}
return false;
}
</script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="moller52-tiny.jpg"></td>
<td style="padding-left: 0.5em;">
<div id="projectname">Leptonica <span id="projectnumber">1.68</span></div>
<div id="projectbrief">C Image Processing Library</div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="dirs.html"><span>Directories</span></a></li>
<li id="searchli">
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
initNavTree('affine_8c.html','');
</script>
<div id="doc-content">
<div class="header">
<div class="summary">
<a href="#define-members">Defines</a> |
<a href="#func-members">Functions</a> |
<a href="#var-members">Variables</a> </div>
<div class="headertitle">
<h1>affine.c File Reference</h1> </div>
</div>
<div class="contents">
<p>3-pt affine transforms on images and coordinates, with sampling and interpolation; gauss-jordan solver
<a href="#_details">More...</a></p>
<div class="textblock"><code>#include <stdio.h></code><br/>
<code>#include <stdlib.h></code><br/>
<code>#include <string.h></code><br/>
<code>#include <math.h></code><br/>
<code>#include "<a class="el" href="allheaders_8h_source.html">allheaders.h</a>"</code><br/>
</div>
<p><a href="affine_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#ad72dbcf6d0153db1b8d8a58001feed83">DEBUG</a>   0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#aac9153aee4bdb92701df902e06a74eb3">SWAP</a>(a, b)   {temp = (a); (a) = (b); (b) = temp;}</td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#a8e84c9c625b81eaa272a78ba32b2a7ea">pixAffineSampledPta</a> (<a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="struct_pta.html">PTA</a> *ptad, <a class="el" href="struct_pta.html">PTA</a> *ptas, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> incolor)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#ab761f82134e4973ba70bb7d5bdb62542">pixAffineSampled</a> (<a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> *vc, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> incolor)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#a2264192bf053eccba3233b9840590d6e">pixAffinePta</a> (<a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="struct_pta.html">PTA</a> *ptad, <a class="el" href="struct_pta.html">PTA</a> *ptas, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> incolor)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#a6d86935bd696bd2431cd17136771c519">pixAffine</a> (<a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> *vc, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> incolor)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#aed5a65a5f747035b9aad508afac6f67d">pixAffinePtaColor</a> (<a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="struct_pta.html">PTA</a> *ptad, <a class="el" href="struct_pta.html">PTA</a> *ptas, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> colorval)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#a06d77d39bbd430ce000f88b7302d17b4">pixAffineColor</a> (<a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> *vc, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> colorval)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#a5f2ec4d911f8f0388cc40ecf48cd0645">pixAffinePtaGray</a> (<a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="struct_pta.html">PTA</a> *ptad, <a class="el" href="struct_pta.html">PTA</a> *ptas, <a class="el" href="environ_8h.html#a7ed60554e7d6dd89aca643189b1e70ad">l_uint8</a> grayval)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#a58c3e8f9e6e6d33e074aecfbbc1d310a">pixAffineGray</a> (<a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> *vc, <a class="el" href="environ_8h.html#a7ed60554e7d6dd89aca643189b1e70ad">l_uint8</a> grayval)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#afd63168e13d35247c9e21d6e59f09567">pixAffinePtaWithAlpha</a> (<a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="struct_pta.html">PTA</a> *ptad, <a class="el" href="struct_pta.html">PTA</a> *ptas, <a class="el" href="struct_pix.html">PIX</a> *pixg, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> fract, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> border)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#ac11c1ec1133dc6625c6c589bf4d54663">pixAffinePtaGammaXform</a> (<a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> gamma, <a class="el" href="struct_pta.html">PTA</a> *ptad, <a class="el" href="struct_pta.html">PTA</a> *ptas, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> fract, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> border)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#a6dbd9d7ffdcb98cb9bdeb3d1ca67e4c4">getAffineXformCoeffs</a> (<a class="el" href="struct_pta.html">PTA</a> *ptas, <a class="el" href="struct_pta.html">PTA</a> *ptad, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> **pvc)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#a4bec7268ce4521fcc08cb33b5e5c1c4a">affineInvertXform</a> (<a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> *vc, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> **pvci)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#adf6502edf7823f552db9236cba693dc3">affineXformSampledPt</a> (<a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> *vc, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> x, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> y, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> *pxp, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> *pyp)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#a71dfee95a587378a161c3a6f1e3a1c30">affineXformPt</a> (<a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> *vc, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> x, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> y, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> *pxp, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> *pyp)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#a460ad002ec6dc77f3646d19211c64e87">linearInterpolatePixelColor</a> (<a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> *datas, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> wpls, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> w, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> h, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> x, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> y, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> colorval, <a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> *pval)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#a8ba4329a3f5411ffe36f8dc180093f5a">linearInterpolatePixelGray</a> (<a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> *datas, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> wpls, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> w, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> h, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> x, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> y, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> grayval, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> *pval)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#a2d74fe926128c1ccde0705ddb807ec12">gaussjordan</a> (<a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> **a, <a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> *b, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> n)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_pix.html">PIX</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#a0df76221b3ccc27bfb5d0e6da35dfd0f">pixAffineSequential</a> (<a class="el" href="struct_pix.html">PIX</a> *pixs, <a class="el" href="struct_pta.html">PTA</a> *ptad, <a class="el" href="struct_pta.html">PTA</a> *ptas, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> bw, <a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> bh)</td></tr>
<tr><td colspan="2"><h2><a name="var-members"></a>
Variables</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="affine_8c.html#a073f1588e24855b59dcdd87afe3b6e6f">AlphaMaskBorderVals</a> [2]</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>3-pt affine transforms on images and coordinates, with sampling and interpolation; gauss-jordan solver </p>
<div class="fragment"><pre class="fragment"> Affine (3 pt) image transformation using a sampled
(to nearest integer) transform on each dest point
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="affine_8c.html#a8e84c9c625b81eaa272a78ba32b2a7ea">pixAffineSampledPta</a>()
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="affine_8c.html#ab761f82134e4973ba70bb7d5bdb62542">pixAffineSampled</a>()
Affine (3 pt) image transformation using interpolation
(or area mapping) for anti-aliasing images that are
2, 4, or 8 bpp gray, or colormapped, or 32 bpp RGB
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="affine_8c.html#a2264192bf053eccba3233b9840590d6e">pixAffinePta</a>()
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="affine_8c.html#a6d86935bd696bd2431cd17136771c519">pixAffine</a>()
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="affine_8c.html#aed5a65a5f747035b9aad508afac6f67d">pixAffinePtaColor</a>()
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="affine_8c.html#a06d77d39bbd430ce000f88b7302d17b4">pixAffineColor</a>()
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="affine_8c.html#a5f2ec4d911f8f0388cc40ecf48cd0645">pixAffinePtaGray</a>()
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="affine_8c.html#a58c3e8f9e6e6d33e074aecfbbc1d310a">pixAffineGray</a>()
Affine transform including alpha (blend) component and gamma transform
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="affine_8c.html#afd63168e13d35247c9e21d6e59f09567">pixAffinePtaWithAlpha</a>()
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="affine_8c.html#ac11c1ec1133dc6625c6c589bf4d54663">pixAffinePtaGammaXform</a>()
Affine coordinate transformation
<a class="code" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> <a class="code" href="affine_8c.html#a6dbd9d7ffdcb98cb9bdeb3d1ca67e4c4">getAffineXformCoeffs</a>()
<a class="code" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> <a class="code" href="affine_8c.html#a4bec7268ce4521fcc08cb33b5e5c1c4a">affineInvertXform</a>()
<a class="code" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> <a class="code" href="affine_8c.html#adf6502edf7823f552db9236cba693dc3">affineXformSampledPt</a>()
<a class="code" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> <a class="code" href="affine_8c.html#a71dfee95a587378a161c3a6f1e3a1c30">affineXformPt</a>()
Interpolation helper functions
<a class="code" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> <a class="code" href="affine_8c.html#a8ba4329a3f5411ffe36f8dc180093f5a">linearInterpolatePixelGray</a>()
<a class="code" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> <a class="code" href="affine_8c.html#a460ad002ec6dc77f3646d19211c64e87">linearInterpolatePixelColor</a>()
Gauss-jordan linear equation solver
<a class="code" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> <a class="code" href="affine_8c.html#a2d74fe926128c1ccde0705ddb807ec12">gaussjordan</a>()
Affine image transformation using a sequence of
shear/scale/translation operations
<a class="code" href="struct_pix.html">PIX</a> *<a class="code" href="affine_8c.html#a0df76221b3ccc27bfb5d0e6da35dfd0f">pixAffineSequential</a>()
One can define a coordinate space by the location of the origin,
the orientation of x and y axes, and the unit scaling along
each axis. An affine transform is a general linear
transformation from one coordinate space to another.
For the general case, we can define the affine transform using
two sets of three (noncollinear) points in a plane. One set
corresponds to the input (src) coordinate space; the other to the
transformed (dest) coordinate space. Each point in the
src corresponds to one of the points in the dest. With two
sets of three points, we get a set of 6 equations in 6 unknowns
that specifies the mapping between the coordinate spaces.
The interface here allows you to specify either the corresponding
sets of 3 points, or the transform itself (as a vector of 6
coefficients).
Given the transform as a vector of 6 coefficients, we can compute
both a a pointwise affine coordinate transformation and an
affine image transformation.
To compute the coordinate transform, we need the coordinate
value (x',y') in the transformed space for any point (x,y)
in the original space. To derive this transform from the
three corresponding points, it is convenient to express the affine
coordinate transformation using an LU decomposition of
a set of six linear equations that express the six coordinates
of the three points in the transformed space as a function of
the six coordinates in the original space. Once we have
this transform matrix , we can transform an image by
finding, for each destination pixel, the pixel (or pixels)
in the source that give rise to it.
This 'pointwise' transformation can be done either by sampling
and picking a single pixel in the src to replicate into the dest,
or by interpolating (or averaging) over four src pixels to
determine the value of the dest pixel. The first method is
implemented by <a class="code" href="affine_8c.html#ab761f82134e4973ba70bb7d5bdb62542">pixAffineSampled</a>() and the second method by
<a class="code" href="affine_8c.html#a6d86935bd696bd2431cd17136771c519">pixAffine</a>(). The interpolated method can only be used for
images with more than 1 bpp, but for these, the image quality
is significantly better than the sampled method, due to
the 'antialiasing' effect of weighting the src pixels.
Interpolation works well when there is relatively little scaling,
or if there is image expansion in general. However, if there
is significant image reduction, one should apply a low-pass
filter before subsampling to avoid aliasing the high frequencies.
A typical application might be to align two images, which
may be scaled, rotated and translated versions of each other.
Through some pre-processing, three corresponding points are
located in each of the two images. One of the images is
then to be (affine) transformed to align with the other.
As mentioned, the standard way to do this is to use three
sets of points, compute the 6 transformation coefficients
from these points that describe the linear transformation,
x' = ax + by + c
y' = dx + ey + f
and use this in a pointwise manner to transform the image.
N.B. Be sure to see the comment in <a class="code" href="affine_8c.html#a6dbd9d7ffdcb98cb9bdeb3d1ca67e4c4">getAffineXformCoeffs</a>(),
regarding using the inverse of the affine transform for points
to transform images.
There is another way to do this transformation; namely,
by doing a sequence of simple affine transforms, without
computing directly the affine coordinate transformation.
We have at our disposal (1) translations (using rasterop),
(2) horizontal and vertical shear about any horizontal and vertical
line, respectively, and (3) non-isotropic scaling by two
arbitrary x and y scaling factors. We also have rotation
about an arbitrary point, but this is equivalent to a set
of three shears so we do not need to use it.
Why might we do this? For binary images, it is usually
more efficient to do such transformations by a sequence
of word parallel operations. Shear and translation can be
done in-place and word parallel; arbitrary scaling is
mostly pixel-wise.
Suppose that we are tranforming image 1 to correspond to image 2.
We have a set of three points, describing the coordinate space
embedded in image 1, and we need to transform image 1 until
those three points exactly correspond to the new coordinate space
defined by the second set of three points. In our image
matching application, the latter set of three points was
found to be the corresponding points in image 2.
The most elegant way I can think of to do such a sequential
implementation is to imagine that we're going to transform
BOTH images until they're aligned. (We don't really want
to transform both, because in fact we may only have one image
that is undergoing a general affine transformation.)
Choose the 3 corresponding points as follows:
- The 1st point is an origin
- The 2nd point gives the orientation and scaling of the
"x" axis with respect to the origin
- The 3rd point does likewise for the "y" axis.
These "axes" must not be collinear; otherwise they are
arbitrary (although some strange things will happen if
the handedness sweeping through the minimum angle between
the axes is opposite).
An important constraint is that we have shear operations
about an arbitrary horizontal or vertical line, but always
parallel to the x or y axis. If we continue to pretend that
we have an unprimed coordinate space embedded in image 1 and
a primed coordinate space embedded in image 2, we imagine
(a) transforming image 1 by horizontal and vertical shears about
point 1 to align points 3 and 2 along the y and x axes,
respectively, and (b) transforming image 2 by horizontal and
vertical shears about point 1' to align points 3' and 2' along
the y and x axes. Then we scale image 1 so that the distances
from 1 to 2 and from 1 to 3 are equal to the distances in
image 2 from 1' to 2' and from 1' to 3'. This scaling operation
leaves the true image origin, at (0,0) invariant, and will in
general translate point 1. The original points 1 and 1' will
typically not coincide in any event, so we must translate
the origin of image 1, at its current point 1, to the origin
of image 2 at 1'. The images should now be aligned. But
because we never really transformed image 2 (and image 2 may
not even exist), we now perform on image 1 the reverse of
the shear transforms that we imagined doing on image 2;
namely, the negative vertical shear followed by the negative
horizontal shear. Image 1 should now have its transformed
unprimed coordinates aligned with the original primed
coordinates. In all this, it is only necessary to keep track
of the shear angles and translations of points during the shears.
What has been accomplished is a general affine transformation
on image 1.
Having described all this, if you are going to use an
affine transformation in an application, this is what you
need to know:
(1) You should NEVER use the sequential method, because
the image quality for 1 bpp text is much poorer
(even though it is about 2x faster than the pointwise sampled
method), and for images with depth greater than 1, it is
nearly 20x slower than the pointwise sampled method
and over 10x slower than the pointwise interpolated method!
The sequential method is given here for purely
pedagogical reasons.
(2) For 1 bpp images, use the pointwise sampled function
<a class="code" href="affine_8c.html#ab761f82134e4973ba70bb7d5bdb62542">pixAffineSampled</a>(). For all other images, the best
quality results result from using the pointwise
interpolated function <a class="code" href="affine_8c.html#a2264192bf053eccba3233b9840590d6e">pixAffinePta</a>() or <a class="code" href="affine_8c.html#a6d86935bd696bd2431cd17136771c519">pixAffine</a>();
the cost is less than a doubling of the computation time
with respect to the sampled function. If you use
interpolation on colormapped images, the colormap will
be removed, resulting in either a grayscale or color
image, depending on the values in the colormap.
If you want to retain the colormap, use <a class="code" href="affine_8c.html#ab761f82134e4973ba70bb7d5bdb62542">pixAffineSampled</a>().
Typical relative timing of pointwise transforms (sampled = 1.0):
8 bpp: sampled 1.0
interpolated 1.6
32 bpp: sampled 1.0
interpolated 1.8
Additionally, the computation time/pixel is nearly the same
for 8 bpp and 32 bpp, for both sampled and interpolated.
</pre></div>
<p>Definition in file <a class="el" href="affine_8c_source.html">affine.c</a>.</p>
</div><hr/><h2>Define Documentation</h2>
<a class="anchor" id="ad72dbcf6d0153db1b8d8a58001feed83"></a><!-- doxytag: member="affine.c::DEBUG" ref="ad72dbcf6d0153db1b8d8a58001feed83" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define DEBUG   0</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="affine_8c_source.html#l00232">232</a> of file <a class="el" href="affine_8c_source.html">affine.c</a>.</p>
</div>
</div>
<a class="anchor" id="aac9153aee4bdb92701df902e06a74eb3"></a><!-- doxytag: member="affine.c::SWAP" ref="aac9153aee4bdb92701df902e06a74eb3" args="(a, b)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define SWAP</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">a, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname">b </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td>   {temp = (a); (a) = (b); (b) = temp;}</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="affine_8c_source.html#l01318">1318</a> of file <a class="el" href="affine_8c_source.html">affine.c</a>.</p>
<p>Referenced by <a class="el" href="affine_8c_source.html#l01337">gaussjordan()</a>.</p>
</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="a8e84c9c625b81eaa272a78ba32b2a7ea"></a><!-- doxytag: member="affine.c::pixAffineSampledPta" ref="a8e84c9c625b81eaa272a78ba32b2a7ea" args="(PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixAffineSampledPta </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pta.html">PTA</a> * </td>
<td class="paramname"><em>ptad</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pta.html">PTA</a> * </td>
<td class="paramname"><em>ptas</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>incolor</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="affine_8c.html#a8e84c9c625b81eaa272a78ba32b2a7ea">pixAffineSampledPta()</a></p>
<p>Input: pixs (all depths) ptad (3 pts of final coordinate space) ptas (3 pts of initial coordinate space) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK) Return: pixd, or null on error</p>
<p>Notes: (1) Brings in either black or white pixels from the boundary. (2) Retains colormap, which you can do for a sampled transform.. (3) The 3 points must not be collinear. (4) The order of the 3 points is arbitrary; however, to compare with the sequential transform they must be in these locations and in this order: origin, x-axis, y-axis. (5) For 1 bpp images, this has much better quality results than <a class="el" href="affine_8c.html#a0df76221b3ccc27bfb5d0e6da35dfd0f">pixAffineSequential()</a>, particularly for text. It is about 3x slower, but does not require additional border pixels. The poor quality of <a class="el" href="affine_8c.html#a0df76221b3ccc27bfb5d0e6da35dfd0f">pixAffineSequential()</a> is due to repeated quantized transforms. It is strongly recommended that <a class="el" href="affine_8c.html#ab761f82134e4973ba70bb7d5bdb62542">pixAffineSampled()</a> be used for 1 bpp images. (6) For 8 or 32 bpp, much better quality is obtained by the somewhat slower <a class="el" href="affine_8c.html#a2264192bf053eccba3233b9840590d6e">pixAffinePta()</a>. See that function for relative timings between sampled and interpolated. (7) To repeat, use of the sequential transform, <a class="el" href="affine_8c.html#a0df76221b3ccc27bfb5d0e6da35dfd0f">pixAffineSequential()</a>, for any images, is discouraged. </p>
<p>Definition at line <a class="el" href="affine_8c_source.html#l00268">268</a> of file <a class="el" href="affine_8c_source.html">affine.c</a>.</p>
<p>References <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="environ_8h_source.html#l00216">FREE</a>, <a class="el" href="affine_8c_source.html#l00954">getAffineXformCoeffs()</a>, <a class="el" href="pix_8h_source.html#l00695">L_BRING_IN_BLACK</a>, <a class="el" href="pix_8h_source.html#l00694">L_BRING_IN_WHITE</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="affine_8c_source.html#l00316">pixAffineSampled()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, and <a class="el" href="ptabasic_8c_source.html#l00346">ptaGetCount()</a>.</p>
<p>Referenced by <a class="el" href="affine__reg_8c_source.html#l00056">main()</a>, and <a class="el" href="affine_8c_source.html#l00411">pixAffinePta()</a>.</p>
</div>
</div>
<a class="anchor" id="ab761f82134e4973ba70bb7d5bdb62542"></a><!-- doxytag: member="affine.c::pixAffineSampled" ref="ab761f82134e4973ba70bb7d5bdb62542" args="(PIX *pixs, l_float32 *vc, l_int32 incolor)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixAffineSampled </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> * </td>
<td class="paramname"><em>vc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>incolor</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="affine_8c.html#ab761f82134e4973ba70bb7d5bdb62542">pixAffineSampled()</a></p>
<p>Input: pixs (all depths) vc (vector of 6 coefficients for affine transformation) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK) Return: pixd, or null on error</p>
<p>Notes: (1) Brings in either black or white pixels from the boundary. (2) Retains colormap, which you can do for a sampled transform.. (3) For 8 or 32 bpp, much better quality is obtained by the somewhat slower <a class="el" href="affine_8c.html#a6d86935bd696bd2431cd17136771c519">pixAffine()</a>. See that function for relative timings between sampled and interpolated. </p>
<p>Definition at line <a class="el" href="affine_8c_source.html#l00316">316</a> of file <a class="el" href="affine_8c_source.html">affine.c</a>.</p>
<p>References <a class="el" href="affine_8c_source.html#l01118">affineXformSampledPt()</a>, <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="arrayaccess_8h_source.html#l00060">GET_DATA_BIT</a>, <a class="el" href="arrayaccess_8h_source.html#l00118">GET_DATA_BYTE</a>, <a class="el" href="arrayaccess_8h_source.html#l00080">GET_DATA_DIBIT</a>, <a class="el" href="arrayaccess_8h_source.html#l00097">GET_DATA_QBIT</a>, <a class="el" href="pix_8h_source.html#l00695">L_BRING_IN_BLACK</a>, <a class="el" href="pix_8h_source.html#l00694">L_BRING_IN_WHITE</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="pix2_8c_source.html#l00598">pixClearAll()</a>, <a class="el" href="colormap_8c_source.html#l00446">pixcmapAddBlackOrWhite()</a>, <a class="el" href="pix1_8c_source.html#l00328">pixCreateTemplate()</a>, <a class="el" href="pix1_8c_source.html#l01288">pixGetColormap()</a>, <a class="el" href="pix1_8c_source.html#l01358">pixGetData()</a>, <a class="el" href="pix1_8c_source.html#l00898">pixGetDimensions()</a>, <a class="el" href="pix1_8c_source.html#l00970">pixGetWpl()</a>, <a class="el" href="pix2_8c_source.html#l00625">pixSetAll()</a>, <a class="el" href="pix2_8c_source.html#l00661">pixSetAllArbitrary()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, <a class="el" href="arrayaccess_8h_source.html#l00069">SET_DATA_BIT_VAL</a>, <a class="el" href="arrayaccess_8h_source.html#l00126">SET_DATA_BYTE</a>, <a class="el" href="arrayaccess_8h_source.html#l00083">SET_DATA_DIBIT</a>, <a class="el" href="arrayaccess_8h_source.html#l00100">SET_DATA_QBIT</a>, <a class="el" href="heap__reg_8c_source.html#l00026">HeapElement::x</a>, and <a class="el" href="heap__reg_8c_source.html#l00027">HeapElement::y</a>.</p>
<p>Referenced by <a class="el" href="affine_8c_source.html#l00479">pixAffine()</a>, and <a class="el" href="affine_8c_source.html#l00268">pixAffineSampledPta()</a>.</p>
</div>
</div>
<a class="anchor" id="a2264192bf053eccba3233b9840590d6e"></a><!-- doxytag: member="affine.c::pixAffinePta" ref="a2264192bf053eccba3233b9840590d6e" args="(PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixAffinePta </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pta.html">PTA</a> * </td>
<td class="paramname"><em>ptad</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pta.html">PTA</a> * </td>
<td class="paramname"><em>ptas</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>incolor</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="affine_8c.html#a2264192bf053eccba3233b9840590d6e">pixAffinePta()</a></p>
<p>Input: pixs (all depths; colormap ok) ptad (3 pts of final coordinate space) ptas (3 pts of initial coordinate space) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK) Return: pixd, or null on error</p>
<p>Notes: (1) Brings in either black or white pixels from the boundary (2) Removes any existing colormap, if necessary, before transforming </p>
<p>Definition at line <a class="el" href="affine_8c_source.html#l00411">411</a> of file <a class="el" href="affine_8c_source.html">affine.c</a>.</p>
<p>References <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="environ_8h_source.html#l00179">FALSE</a>, <a class="el" href="pix_8h_source.html#l00695">L_BRING_IN_BLACK</a>, <a class="el" href="pix_8h_source.html#l00694">L_BRING_IN_WHITE</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="affine_8c_source.html#l00535">pixAffinePtaColor()</a>, <a class="el" href="affine_8c_source.html#l00629">pixAffinePtaGray()</a>, <a class="el" href="affine_8c_source.html#l00268">pixAffineSampledPta()</a>, <a class="el" href="pix1_8c_source.html#l00440">pixClone()</a>, <a class="el" href="pixconv_8c_source.html#l02297">pixConvertTo8()</a>, <a class="el" href="pix1_8c_source.html#l00466">pixDestroy()</a>, <a class="el" href="pix1_8c_source.html#l00863">pixGetDepth()</a>, <a class="el" href="pixconv_8c_source.html#l00223">pixRemoveColormap()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, <a class="el" href="ptabasic_8c_source.html#l00346">ptaGetCount()</a>, and <a class="el" href="pix_8h_source.html#l00181">REMOVE_CMAP_BASED_ON_SRC</a>.</p>
<p>Referenced by <a class="el" href="affine__reg_8c_source.html#l00056">main()</a>.</p>
</div>
</div>
<a class="anchor" id="a6d86935bd696bd2431cd17136771c519"></a><!-- doxytag: member="affine.c::pixAffine" ref="a6d86935bd696bd2431cd17136771c519" args="(PIX *pixs, l_float32 *vc, l_int32 incolor)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixAffine </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> * </td>
<td class="paramname"><em>vc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>incolor</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="affine_8c.html#a6d86935bd696bd2431cd17136771c519">pixAffine()</a></p>
<p>Input: pixs (all depths; colormap ok) vc (vector of 6 coefficients for affine transformation) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK) Return: pixd, or null on error</p>
<p>Notes: (1) Brings in either black or white pixels from the boundary (2) Removes any existing colormap, if necessary, before transforming </p>
<p>Definition at line <a class="el" href="affine_8c_source.html#l00479">479</a> of file <a class="el" href="affine_8c_source.html">affine.c</a>.</p>
<p>References <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="environ_8h_source.html#l00179">FALSE</a>, <a class="el" href="pix_8h_source.html#l00694">L_BRING_IN_WHITE</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="affine_8c_source.html#l00576">pixAffineColor()</a>, <a class="el" href="affine_8c_source.html#l00671">pixAffineGray()</a>, <a class="el" href="affine_8c_source.html#l00316">pixAffineSampled()</a>, <a class="el" href="pix1_8c_source.html#l00440">pixClone()</a>, <a class="el" href="pixconv_8c_source.html#l02297">pixConvertTo8()</a>, <a class="el" href="pix1_8c_source.html#l00466">pixDestroy()</a>, <a class="el" href="pix1_8c_source.html#l00863">pixGetDepth()</a>, <a class="el" href="pixconv_8c_source.html#l00223">pixRemoveColormap()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, and <a class="el" href="pix_8h_source.html#l00181">REMOVE_CMAP_BASED_ON_SRC</a>.</p>
<p>Referenced by <a class="el" href="affine__reg_8c_source.html#l00056">main()</a>.</p>
</div>
</div>
<a class="anchor" id="aed5a65a5f747035b9aad508afac6f67d"></a><!-- doxytag: member="affine.c::pixAffinePtaColor" ref="aed5a65a5f747035b9aad508afac6f67d" args="(PIX *pixs, PTA *ptad, PTA *ptas, l_uint32 colorval)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixAffinePtaColor </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pta.html">PTA</a> * </td>
<td class="paramname"><em>ptad</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pta.html">PTA</a> * </td>
<td class="paramname"><em>ptas</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> </td>
<td class="paramname"><em>colorval</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="affine_8c.html#aed5a65a5f747035b9aad508afac6f67d">pixAffinePtaColor()</a></p>
<p>Input: pixs (32 bpp) ptad (3 pts of final coordinate space) ptas (3 pts of initial coordinate space) colorval (e.g., 0 to bring in BLACK, 0xffffff00 for WHITE) Return: pixd, or null on error </p>
<p>Definition at line <a class="el" href="affine_8c_source.html#l00535">535</a> of file <a class="el" href="affine_8c_source.html">affine.c</a>.</p>
<p>References <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="environ_8h_source.html#l00216">FREE</a>, <a class="el" href="affine_8c_source.html#l00954">getAffineXformCoeffs()</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="affine_8c_source.html#l00576">pixAffineColor()</a>, <a class="el" href="pix1_8c_source.html#l00863">pixGetDepth()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, and <a class="el" href="ptabasic_8c_source.html#l00346">ptaGetCount()</a>.</p>
<p>Referenced by <a class="el" href="affine_8c_source.html#l00411">pixAffinePta()</a>, and <a class="el" href="affine_8c_source.html#l00757">pixAffinePtaWithAlpha()</a>.</p>
</div>
</div>
<a class="anchor" id="a06d77d39bbd430ce000f88b7302d17b4"></a><!-- doxytag: member="affine.c::pixAffineColor" ref="a06d77d39bbd430ce000f88b7302d17b4" args="(PIX *pixs, l_float32 *vc, l_uint32 colorval)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixAffineColor </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> * </td>
<td class="paramname"><em>vc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a4d4d7254020fc95aef5dde8884405358">l_uint32</a> </td>
<td class="paramname"><em>colorval</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="affine_8c.html#a06d77d39bbd430ce000f88b7302d17b4">pixAffineColor()</a></p>
<p>Input: pixs (32 bpp) vc (vector of 6 coefficients for affine transformation) colorval (e.g., 0 to bring in BLACK, 0xffffff00 for WHITE) Return: pixd, or null on error </p>
<p>Definition at line <a class="el" href="affine_8c_source.html#l00576">576</a> of file <a class="el" href="affine_8c_source.html">affine.c</a>.</p>
<p>References <a class="el" href="affine_8c_source.html#l01148">affineXformPt()</a>, <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="affine_8c_source.html#l01187">linearInterpolatePixelColor()</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="pix1_8c_source.html#l00328">pixCreateTemplate()</a>, <a class="el" href="pix1_8c_source.html#l01358">pixGetData()</a>, <a class="el" href="pix1_8c_source.html#l00898">pixGetDimensions()</a>, <a class="el" href="pix1_8c_source.html#l00970">pixGetWpl()</a>, <a class="el" href="pix2_8c_source.html#l00661">pixSetAllArbitrary()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, <a class="el" href="heap__reg_8c_source.html#l00026">HeapElement::x</a>, and <a class="el" href="heap__reg_8c_source.html#l00027">HeapElement::y</a>.</p>
<p>Referenced by <a class="el" href="affine_8c_source.html#l00479">pixAffine()</a>, and <a class="el" href="affine_8c_source.html#l00535">pixAffinePtaColor()</a>.</p>
</div>
</div>
<a class="anchor" id="a5f2ec4d911f8f0388cc40ecf48cd0645"></a><!-- doxytag: member="affine.c::pixAffinePtaGray" ref="a5f2ec4d911f8f0388cc40ecf48cd0645" args="(PIX *pixs, PTA *ptad, PTA *ptas, l_uint8 grayval)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixAffinePtaGray </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pta.html">PTA</a> * </td>
<td class="paramname"><em>ptad</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pta.html">PTA</a> * </td>
<td class="paramname"><em>ptas</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a7ed60554e7d6dd89aca643189b1e70ad">l_uint8</a> </td>
<td class="paramname"><em>grayval</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="affine_8c.html#a5f2ec4d911f8f0388cc40ecf48cd0645">pixAffinePtaGray()</a></p>
<p>Input: pixs (8 bpp) ptad (3 pts of final coordinate space) ptas (3 pts of initial coordinate space) grayval (0 to bring in BLACK, 255 for WHITE) Return: pixd, or null on error </p>
<p>Definition at line <a class="el" href="affine_8c_source.html#l00629">629</a> of file <a class="el" href="affine_8c_source.html">affine.c</a>.</p>
<p>References <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="environ_8h_source.html#l00216">FREE</a>, <a class="el" href="affine_8c_source.html#l00954">getAffineXformCoeffs()</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="affine_8c_source.html#l00671">pixAffineGray()</a>, <a class="el" href="pix1_8c_source.html#l00863">pixGetDepth()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, and <a class="el" href="ptabasic_8c_source.html#l00346">ptaGetCount()</a>.</p>
<p>Referenced by <a class="el" href="affine_8c_source.html#l00411">pixAffinePta()</a>, and <a class="el" href="affine_8c_source.html#l00757">pixAffinePtaWithAlpha()</a>.</p>
</div>
</div>
<a class="anchor" id="a58c3e8f9e6e6d33e074aecfbbc1d310a"></a><!-- doxytag: member="affine.c::pixAffineGray" ref="a58c3e8f9e6e6d33e074aecfbbc1d310a" args="(PIX *pixs, l_float32 *vc, l_uint8 grayval)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixAffineGray </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> * </td>
<td class="paramname"><em>vc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a7ed60554e7d6dd89aca643189b1e70ad">l_uint8</a> </td>
<td class="paramname"><em>grayval</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="affine_8c.html#a58c3e8f9e6e6d33e074aecfbbc1d310a">pixAffineGray()</a></p>
<p>Input: pixs (8 bpp) vc (vector of 6 coefficients for affine transformation) grayval (0 to bring in BLACK, 255 for WHITE) Return: pixd, or null on error </p>
<p>Definition at line <a class="el" href="affine_8c_source.html#l00671">671</a> of file <a class="el" href="affine_8c_source.html">affine.c</a>.</p>
<p>References <a class="el" href="affine_8c_source.html#l01148">affineXformPt()</a>, <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="affine_8c_source.html#l01267">linearInterpolatePixelGray()</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="pix1_8c_source.html#l00328">pixCreateTemplate()</a>, <a class="el" href="pix1_8c_source.html#l01358">pixGetData()</a>, <a class="el" href="pix1_8c_source.html#l00863">pixGetDepth()</a>, <a class="el" href="pix1_8c_source.html#l00898">pixGetDimensions()</a>, <a class="el" href="pix1_8c_source.html#l00970">pixGetWpl()</a>, <a class="el" href="pix2_8c_source.html#l00661">pixSetAllArbitrary()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, <a class="el" href="arrayaccess_8h_source.html#l00126">SET_DATA_BYTE</a>, <a class="el" href="heap__reg_8c_source.html#l00026">HeapElement::x</a>, and <a class="el" href="heap__reg_8c_source.html#l00027">HeapElement::y</a>.</p>
<p>Referenced by <a class="el" href="affine_8c_source.html#l00479">pixAffine()</a>, and <a class="el" href="affine_8c_source.html#l00629">pixAffinePtaGray()</a>.</p>
</div>
</div>
<a class="anchor" id="afd63168e13d35247c9e21d6e59f09567"></a><!-- doxytag: member="affine.c::pixAffinePtaWithAlpha" ref="afd63168e13d35247c9e21d6e59f09567" args="(PIX *pixs, PTA *ptad, PTA *ptas, PIX *pixg, l_float32 fract, l_int32 border)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixAffinePtaWithAlpha </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pta.html">PTA</a> * </td>
<td class="paramname"><em>ptad</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pta.html">PTA</a> * </td>
<td class="paramname"><em>ptas</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> </td>
<td class="paramname"><em>fract</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>border</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="affine_8c.html#afd63168e13d35247c9e21d6e59f09567">pixAffinePtaWithAlpha()</a></p>
<p>Input: pixs (32 bpp rgb) ptad (3 pts of final coordinate space) ptas (3 pts of initial coordinate space) pixg (<optional> 8 bpp, can be null) fract (between 0.0 and 1.0, with 0.0 fully transparent and 1.0 fully opaque) border (of pixels added to capture transformed source pixels) Return: pixd, or null on error</p>
<p>Notes: (1) The alpha channel is transformed separately from pixs, and aligns with it, being fully transparent outside the boundary of the transformed pixs. For pixels that are fully transparent, a blending function like <a class="el" href="blend_8c.html#a51d08d3ae19c515a5fabf42db1daf85b">pixBlendWithGrayMask()</a> will give zero weight to corresponding pixels in pixs. (2) If pixg is NULL, it is generated as an alpha layer that is partially opaque, using . Otherwise, it is cropped to pixs if required and is ignored. The alpha channel in pixs is never used. (3) Colormaps are removed. (4) When pixs is transformed, it doesn't matter what color is brought in because the alpha channel will be transparent (0) there. (5) To avoid losing source pixels in the destination, it may be necessary to add a border to the source pix before doing the affine transformation. This can be any non-negative number. (6) The input and are in a coordinate space before the border is added. Internally, we compensate for this before doing the affine transform on the image after the border is added. (7) The default setting for the border values in the alpha channel is 0 (transparent) for the outermost ring of pixels and (0.5 * fract * 255) for the second ring. When blended over a second image, this (a) shrinks the visible image to make a clean overlap edge with an image below, and (b) softens the edges by weakening the aliasing there. Use <a class="el" href="leptprotos_8h.html#ab264c4aa44066ad46ebe2294b8bb523b">l_setAlphaMaskBorder()</a> to change these values. </p>
<p>Definition at line <a class="el" href="affine_8c_source.html#l00757">757</a> of file <a class="el" href="affine_8c_source.html">affine.c</a>.</p>
<p>References <a class="el" href="pix2_8c_source.html#l00117">AlphaMaskBorderVals</a>, <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="pix_8h_source.html#l00146">L_ALPHA_CHANNEL</a>, <a class="el" href="environ_8h_source.html#l00257">L_WARNING</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="pix2_8c_source.html#l01463">pixAddBorder()</a>, <a class="el" href="affine_8c_source.html#l00535">pixAffinePtaColor()</a>, <a class="el" href="affine_8c_source.html#l00629">pixAffinePtaGray()</a>, <a class="el" href="pix1_8c_source.html#l00269">pixCreate()</a>, <a class="el" href="pix1_8c_source.html#l00466">pixDestroy()</a>, <a class="el" href="pix1_8c_source.html#l01288">pixGetColormap()</a>, <a class="el" href="pix1_8c_source.html#l00863">pixGetDepth()</a>, <a class="el" href="pix1_8c_source.html#l00898">pixGetDimensions()</a>, <a class="el" href="pix5_8c_source.html#l00835">pixResizeToMatch()</a>, <a class="el" href="pix2_8c_source.html#l00625">pixSetAll()</a>, <a class="el" href="pix2_8c_source.html#l00661">pixSetAllArbitrary()</a>, <a class="el" href="pix2_8c_source.html#l01313">pixSetBorderRingVal()</a>, <a class="el" href="pix2_8c_source.html#l01940">pixSetRGBComponent()</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, <a class="el" href="ptabasic_8c_source.html#l00156">ptaDestroy()</a>, and <a class="el" href="ptafunc1_8c_source.html#l00735">ptaTransform()</a>.</p>
<p>Referenced by <a class="el" href="alphaxform__reg_8c_source.html#l00054">main()</a>, and <a class="el" href="affine_8c_source.html#l00853">pixAffinePtaGammaXform()</a>.</p>
</div>
</div>
<a class="anchor" id="ac11c1ec1133dc6625c6c589bf4d54663"></a><!-- doxytag: member="affine.c::pixAffinePtaGammaXform" ref="ac11c1ec1133dc6625c6c589bf4d54663" args="(PIX *pixs, l_float32 gamma, PTA *ptad, PTA *ptas, l_float32 fract, l_int32 border)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_pix.html">PIX</a>* pixAffinePtaGammaXform </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pix.html">PIX</a> * </td>
<td class="paramname"><em>pixs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> </td>
<td class="paramname"><em>gamma</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pta.html">PTA</a> * </td>
<td class="paramname"><em>ptad</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pta.html">PTA</a> * </td>
<td class="paramname"><em>ptas</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> </td>
<td class="paramname"><em>fract</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> </td>
<td class="paramname"><em>border</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="affine_8c.html#ac11c1ec1133dc6625c6c589bf4d54663">pixAffinePtaGammaXform()</a></p>
<p>Input: pixs (32 bpp rgb) gamma (gamma correction; must be > 0.0) ptad (3 pts of final coordinate space) ptas (3 pts of initial coordinate space) fract (between 0.0 and 1.0, with 1.0 fully transparent) border (of pixels to capture transformed source pixels) Return: pixd, or null on error</p>
<p>Notes: (1) This wraps a gamma/inverse-gamma photometric transform around <a class="el" href="affine_8c.html#afd63168e13d35247c9e21d6e59f09567">pixAffinePtaWithAlpha()</a>. (2) For usage, see notes in <a class="el" href="affine_8c.html#afd63168e13d35247c9e21d6e59f09567">pixAffinePtaWithAlpha()</a> and <a class="el" href="enhance_8c.html#ade289b100cd6316d6ef34d40beb375c2">pixGammaTRCWithAlpha()</a>. (3) The basic idea of a gamma/inverse-gamma transform is to remove any gamma correction before the affine transform, and restore it afterward. The effects can be subtle, but important for some applications. For example, using gamma > 1.0 will cause the dark areas to become somewhat lighter and slightly reduce aliasing effects when blending using the alpha channel. </p>
<p>Definition at line <a class="el" href="affine_8c_source.html#l00853">853</a> of file <a class="el" href="affine_8c_source.html">affine.c</a>.</p>
<p>References <a class="el" href="environ_8h_source.html#l00250">ERROR_PTR</a>, <a class="el" href="environ_8h_source.html#l00257">L_WARNING</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="affine_8c_source.html#l00757">pixAffinePtaWithAlpha()</a>, <a class="el" href="pix1_8c_source.html#l00466">pixDestroy()</a>, <a class="el" href="enhance_8c_source.html#l00281">pixGammaTRCWithAlpha()</a>, <a class="el" href="pix1_8c_source.html#l00863">pixGetDepth()</a>, and <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>.</p>
<p>Referenced by <a class="el" href="alphaxform__reg_8c_source.html#l00054">main()</a>.</p>
</div>
</div>
<a class="anchor" id="a6dbd9d7ffdcb98cb9bdeb3d1ca67e4c4"></a><!-- doxytag: member="affine.c::getAffineXformCoeffs" ref="a6dbd9d7ffdcb98cb9bdeb3d1ca67e4c4" args="(PTA *ptas, PTA *ptad, l_float32 **pvc)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> getAffineXformCoeffs </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_pta.html">PTA</a> * </td>
<td class="paramname"><em>ptas</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_pta.html">PTA</a> * </td>
<td class="paramname"><em>ptad</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> ** </td>
<td class="paramname"><em>pvc</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="affine_8c.html#a6dbd9d7ffdcb98cb9bdeb3d1ca67e4c4">getAffineXformCoeffs()</a></p>
<p>Input: ptas (source 3 points; unprimed) ptad (transformed 3 points; primed) &vc (<return> vector of coefficients of transform) Return: 0 if OK; 1 on error</p>
<p>We have a set of six equations, describing the affine transformation that takes 3 points (ptas) into 3 other points (ptad). These equations are:</p>
<p>x1' = c[0]*x1 + c[1]*y1 + c[2] y1' = c[3]*x1 + c[4]*y1 + c[5] x2' = c[0]*x2 + c[1]*y2 + c[2] y2' = c[3]*x2 + c[4]*y2 + c[5] x3' = c[0]*x3 + c[1]*y3 + c[2] y3' = c[3]*x3 + c[4]*y3 + c[5]</p>
<p>This can be represented as</p>
<p>AC = B</p>
<p>where B and C are column vectors</p>
<p>B = [ x1' y1' x2' y2' x3' y3' ] C = [ c[0] c[1] c[2] c[3] c[4] c[5] c[6] ]</p>
<p>and A is the 6x6 matrix</p>
<p>x1 y1 1 0 0 0 0 0 0 x1 y1 1 x2 y2 1 0 0 0 0 0 0 x2 y2 1 x3 y3 1 0 0 0 0 0 0 x3 y3 1</p>
<p>These six equations are solved here for the coefficients C.</p>
<p>These six coefficients can then be used to find the dest point (x',y') corresponding to any src point (x,y), according to the equations</p>
<p>x' = c[0]x + c[1]y + c[2] y' = c[3]x + c[4]y + c[5]</p>
<p>that are implemented in <a class="el" href="affine_8c.html#a71dfee95a587378a161c3a6f1e3a1c30">affineXformPt()</a>.</p>
<p>!!!!!!!!!!!!!!!!!! Very important !!!!!!!!!!!!!!!!!!!!!!</p>
<p>When the affine transform is composed from a set of simple operations such as translation, scaling and rotation, it is built in a form to convert from the un-transformed src point to the transformed dest point. However, when an affine transform is used on images, it is used in an inverted way: it converts from the transformed dest point to the un-transformed src point. So, for example, if you transform a boxa using transform A, to transform an image in the same way you must use the inverse of A.</p>
<p>For example, if you transform a boxa with a 3x3 affine matrix 'mat', the analogous image transformation must use 'matinv':</p>
<p>boxad = boxaAffineTransform(boxas, mat); affineInvertXform(mat, &matinv); pixd = pixAffine(pixs, matinv, L_BRING_IN_WHITE);</p>
<p>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! </p>
<p>Definition at line <a class="el" href="affine_8c_source.html#l00954">954</a> of file <a class="el" href="affine_8c_source.html">affine.c</a>.</p>
<p>References <a class="el" href="environ_8h_source.html#l00214">CALLOC</a>, <a class="el" href="environ_8h_source.html#l00251">ERROR_INT</a>, <a class="el" href="environ_8h_source.html#l00216">FREE</a>, <a class="el" href="affine_8c_source.html#l01337">gaussjordan()</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>, <a class="el" href="ptabasic_8c_source.html#l00367">ptaGetPt()</a>, <a class="el" href="affine__reg_8c_source.html#l00032">x1</a>, <a class="el" href="affine__reg_8c_source.html#l00034">x2</a>, <a class="el" href="affine__reg_8c_source.html#l00036">x3</a>, <a class="el" href="affine__reg_8c_source.html#l00033">y1</a>, <a class="el" href="affine__reg_8c_source.html#l00035">y2</a>, and <a class="el" href="affine__reg_8c_source.html#l00037">y3</a>.</p>
<p>Referenced by <a class="el" href="affine_8c_source.html#l00535">pixAffinePtaColor()</a>, <a class="el" href="affine_8c_source.html#l00629">pixAffinePtaGray()</a>, and <a class="el" href="affine_8c_source.html#l00268">pixAffineSampledPta()</a>.</p>
</div>
</div>
<a class="anchor" id="a4bec7268ce4521fcc08cb33b5e5c1c4a"></a><!-- doxytag: member="affine.c::affineInvertXform" ref="a4bec7268ce4521fcc08cb33b5e5c1c4a" args="(l_float32 *vc, l_float32 **pvci)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> affineInvertXform </td>
<td>(</td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> * </td>
<td class="paramname"><em>vc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> ** </td>
<td class="paramname"><em>pvci</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="affine_8c.html#a4bec7268ce4521fcc08cb33b5e5c1c4a">affineInvertXform()</a></p>
<p>Input: vc (vector of 6 coefficients) *vci (<return> inverted transform) Return: 0 if OK; 1 on error</p>
<p>Notes: (1) The 6 affine transform coefficients are the first two rows of a 3x3 matrix where the last row has only a 1 in the third column. We invert this using <a class="el" href="affine_8c.html#a2d74fe926128c1ccde0705ddb807ec12">gaussjordan()</a>, and select the first 2 rows as the coefficients of the inverse affine transform. (2) Alternatively, we can find the inverse transform coefficients by inverting the 2x2 submatrix, and treating the top 2 coefficients in the 3rd column as a RHS vector for that 2x2 submatrix. Then the 6 inverted transform coefficients are composed of the inverted 2x2 submatrix and the negative of the transformed RHS vector. Why is this so? We have Y = AX + R (2 equations in 6 unknowns) Then X = A'Y - A'R Gauss-jordan solves AF = R and puts the solution for F, which is A'R, into the input R vector. </p>
<p>Definition at line <a class="el" href="affine_8c_source.html#l01045">1045</a> of file <a class="el" href="affine_8c_source.html">affine.c</a>.</p>
<p>References <a class="el" href="environ_8h_source.html#l00214">CALLOC</a>, <a class="el" href="environ_8h_source.html#l00251">ERROR_INT</a>, <a class="el" href="affine_8c_source.html#l01337">gaussjordan()</a>, <a class="el" href="environ_8h_source.html#l00171">NULL</a>, and <a class="el" href="environ_8h_source.html#l00249">PROCNAME</a>.</p>
<p>Referenced by <a class="el" href="affine__reg_8c_source.html#l00056">main()</a>.</p>
</div>
</div>
<a class="anchor" id="adf6502edf7823f552db9236cba693dc3"></a><!-- doxytag: member="affine.c::affineXformSampledPt" ref="adf6502edf7823f552db9236cba693dc3" args="(l_float32 *vc, l_int32 x, l_int32 y, l_int32 *pxp, l_int32 *pyp)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="environ_8h.html#a9085c7874153c280a4171244aa052e4e">l_int32</a> affineXformSampledPt </td>
<td>(</td>
<td class="paramtype"><a class="el" href="environ_8h.html#af59419416d96ecf5fca70c8d05adb456">l_float32</a> * </td>
<td class="paramname"><em>vc</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>