Leptonica 1.82.0
Image processing and image analysis suite
bilinear.c
Go to the documentation of this file.
1/*====================================================================*
2 - Copyright (C) 2001 Leptonica. All rights reserved.
3 -
4 - Redistribution and use in source and binary forms, with or without
5 - modification, are permitted provided that the following conditions
6 - are met:
7 - 1. Redistributions of source code must retain the above copyright
8 - notice, this list of conditions and the following disclaimer.
9 - 2. Redistributions in binary form must reproduce the above
10 - copyright notice, this list of conditions and the following
11 - disclaimer in the documentation and/or other materials
12 - provided with the distribution.
13 -
14 - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15 - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16 - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17 - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY
18 - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23 - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *====================================================================*/
26
112#ifdef HAVE_CONFIG_H
113#include <config_auto.h>
114#endif /* HAVE_CONFIG_H */
115
116#include <string.h>
117#include <math.h>
118#include "allheaders.h"
119
120extern l_float32 AlphaMaskBorderVals[2];
121
122/*-------------------------------------------------------------*
123 * Sampled bilinear image transformation *
124 *-------------------------------------------------------------*/
144PIX *
146 PTA *ptad,
147 PTA *ptas,
148 l_int32 incolor)
149{
150l_float32 *vc;
151PIX *pixd;
152
153 PROCNAME("pixBilinearSampledPta");
154
155 if (!pixs)
156 return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
157 if (!ptas)
158 return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
159 if (!ptad)
160 return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
161 if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
162 return (PIX *)ERROR_PTR("invalid incolor", procName, NULL);
163 if (ptaGetCount(ptas) != 4)
164 return (PIX *)ERROR_PTR("ptas count not 4", procName, NULL);
165 if (ptaGetCount(ptad) != 4)
166 return (PIX *)ERROR_PTR("ptad count not 4", procName, NULL);
167
168 /* Get backwards transform from dest to src, and apply it */
169 getBilinearXformCoeffs(ptad, ptas, &vc);
170 pixd = pixBilinearSampled(pixs, vc, incolor);
171 LEPT_FREE(vc);
172
173 return pixd;
174}
175
176
194PIX *
196 l_float32 *vc,
197 l_int32 incolor)
198{
199l_int32 i, j, w, h, d, x, y, wpls, wpld, color, cmapindex;
200l_uint32 val;
201l_uint32 *datas, *datad, *lines, *lined;
202PIX *pixd;
203PIXCMAP *cmap;
204
205 PROCNAME("pixBilinearSampled");
206
207 if (!pixs)
208 return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
209 if (!vc)
210 return (PIX *)ERROR_PTR("vc not defined", procName, NULL);
211 if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
212 return (PIX *)ERROR_PTR("invalid incolor", procName, NULL);
213 pixGetDimensions(pixs, &w, &h, &d);
214 if (d != 1 && d != 2 && d != 4 && d != 8 && d != 32)
215 return (PIX *)ERROR_PTR("depth not 1, 2, 4, 8 or 16", procName, NULL);
216
217 /* Init all dest pixels to color to be brought in from outside */
218 pixd = pixCreateTemplate(pixs);
219 if ((cmap = pixGetColormap(pixs)) != NULL) {
220 if (incolor == L_BRING_IN_WHITE)
221 color = 1;
222 else
223 color = 0;
224 pixcmapAddBlackOrWhite(cmap, color, &cmapindex);
225 pixSetAllArbitrary(pixd, cmapindex);
226 } else {
227 if ((d == 1 && incolor == L_BRING_IN_WHITE) ||
228 (d > 1 && incolor == L_BRING_IN_BLACK)) {
229 pixClearAll(pixd);
230 } else {
231 pixSetAll(pixd);
232 }
233 }
234
235 /* Scan over the dest pixels */
236 datas = pixGetData(pixs);
237 wpls = pixGetWpl(pixs);
238 datad = pixGetData(pixd);
239 wpld = pixGetWpl(pixd);
240 for (i = 0; i < h; i++) {
241 lined = datad + i * wpld;
242 for (j = 0; j < w; j++) {
243 bilinearXformSampledPt(vc, j, i, &x, &y);
244 if (x < 0 || y < 0 || x >=w || y >= h)
245 continue;
246 lines = datas + y * wpls;
247 if (d == 1) {
248 val = GET_DATA_BIT(lines, x);
249 SET_DATA_BIT_VAL(lined, j, val);
250 } else if (d == 8) {
251 val = GET_DATA_BYTE(lines, x);
252 SET_DATA_BYTE(lined, j, val);
253 } else if (d == 32) {
254 lined[j] = lines[x];
255 } else if (d == 2) {
256 val = GET_DATA_DIBIT(lines, x);
257 SET_DATA_DIBIT(lined, j, val);
258 } else if (d == 4) {
259 val = GET_DATA_QBIT(lines, x);
260 SET_DATA_QBIT(lined, j, val);
261 }
262 }
263 }
264
265 return pixd;
266}
267
268
269/*---------------------------------------------------------------------*
270 * Interpolated bilinear image transformation *
271 *---------------------------------------------------------------------*/
287PIX *
289 PTA *ptad,
290 PTA *ptas,
291 l_int32 incolor)
292{
293l_int32 d;
294l_uint32 colorval;
295PIX *pixt1, *pixt2, *pixd;
296
297 PROCNAME("pixBilinearPta");
298
299 if (!pixs)
300 return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
301 if (!ptas)
302 return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
303 if (!ptad)
304 return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
305 if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
306 return (PIX *)ERROR_PTR("invalid incolor", procName, NULL);
307 if (ptaGetCount(ptas) != 4)
308 return (PIX *)ERROR_PTR("ptas count not 4", procName, NULL);
309 if (ptaGetCount(ptad) != 4)
310 return (PIX *)ERROR_PTR("ptad count not 4", procName, NULL);
311
312 if (pixGetDepth(pixs) == 1)
313 return pixBilinearSampledPta(pixs, ptad, ptas, incolor);
314
315 /* Remove cmap if it exists, and unpack to 8 bpp if necessary */
317 d = pixGetDepth(pixt1);
318 if (d < 8)
319 pixt2 = pixConvertTo8(pixt1, FALSE);
320 else
321 pixt2 = pixClone(pixt1);
322 d = pixGetDepth(pixt2);
323
324 /* Compute actual color to bring in from edges */
325 colorval = 0;
326 if (incolor == L_BRING_IN_WHITE) {
327 if (d == 8)
328 colorval = 255;
329 else /* d == 32 */
330 colorval = 0xffffff00;
331 }
332
333 if (d == 8)
334 pixd = pixBilinearPtaGray(pixt2, ptad, ptas, colorval);
335 else /* d == 32 */
336 pixd = pixBilinearPtaColor(pixt2, ptad, ptas, colorval);
337 pixDestroy(&pixt1);
338 pixDestroy(&pixt2);
339 return pixd;
340}
341
342
357PIX *
359 l_float32 *vc,
360 l_int32 incolor)
361{
362l_int32 d;
363l_uint32 colorval;
364PIX *pixt1, *pixt2, *pixd;
365
366 PROCNAME("pixBilinear");
367
368 if (!pixs)
369 return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
370 if (!vc)
371 return (PIX *)ERROR_PTR("vc not defined", procName, NULL);
372
373 if (pixGetDepth(pixs) == 1)
374 return pixBilinearSampled(pixs, vc, incolor);
375
376 /* Remove cmap if it exists, and unpack to 8 bpp if necessary */
378 d = pixGetDepth(pixt1);
379 if (d < 8)
380 pixt2 = pixConvertTo8(pixt1, FALSE);
381 else
382 pixt2 = pixClone(pixt1);
383 d = pixGetDepth(pixt2);
384
385 /* Compute actual color to bring in from edges */
386 colorval = 0;
387 if (incolor == L_BRING_IN_WHITE) {
388 if (d == 8)
389 colorval = 255;
390 else /* d == 32 */
391 colorval = 0xffffff00;
392 }
393
394 if (d == 8)
395 pixd = pixBilinearGray(pixt2, vc, colorval);
396 else /* d == 32 */
397 pixd = pixBilinearColor(pixt2, vc, colorval);
398 pixDestroy(&pixt1);
399 pixDestroy(&pixt2);
400 return pixd;
401}
402
403
413PIX *
415 PTA *ptad,
416 PTA *ptas,
417 l_uint32 colorval)
418{
419l_float32 *vc;
420PIX *pixd;
421
422 PROCNAME("pixBilinearPtaColor");
423
424 if (!pixs)
425 return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
426 if (!ptas)
427 return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
428 if (!ptad)
429 return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
430 if (pixGetDepth(pixs) != 32)
431 return (PIX *)ERROR_PTR("pixs must be 32 bpp", procName, NULL);
432 if (ptaGetCount(ptas) != 4)
433 return (PIX *)ERROR_PTR("ptas count not 4", procName, NULL);
434 if (ptaGetCount(ptad) != 4)
435 return (PIX *)ERROR_PTR("ptad count not 4", procName, NULL);
436
437 /* Get backwards transform from dest to src, and apply it */
438 getBilinearXformCoeffs(ptad, ptas, &vc);
439 pixd = pixBilinearColor(pixs, vc, colorval);
440 LEPT_FREE(vc);
441
442 return pixd;
443}
444
445
454PIX *
456 l_float32 *vc,
457 l_uint32 colorval)
458{
459l_int32 i, j, w, h, d, wpls, wpld;
460l_uint32 val;
461l_uint32 *datas, *datad, *lined;
462l_float32 x, y;
463PIX *pix1, *pix2, *pixd;
464
465 PROCNAME("pixBilinearColor");
466
467 if (!pixs)
468 return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
469 pixGetDimensions(pixs, &w, &h, &d);
470 if (d != 32)
471 return (PIX *)ERROR_PTR("pixs must be 32 bpp", procName, NULL);
472 if (!vc)
473 return (PIX *)ERROR_PTR("vc not defined", procName, NULL);
474
475 datas = pixGetData(pixs);
476 wpls = pixGetWpl(pixs);
477 pixd = pixCreateTemplate(pixs);
478 pixSetAllArbitrary(pixd, colorval);
479 datad = pixGetData(pixd);
480 wpld = pixGetWpl(pixd);
481
482 /* Iterate over destination pixels */
483 for (i = 0; i < h; i++) {
484 lined = datad + i * wpld;
485 for (j = 0; j < w; j++) {
486 /* Compute float src pixel location corresponding to (i,j) */
487 bilinearXformPt(vc, j, i, &x, &y);
488 linearInterpolatePixelColor(datas, wpls, w, h, x, y, colorval,
489 &val);
490 *(lined + j) = val;
491 }
492 }
493
494 /* If rgba, transform the pixs alpha channel and insert in pixd */
495 if (pixGetSpp(pixs) == 4) {
497 pix2 = pixBilinearGray(pix1, vc, 255); /* bring in opaque */
499 pixDestroy(&pix1);
500 pixDestroy(&pix2);
501 }
502
503 return pixd;
504}
505
506
516PIX *
518 PTA *ptad,
519 PTA *ptas,
520 l_uint8 grayval)
521{
522l_float32 *vc;
523PIX *pixd;
524
525 PROCNAME("pixBilinearPtaGray");
526
527 if (!pixs)
528 return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
529 if (!ptas)
530 return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
531 if (!ptad)
532 return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
533 if (pixGetDepth(pixs) != 8)
534 return (PIX *)ERROR_PTR("pixs must be 8 bpp", procName, NULL);
535 if (ptaGetCount(ptas) != 4)
536 return (PIX *)ERROR_PTR("ptas count not 4", procName, NULL);
537 if (ptaGetCount(ptad) != 4)
538 return (PIX *)ERROR_PTR("ptad count not 4", procName, NULL);
539
540 /* Get backwards transform from dest to src, and apply it */
541 getBilinearXformCoeffs(ptad, ptas, &vc);
542 pixd = pixBilinearGray(pixs, vc, grayval);
543 LEPT_FREE(vc);
544
545 return pixd;
546}
547
548
557PIX *
559 l_float32 *vc,
560 l_uint8 grayval)
561{
562l_int32 i, j, w, h, wpls, wpld, val;
563l_uint32 *datas, *datad, *lined;
564l_float32 x, y;
565PIX *pixd;
566
567 PROCNAME("pixBilinearGray");
568
569 if (!pixs)
570 return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
571 pixGetDimensions(pixs, &w, &h, NULL);
572 if (pixGetDepth(pixs) != 8)
573 return (PIX *)ERROR_PTR("pixs must be 8 bpp", procName, NULL);
574 if (!vc)
575 return (PIX *)ERROR_PTR("vc not defined", procName, NULL);
576
577 datas = pixGetData(pixs);
578 wpls = pixGetWpl(pixs);
579 pixd = pixCreateTemplate(pixs);
580 pixSetAllArbitrary(pixd, grayval);
581 datad = pixGetData(pixd);
582 wpld = pixGetWpl(pixd);
583
584 /* Iterate over destination pixels */
585 for (i = 0; i < h; i++) {
586 lined = datad + i * wpld;
587 for (j = 0; j < w; j++) {
588 /* Compute float src pixel location corresponding to (i,j) */
589 bilinearXformPt(vc, j, i, &x, &y);
590 linearInterpolatePixelGray(datas, wpls, w, h, x, y, grayval, &val);
591 SET_DATA_BYTE(lined, j, val);
592 }
593 }
594
595 return pixd;
596}
597
598
599/*-------------------------------------------------------------------------*
600 * Bilinear transform including alpha (blend) component *
601 *-------------------------------------------------------------------------*/
645PIX *
647 PTA *ptad,
648 PTA *ptas,
649 PIX *pixg,
650 l_float32 fract,
651 l_int32 border)
652{
653l_int32 ws, hs, d;
654PIX *pixd, *pixb1, *pixb2, *pixg2, *pixga;
655PTA *ptad2, *ptas2;
656
657 PROCNAME("pixBilinearPtaWithAlpha");
658
659 if (!pixs)
660 return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
661 pixGetDimensions(pixs, &ws, &hs, &d);
662 if (d != 32 && pixGetColormap(pixs) == NULL)
663 return (PIX *)ERROR_PTR("pixs not cmapped or 32 bpp", procName, NULL);
664 if (pixg && pixGetDepth(pixg) != 8) {
665 L_WARNING("pixg not 8 bpp; using 'fract' transparent alpha\n",
666 procName);
667 pixg = NULL;
668 }
669 if (!pixg && (fract < 0.0 || fract > 1.0)) {
670 L_WARNING("invalid fract; using 1.0 (fully transparent)\n", procName);
671 fract = 1.0;
672 }
673 if (!pixg && fract == 0.0)
674 L_WARNING("fully opaque alpha; image cannot be blended\n", procName);
675 if (!ptad)
676 return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
677 if (!ptas)
678 return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
679
680 /* Add border; the color doesn't matter */
681 pixb1 = pixAddBorder(pixs, border, 0);
682
683 /* Transform the ptr arrays to work on the bordered image */
684 ptad2 = ptaTransform(ptad, border, border, 1.0, 1.0);
685 ptas2 = ptaTransform(ptas, border, border, 1.0, 1.0);
686
687 /* Do separate bilinear transform of rgb channels of pixs and of pixg */
688 pixd = pixBilinearPtaColor(pixb1, ptad2, ptas2, 0);
689 if (!pixg) {
690 pixg2 = pixCreate(ws, hs, 8);
691 if (fract == 1.0)
692 pixSetAll(pixg2);
693 else
694 pixSetAllArbitrary(pixg2, (l_int32)(255.0 * fract));
695 } else {
696 pixg2 = pixResizeToMatch(pixg, NULL, ws, hs);
697 }
698 if (ws > 10 && hs > 10) { /* see note 7 */
699 pixSetBorderRingVal(pixg2, 1,
700 (l_int32)(255.0 * fract * AlphaMaskBorderVals[0]));
701 pixSetBorderRingVal(pixg2, 2,
702 (l_int32)(255.0 * fract * AlphaMaskBorderVals[1]));
703
704 }
705 pixb2 = pixAddBorder(pixg2, border, 0); /* must be black border */
706 pixga = pixBilinearPtaGray(pixb2, ptad2, ptas2, 0);
708 pixSetSpp(pixd, 4);
709
710 pixDestroy(&pixg2);
711 pixDestroy(&pixb1);
712 pixDestroy(&pixb2);
713 pixDestroy(&pixga);
714 ptaDestroy(&ptad2);
715 ptaDestroy(&ptas2);
716 return pixd;
717}
718
719
720/*-------------------------------------------------------------*
721 * Bilinear coordinate transformation *
722 *-------------------------------------------------------------*/
777l_ok
779 PTA *ptad,
780 l_float32 **pvc)
781{
782l_int32 i;
783l_float32 x1, y1, x2, y2, x3, y3, x4, y4;
784l_float32 *b; /* rhs vector of primed coords X'; coeffs returned in *pvc */
785l_float32 *a[8]; /* 8x8 matrix A */
786
787 PROCNAME("getBilinearXformCoeffs");
788
789 if (!ptas)
790 return ERROR_INT("ptas not defined", procName, 1);
791 if (!ptad)
792 return ERROR_INT("ptad not defined", procName, 1);
793 if (!pvc)
794 return ERROR_INT("&vc not defined", procName, 1);
795
796 b = (l_float32 *)LEPT_CALLOC(8, sizeof(l_float32));
797 *pvc = b;
798 ptaGetPt(ptas, 0, &x1, &y1);
799 ptaGetPt(ptas, 1, &x2, &y2);
800 ptaGetPt(ptas, 2, &x3, &y3);
801 ptaGetPt(ptas, 3, &x4, &y4);
802 ptaGetPt(ptad, 0, &b[0], &b[1]);
803 ptaGetPt(ptad, 1, &b[2], &b[3]);
804 ptaGetPt(ptad, 2, &b[4], &b[5]);
805 ptaGetPt(ptad, 3, &b[6], &b[7]);
806
807 for (i = 0; i < 8; i++)
808 a[i] = (l_float32 *)LEPT_CALLOC(8, sizeof(l_float32));
809 a[0][0] = x1;
810 a[0][1] = y1;
811 a[0][2] = x1 * y1;
812 a[0][3] = 1.;
813 a[1][4] = x1;
814 a[1][5] = y1;
815 a[1][6] = x1 * y1;
816 a[1][7] = 1.;
817 a[2][0] = x2;
818 a[2][1] = y2;
819 a[2][2] = x2 * y2;
820 a[2][3] = 1.;
821 a[3][4] = x2;
822 a[3][5] = y2;
823 a[3][6] = x2 * y2;
824 a[3][7] = 1.;
825 a[4][0] = x3;
826 a[4][1] = y3;
827 a[4][2] = x3 * y3;
828 a[4][3] = 1.;
829 a[5][4] = x3;
830 a[5][5] = y3;
831 a[5][6] = x3 * y3;
832 a[5][7] = 1.;
833 a[6][0] = x4;
834 a[6][1] = y4;
835 a[6][2] = x4 * y4;
836 a[6][3] = 1.;
837 a[7][4] = x4;
838 a[7][5] = y4;
839 a[7][6] = x4 * y4;
840 a[7][7] = 1.;
841
842 gaussjordan(a, b, 8);
843
844 for (i = 0; i < 8; i++)
845 LEPT_FREE(a[i]);
846 return 0;
847}
848
849
864l_ok
866 l_int32 x,
867 l_int32 y,
868 l_int32 *pxp,
869 l_int32 *pyp)
870{
871
872 PROCNAME("bilinearXformSampledPt");
873
874 if (!vc)
875 return ERROR_INT("vc not defined", procName, 1);
876
877 *pxp = (l_int32)(vc[0] * x + vc[1] * y + vc[2] * x * y + vc[3] + 0.5);
878 *pyp = (l_int32)(vc[4] * x + vc[5] * y + vc[6] * x * y + vc[7] + 0.5);
879 return 0;
880}
881
882
897l_ok
898bilinearXformPt(l_float32 *vc,
899 l_int32 x,
900 l_int32 y,
901 l_float32 *pxp,
902 l_float32 *pyp)
903{
904 PROCNAME("bilinearXformPt");
905
906 if (!vc)
907 return ERROR_INT("vc not defined", procName, 1);
908
909 *pxp = vc[0] * x + vc[1] * y + vc[2] * x * y + vc[3];
910 *pyp = vc[4] * x + vc[5] * y + vc[6] * x * y + vc[7];
911 return 0;
912}
l_ok linearInterpolatePixelColor(l_uint32 *datas, l_int32 wpls, l_int32 w, l_int32 h, l_float32 x, l_float32 y, l_uint32 colorval, l_uint32 *pval)
linearInterpolatePixelColor()
Definition: affine.c:1179
l_int32 gaussjordan(l_float32 **a, l_float32 *b, l_int32 n)
gaussjordan()
Definition: affine.c:1344
l_ok linearInterpolatePixelGray(l_uint32 *datas, l_int32 wpls, l_int32 w, l_int32 h, l_float32 x, l_float32 y, l_int32 grayval, l_int32 *pval)
linearInterpolatePixelGray()
Definition: affine.c:1265
#define GET_DATA_QBIT(pdata, n)
Definition: arrayaccess.h:164
#define SET_DATA_DIBIT(pdata, n, val)
Definition: arrayaccess.h:149
#define SET_DATA_BIT_VAL(pdata, n, val)
Definition: arrayaccess.h:135
#define GET_DATA_BYTE(pdata, n)
Definition: arrayaccess.h:188
#define GET_DATA_DIBIT(pdata, n)
Definition: arrayaccess.h:145
#define SET_DATA_BYTE(pdata, n, val)
Definition: arrayaccess.h:198
#define GET_DATA_BIT(pdata, n)
Definition: arrayaccess.h:123
#define SET_DATA_QBIT(pdata, n, val)
Definition: arrayaccess.h:168
PIX * pixBilinearPtaWithAlpha(PIX *pixs, PTA *ptad, PTA *ptas, PIX *pixg, l_float32 fract, l_int32 border)
pixBilinearPtaWithAlpha()
Definition: bilinear.c:646
PIX * pixBilinearColor(PIX *pixs, l_float32 *vc, l_uint32 colorval)
pixBilinearColor()
Definition: bilinear.c:455
PIX * pixBilinearSampled(PIX *pixs, l_float32 *vc, l_int32 incolor)
pixBilinearSampled()
Definition: bilinear.c:195
l_ok bilinearXformPt(l_float32 *vc, l_int32 x, l_int32 y, l_float32 *pxp, l_float32 *pyp)
bilinearXformPt()
Definition: bilinear.c:898
PIX * pixBilinearPta(PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor)
pixBilinearPta()
Definition: bilinear.c:288
PIX * pixBilinear(PIX *pixs, l_float32 *vc, l_int32 incolor)
pixBilinear()
Definition: bilinear.c:358
l_ok bilinearXformSampledPt(l_float32 *vc, l_int32 x, l_int32 y, l_int32 *pxp, l_int32 *pyp)
bilinearXformSampledPt()
Definition: bilinear.c:865
PIX * pixBilinearSampledPta(PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor)
pixBilinearSampledPta()
Definition: bilinear.c:145
PIX * pixBilinearPtaGray(PIX *pixs, PTA *ptad, PTA *ptas, l_uint8 grayval)
pixBilinearPtaGray()
Definition: bilinear.c:517
PIX * pixBilinearPtaColor(PIX *pixs, PTA *ptad, PTA *ptas, l_uint32 colorval)
pixBilinearPtaColor()
Definition: bilinear.c:414
PIX * pixBilinearGray(PIX *pixs, l_float32 *vc, l_uint8 grayval)
pixBilinearGray()
Definition: bilinear.c:558
l_ok getBilinearXformCoeffs(PTA *ptas, PTA *ptad, l_float32 **pvc)
getBilinearXformCoeffs()
Definition: bilinear.c:778
l_ok pixcmapAddBlackOrWhite(PIXCMAP *cmap, l_int32 color, l_int32 *pindex)
pixcmapAddBlackOrWhite()
Definition: colormap.c:639
void pixDestroy(PIX **ppix)
pixDestroy()
Definition: pix1.c:621
l_ok pixGetDimensions(const PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
Definition: pix1.c:1113
PIX * pixClone(PIX *pixs)
pixClone()
Definition: pix1.c:593
PIX * pixCreateTemplate(const PIX *pixs)
pixCreateTemplate()
Definition: pix1.c:383
PIX * pixCreate(l_int32 width, l_int32 height, l_int32 depth)
pixCreate()
Definition: pix1.c:315
l_uint32 * pixGetData(PIX *pix)
pixGetData()
Definition: pix1.c:1763
l_ok pixSetBorderRingVal(PIX *pixs, l_int32 dist, l_uint32 val)
pixSetBorderRingVal()
Definition: pix2.c:1667
l_ok pixClearAll(PIX *pix)
pixClearAll()
Definition: pix2.c:789
l_ok pixSetAll(PIX *pix)
pixSetAll()
Definition: pix2.c:817
PIX * pixAddBorder(PIX *pixs, l_int32 npix, l_uint32 val)
pixAddBorder()
Definition: pix2.c:1823
PIX * pixGetRGBComponent(PIX *pixs, l_int32 comp)
pixGetRGBComponent()
Definition: pix2.c:2479
l_ok pixSetRGBComponent(PIX *pixd, PIX *pixs, l_int32 comp)
pixSetRGBComponent()
Definition: pix2.c:2538
l_ok pixSetAllArbitrary(PIX *pix, l_uint32 val)
pixSetAllArbitrary()
Definition: pix2.c:951
PIX * pixResizeToMatch(PIX *pixs, PIX *pixt, l_int32 w, l_int32 h)
pixResizeToMatch()
Definition: pix5.c:1321
@ L_ALPHA_CHANNEL
Definition: pix.h:207
@ REMOVE_CMAP_BASED_ON_SRC
Definition: pix.h:260
@ L_BRING_IN_BLACK
Definition: pix.h:870
@ L_BRING_IN_WHITE
Definition: pix.h:869
PIX * pixConvertTo8(PIX *pixs, l_int32 cmapflag)
pixConvertTo8()
Definition: pixconv.c:3133
PIX * pixRemoveColormap(PIX *pixs, l_int32 type)
pixRemoveColormap()
Definition: pixconv.c:328
l_ok ptaGetPt(PTA *pta, l_int32 index, l_float32 *px, l_float32 *py)
ptaGetPt()
Definition: ptabasic.c:548
l_int32 ptaGetCount(PTA *pta)
ptaGetCount()
Definition: ptabasic.c:527
void ptaDestroy(PTA **ppta)
ptaDestroy()
Definition: ptabasic.c:195
PTA * ptaTransform(PTA *ptas, l_int32 shiftx, l_int32 shifty, l_float32 scalex, l_float32 scaley)
ptaTransform()
Definition: ptafunc1.c:740
Definition: pix.h:139
Definition: pix.h:517