Leptonica  1.83.1
Image processing and image analysis suite
projective.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 
111 #ifdef HAVE_CONFIG_H
112 #include <config_auto.h>
113 #endif /* HAVE_CONFIG_H */
114 
115 #include <string.h>
116 #include <math.h>
117 #include "allheaders.h"
118 
119 extern l_float32 AlphaMaskBorderVals[2];
120 
121 /*------------------------------------------------------------n
122  * Sampled projective image transformation *
123  *-------------------------------------------------------------*/
143 PIX *
145  PTA *ptad,
146  PTA *ptas,
147  l_int32 incolor)
148 {
149 l_float32 *vc;
150 PIX *pixd;
151 
152  if (!pixs)
153  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
154  if (!ptas)
155  return (PIX *)ERROR_PTR("ptas not defined", __func__, NULL);
156  if (!ptad)
157  return (PIX *)ERROR_PTR("ptad not defined", __func__, NULL);
158  if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
159  return (PIX *)ERROR_PTR("invalid incolor", __func__, NULL);
160  if (ptaGetCount(ptas) != 4)
161  return (PIX *)ERROR_PTR("ptas count not 4", __func__, NULL);
162  if (ptaGetCount(ptad) != 4)
163  return (PIX *)ERROR_PTR("ptad count not 4", __func__, NULL);
164 
165  /* Get backwards transform from dest to src, and apply it */
166  getProjectiveXformCoeffs(ptad, ptas, &vc);
167  pixd = pixProjectiveSampled(pixs, vc, incolor);
168  LEPT_FREE(vc);
169 
170  return pixd;
171 }
172 
173 
191 PIX *
193  l_float32 *vc,
194  l_int32 incolor)
195 {
196 l_int32 i, j, w, h, d, x, y, wpls, wpld, color, cmapindex;
197 l_uint32 val;
198 l_uint32 *datas, *datad, *lines, *lined;
199 PIX *pixd;
200 PIXCMAP *cmap;
201 
202  if (!pixs)
203  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
204  if (!vc)
205  return (PIX *)ERROR_PTR("vc not defined", __func__, NULL);
206  if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
207  return (PIX *)ERROR_PTR("invalid incolor", __func__, NULL);
208  pixGetDimensions(pixs, &w, &h, &d);
209  if (d != 1 && d != 2 && d != 4 && d != 8 && d != 32)
210  return (PIX *)ERROR_PTR("depth not 1, 2, 4, 8 or 16", __func__, NULL);
211 
212  /* Init all dest pixels to color to be brought in from outside */
213  pixd = pixCreateTemplate(pixs);
214  if ((cmap = pixGetColormap(pixs)) != NULL) {
215  if (incolor == L_BRING_IN_WHITE)
216  color = 1;
217  else
218  color = 0;
219  pixcmapAddBlackOrWhite(cmap, color, &cmapindex);
220  pixSetAllArbitrary(pixd, cmapindex);
221  } else {
222  if ((d == 1 && incolor == L_BRING_IN_WHITE) ||
223  (d > 1 && incolor == L_BRING_IN_BLACK)) {
224  pixClearAll(pixd);
225  } else {
226  pixSetAll(pixd);
227  }
228  }
229 
230  /* Scan over the dest pixels */
231  datas = pixGetData(pixs);
232  wpls = pixGetWpl(pixs);
233  datad = pixGetData(pixd);
234  wpld = pixGetWpl(pixd);
235  for (i = 0; i < h; i++) {
236  lined = datad + i * wpld;
237  for (j = 0; j < w; j++) {
238  projectiveXformSampledPt(vc, j, i, &x, &y);
239  if (x < 0 || y < 0 || x >=w || y >= h)
240  continue;
241  lines = datas + y * wpls;
242  if (d == 1) {
243  val = GET_DATA_BIT(lines, x);
244  SET_DATA_BIT_VAL(lined, j, val);
245  } else if (d == 8) {
246  val = GET_DATA_BYTE(lines, x);
247  SET_DATA_BYTE(lined, j, val);
248  } else if (d == 32) {
249  lined[j] = lines[x];
250  } else if (d == 2) {
251  val = GET_DATA_DIBIT(lines, x);
252  SET_DATA_DIBIT(lined, j, val);
253  } else if (d == 4) {
254  val = GET_DATA_QBIT(lines, x);
255  SET_DATA_QBIT(lined, j, val);
256  }
257  }
258  }
259 
260  return pixd;
261 }
262 
263 
264 /*---------------------------------------------------------------------*
265  * Interpolated projective image transformation *
266  *---------------------------------------------------------------------*/
282 PIX *
284  PTA *ptad,
285  PTA *ptas,
286  l_int32 incolor)
287 {
288 l_int32 d;
289 l_uint32 colorval;
290 PIX *pixt1, *pixt2, *pixd;
291 
292  if (!pixs)
293  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
294  if (!ptas)
295  return (PIX *)ERROR_PTR("ptas not defined", __func__, NULL);
296  if (!ptad)
297  return (PIX *)ERROR_PTR("ptad not defined", __func__, NULL);
298  if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
299  return (PIX *)ERROR_PTR("invalid incolor", __func__, NULL);
300  if (ptaGetCount(ptas) != 4)
301  return (PIX *)ERROR_PTR("ptas count not 4", __func__, NULL);
302  if (ptaGetCount(ptad) != 4)
303  return (PIX *)ERROR_PTR("ptad count not 4", __func__, NULL);
304 
305  if (pixGetDepth(pixs) == 1)
306  return pixProjectiveSampledPta(pixs, ptad, ptas, incolor);
307 
308  /* Remove cmap if it exists, and unpack to 8 bpp if necessary */
310  d = pixGetDepth(pixt1);
311  if (d < 8)
312  pixt2 = pixConvertTo8(pixt1, FALSE);
313  else
314  pixt2 = pixClone(pixt1);
315  d = pixGetDepth(pixt2);
316 
317  /* Compute actual color to bring in from edges */
318  colorval = 0;
319  if (incolor == L_BRING_IN_WHITE) {
320  if (d == 8)
321  colorval = 255;
322  else /* d == 32 */
323  colorval = 0xffffff00;
324  }
325 
326  if (d == 8)
327  pixd = pixProjectivePtaGray(pixt2, ptad, ptas, colorval);
328  else /* d == 32 */
329  pixd = pixProjectivePtaColor(pixt2, ptad, ptas, colorval);
330  pixDestroy(&pixt1);
331  pixDestroy(&pixt2);
332  return pixd;
333 }
334 
335 
350 PIX *
352  l_float32 *vc,
353  l_int32 incolor)
354 {
355 l_int32 d;
356 l_uint32 colorval;
357 PIX *pixt1, *pixt2, *pixd;
358 
359  if (!pixs)
360  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
361  if (!vc)
362  return (PIX *)ERROR_PTR("vc not defined", __func__, NULL);
363 
364  if (pixGetDepth(pixs) == 1)
365  return pixProjectiveSampled(pixs, vc, incolor);
366 
367  /* Remove cmap if it exists, and unpack to 8 bpp if necessary */
369  d = pixGetDepth(pixt1);
370  if (d < 8)
371  pixt2 = pixConvertTo8(pixt1, FALSE);
372  else
373  pixt2 = pixClone(pixt1);
374  d = pixGetDepth(pixt2);
375 
376  /* Compute actual color to bring in from edges */
377  colorval = 0;
378  if (incolor == L_BRING_IN_WHITE) {
379  if (d == 8)
380  colorval = 255;
381  else /* d == 32 */
382  colorval = 0xffffff00;
383  }
384 
385  if (d == 8)
386  pixd = pixProjectiveGray(pixt2, vc, colorval);
387  else /* d == 32 */
388  pixd = pixProjectiveColor(pixt2, vc, colorval);
389  pixDestroy(&pixt1);
390  pixDestroy(&pixt2);
391  return pixd;
392 }
393 
394 
404 PIX *
406  PTA *ptad,
407  PTA *ptas,
408  l_uint32 colorval)
409 {
410 l_float32 *vc;
411 PIX *pixd;
412 
413  if (!pixs)
414  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
415  if (!ptas)
416  return (PIX *)ERROR_PTR("ptas not defined", __func__, NULL);
417  if (!ptad)
418  return (PIX *)ERROR_PTR("ptad not defined", __func__, NULL);
419  if (pixGetDepth(pixs) != 32)
420  return (PIX *)ERROR_PTR("pixs must be 32 bpp", __func__, NULL);
421  if (ptaGetCount(ptas) != 4)
422  return (PIX *)ERROR_PTR("ptas count not 4", __func__, NULL);
423  if (ptaGetCount(ptad) != 4)
424  return (PIX *)ERROR_PTR("ptad count not 4", __func__, NULL);
425 
426  /* Get backwards transform from dest to src, and apply it */
427  getProjectiveXformCoeffs(ptad, ptas, &vc);
428  pixd = pixProjectiveColor(pixs, vc, colorval);
429  LEPT_FREE(vc);
430 
431  return pixd;
432 }
433 
434 
443 PIX *
445  l_float32 *vc,
446  l_uint32 colorval)
447 {
448 l_int32 i, j, w, h, d, wpls, wpld;
449 l_uint32 val;
450 l_uint32 *datas, *datad, *lined;
451 l_float32 x, y;
452 PIX *pix1, *pix2, *pixd;
453 
454  if (!pixs)
455  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
456  pixGetDimensions(pixs, &w, &h, &d);
457  if (d != 32)
458  return (PIX *)ERROR_PTR("pixs must be 32 bpp", __func__, NULL);
459  if (!vc)
460  return (PIX *)ERROR_PTR("vc not defined", __func__, NULL);
461 
462  datas = pixGetData(pixs);
463  wpls = pixGetWpl(pixs);
464  pixd = pixCreateTemplate(pixs);
465  pixSetAllArbitrary(pixd, colorval);
466  datad = pixGetData(pixd);
467  wpld = pixGetWpl(pixd);
468 
469  /* Iterate over destination pixels */
470  for (i = 0; i < h; i++) {
471  lined = datad + i * wpld;
472  for (j = 0; j < w; j++) {
473  /* Compute float src pixel location corresponding to (i,j) */
474  projectiveXformPt(vc, j, i, &x, &y);
475  linearInterpolatePixelColor(datas, wpls, w, h, x, y, colorval,
476  &val);
477  *(lined + j) = val;
478  }
479  }
480 
481  /* If rgba, transform the pixs alpha channel and insert in pixd */
482  if (pixGetSpp(pixs) == 4) {
483  pix1 = pixGetRGBComponent(pixs, L_ALPHA_CHANNEL);
484  pix2 = pixProjectiveGray(pix1, vc, 255); /* bring in opaque */
485  pixSetRGBComponent(pixd, pix2, L_ALPHA_CHANNEL);
486  pixDestroy(&pix1);
487  pixDestroy(&pix2);
488  }
489 
490  return pixd;
491 }
492 
493 
503 PIX *
505  PTA *ptad,
506  PTA *ptas,
507  l_uint8 grayval)
508 {
509 l_float32 *vc;
510 PIX *pixd;
511 
512  if (!pixs)
513  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
514  if (!ptas)
515  return (PIX *)ERROR_PTR("ptas not defined", __func__, NULL);
516  if (!ptad)
517  return (PIX *)ERROR_PTR("ptad not defined", __func__, NULL);
518  if (pixGetDepth(pixs) != 8)
519  return (PIX *)ERROR_PTR("pixs must be 8 bpp", __func__, NULL);
520  if (ptaGetCount(ptas) != 4)
521  return (PIX *)ERROR_PTR("ptas count not 4", __func__, NULL);
522  if (ptaGetCount(ptad) != 4)
523  return (PIX *)ERROR_PTR("ptad count not 4", __func__, NULL);
524 
525  /* Get backwards transform from dest to src, and apply it */
526  getProjectiveXformCoeffs(ptad, ptas, &vc);
527  pixd = pixProjectiveGray(pixs, vc, grayval);
528  LEPT_FREE(vc);
529 
530  return pixd;
531 }
532 
533 
534 
543 PIX *
545  l_float32 *vc,
546  l_uint8 grayval)
547 {
548 l_int32 i, j, w, h, wpls, wpld, val;
549 l_uint32 *datas, *datad, *lined;
550 l_float32 x, y;
551 PIX *pixd;
552 
553  if (!pixs)
554  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
555  pixGetDimensions(pixs, &w, &h, NULL);
556  if (pixGetDepth(pixs) != 8)
557  return (PIX *)ERROR_PTR("pixs must be 8 bpp", __func__, NULL);
558  if (!vc)
559  return (PIX *)ERROR_PTR("vc not defined", __func__, NULL);
560 
561  datas = pixGetData(pixs);
562  wpls = pixGetWpl(pixs);
563  pixd = pixCreateTemplate(pixs);
564  pixSetAllArbitrary(pixd, grayval);
565  datad = pixGetData(pixd);
566  wpld = pixGetWpl(pixd);
567 
568  /* Iterate over destination pixels */
569  for (i = 0; i < h; i++) {
570  lined = datad + i * wpld;
571  for (j = 0; j < w; j++) {
572  /* Compute float src pixel location corresponding to (i,j) */
573  projectiveXformPt(vc, j, i, &x, &y);
574  linearInterpolatePixelGray(datas, wpls, w, h, x, y, grayval, &val);
575  SET_DATA_BYTE(lined, j, val);
576  }
577  }
578 
579  return pixd;
580 }
581 
582 
583 /*---------------------------------------------------------------------------*
584  * Projective transform including alpha (blend) component *
585  *---------------------------------------------------------------------------*/
630 PIX *
632  PTA *ptad,
633  PTA *ptas,
634  PIX *pixg,
635  l_float32 fract,
636  l_int32 border)
637 {
638 l_int32 ws, hs, d;
639 PIX *pixd, *pixb1, *pixb2, *pixg2, *pixga;
640 PTA *ptad2, *ptas2;
641 
642  if (!pixs)
643  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
644  pixGetDimensions(pixs, &ws, &hs, &d);
645  if (d != 32 && pixGetColormap(pixs) == NULL)
646  return (PIX *)ERROR_PTR("pixs not cmapped or 32 bpp", __func__, NULL);
647  if (pixg && pixGetDepth(pixg) != 8) {
648  L_WARNING("pixg not 8 bpp; using 'fract' transparent alpha\n",
649  __func__);
650  pixg = NULL;
651  }
652  if (!pixg && (fract < 0.0 || fract > 1.0)) {
653  L_WARNING("invalid fract; using 1.0 (fully transparent)\n", __func__);
654  fract = 1.0;
655  }
656  if (!pixg && fract == 0.0)
657  L_WARNING("fully opaque alpha; image will not be blended\n", __func__);
658  if (!ptad)
659  return (PIX *)ERROR_PTR("ptad not defined", __func__, NULL);
660  if (!ptas)
661  return (PIX *)ERROR_PTR("ptas not defined", __func__, NULL);
662 
663  /* Add border; the color doesn't matter */
664  pixb1 = pixAddBorder(pixs, border, 0);
665 
666  /* Transform the ptr arrays to work on the bordered image */
667  ptad2 = ptaTransform(ptad, border, border, 1.0, 1.0);
668  ptas2 = ptaTransform(ptas, border, border, 1.0, 1.0);
669 
670  /* Do separate projective transform of rgb channels of pixs
671  * and of pixg */
672  pixd = pixProjectivePtaColor(pixb1, ptad2, ptas2, 0);
673  if (!pixg) {
674  pixg2 = pixCreate(ws, hs, 8);
675  if (fract == 1.0)
676  pixSetAll(pixg2);
677  else
678  pixSetAllArbitrary(pixg2, (l_int32)(255.0 * fract));
679  } else {
680  pixg2 = pixResizeToMatch(pixg, NULL, ws, hs);
681  }
682  if (ws > 10 && hs > 10) { /* see note 7 */
683  pixSetBorderRingVal(pixg2, 1,
684  (l_int32)(255.0 * fract * AlphaMaskBorderVals[0]));
685  pixSetBorderRingVal(pixg2, 2,
686  (l_int32)(255.0 * fract * AlphaMaskBorderVals[1]));
687 
688  }
689  pixb2 = pixAddBorder(pixg2, border, 0); /* must be black border */
690  pixga = pixProjectivePtaGray(pixb2, ptad2, ptas2, 0);
691  pixSetRGBComponent(pixd, pixga, L_ALPHA_CHANNEL);
692  pixSetSpp(pixd, 4);
693 
694  pixDestroy(&pixg2);
695  pixDestroy(&pixb1);
696  pixDestroy(&pixb2);
697  pixDestroy(&pixga);
698  ptaDestroy(&ptad2);
699  ptaDestroy(&ptas2);
700  return pixd;
701 }
702 
703 
704 /*-------------------------------------------------------------*
705  * Projective coordinate transformation *
706  *-------------------------------------------------------------*/
759 l_ok
761  PTA *ptad,
762  l_float32 **pvc)
763 {
764 l_int32 i;
765 l_float32 x1, y1, x2, y2, x3, y3, x4, y4;
766 l_float32 *b; /* rhs vector of primed coords X'; coeffs returned in *pvc */
767 l_float32 *a[8]; /* 8x8 matrix A */
768 
769  if (!ptas)
770  return ERROR_INT("ptas not defined", __func__, 1);
771  if (!ptad)
772  return ERROR_INT("ptad not defined", __func__, 1);
773  if (!pvc)
774  return ERROR_INT("&vc not defined", __func__, 1);
775 
776  b = (l_float32 *)LEPT_CALLOC(8, sizeof(l_float32));
777  *pvc = b;
778  ptaGetPt(ptas, 0, &x1, &y1);
779  ptaGetPt(ptas, 1, &x2, &y2);
780  ptaGetPt(ptas, 2, &x3, &y3);
781  ptaGetPt(ptas, 3, &x4, &y4);
782  ptaGetPt(ptad, 0, &b[0], &b[1]);
783  ptaGetPt(ptad, 1, &b[2], &b[3]);
784  ptaGetPt(ptad, 2, &b[4], &b[5]);
785  ptaGetPt(ptad, 3, &b[6], &b[7]);
786 
787  for (i = 0; i < 8; i++)
788  a[i] = (l_float32 *)LEPT_CALLOC(8, sizeof(l_float32));
789  a[0][0] = x1;
790  a[0][1] = y1;
791  a[0][2] = 1.;
792  a[0][6] = -x1 * b[0];
793  a[0][7] = -y1 * b[0];
794  a[1][3] = x1;
795  a[1][4] = y1;
796  a[1][5] = 1;
797  a[1][6] = -x1 * b[1];
798  a[1][7] = -y1 * b[1];
799  a[2][0] = x2;
800  a[2][1] = y2;
801  a[2][2] = 1.;
802  a[2][6] = -x2 * b[2];
803  a[2][7] = -y2 * b[2];
804  a[3][3] = x2;
805  a[3][4] = y2;
806  a[3][5] = 1;
807  a[3][6] = -x2 * b[3];
808  a[3][7] = -y2 * b[3];
809  a[4][0] = x3;
810  a[4][1] = y3;
811  a[4][2] = 1.;
812  a[4][6] = -x3 * b[4];
813  a[4][7] = -y3 * b[4];
814  a[5][3] = x3;
815  a[5][4] = y3;
816  a[5][5] = 1;
817  a[5][6] = -x3 * b[5];
818  a[5][7] = -y3 * b[5];
819  a[6][0] = x4;
820  a[6][1] = y4;
821  a[6][2] = 1.;
822  a[6][6] = -x4 * b[6];
823  a[6][7] = -y4 * b[6];
824  a[7][3] = x4;
825  a[7][4] = y4;
826  a[7][5] = 1;
827  a[7][6] = -x4 * b[7];
828  a[7][7] = -y4 * b[7];
829 
830  gaussjordan(a, b, 8);
831 
832  for (i = 0; i < 8; i++)
833  LEPT_FREE(a[i]);
834 
835  return 0;
836 }
837 
838 
853 l_ok
855  l_int32 x,
856  l_int32 y,
857  l_int32 *pxp,
858  l_int32 *pyp)
859 {
860 l_float32 factor;
861 l_float64 denom;
862 
863  if (!vc)
864  return ERROR_INT("vc not defined", __func__, 1);
865 
866  if ((denom = vc[6] * x + vc[7] * y + 1.0) == 0.0)
867  return ERROR_INT("denom = 0.0", __func__, 1);
868  factor = 1.0 / denom;
869  *pxp = (l_int32)(factor * (vc[0] * x + vc[1] * y + vc[2]) + 0.5);
870  *pyp = (l_int32)(factor * (vc[3] * x + vc[4] * y + vc[5]) + 0.5);
871  return 0;
872 }
873 
874 
889 l_ok
890 projectiveXformPt(l_float32 *vc,
891  l_int32 x,
892  l_int32 y,
893  l_float32 *pxp,
894  l_float32 *pyp)
895 {
896 l_float32 factor;
897 l_float64 denom;
898 
899  if (!vc)
900  return ERROR_INT("vc not defined", __func__, 1);
901 
902  if ((denom = vc[6] * x + vc[7] * y + 1.0) == 0.0)
903  return ERROR_INT("denom = 0.0", __func__, 1);
904  factor = 1.0 / denom;
905  *pxp = factor * (vc[0] * x + vc[1] * y + vc[2]);
906  *pyp = factor * (vc[3] * x + vc[4] * y + vc[5]);
907  return 0;
908 }
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:1153
l_int32 gaussjordan(l_float32 **a, l_float32 *b, l_int32 n)
gaussjordan()
Definition: affine.c:1314
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:1237
#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
l_ok pixcmapAddBlackOrWhite(PIXCMAP *cmap, l_int32 color, l_int32 *pindex)
pixcmapAddBlackOrWhite()
Definition: colormap.c:618
l_uint32 * pixGetData(PIX *pix)
pixGetData()
Definition: pix1.c:1642
void pixDestroy(PIX **ppix)
pixDestroy()
Definition: pix1.c:608
l_ok pixGetDimensions(const PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
Definition: pix1.c:1074
PIX * pixCreateTemplate(const PIX *pixs)
pixCreateTemplate()
Definition: pix1.c:380
PIX * pixCreate(l_int32 width, l_int32 height, l_int32 depth)
pixCreate()
Definition: pix1.c:315
PIX * pixClone(PIX *pixs)
pixClone()
Definition: pix1.c:582
l_ok pixSetBorderRingVal(PIX *pixs, l_int32 dist, l_uint32 val)
pixSetBorderRingVal()
Definition: pix2.c:1623
PIX * pixGetRGBComponent(PIX *pixs, l_int32 comp)
pixGetRGBComponent()
Definition: pix2.c:2464
l_ok pixClearAll(PIX *pix)
pixClearAll()
Definition: pix2.c:773
PIX * pixAddBorder(PIX *pixs, l_int32 npix, l_uint32 val)
pixAddBorder()
Definition: pix2.c:1773
l_ok pixSetAll(PIX *pix)
pixSetAll()
Definition: pix2.c:799
l_ok pixSetRGBComponent(PIX *pixd, PIX *pixs, l_int32 comp)
pixSetRGBComponent()
Definition: pix2.c:2521
l_ok pixSetAllArbitrary(PIX *pix, l_uint32 val)
pixSetAllArbitrary()
Definition: pix2.c:929
PIX * pixResizeToMatch(PIX *pixs, PIX *pixt, l_int32 w, l_int32 h)
pixResizeToMatch()
Definition: pix5.c:1279
@ L_ALPHA_CHANNEL
Definition: pix.h:331
@ REMOVE_CMAP_BASED_ON_SRC
Definition: pix.h:384
@ L_BRING_IN_BLACK
Definition: pix.h:663
@ L_BRING_IN_WHITE
Definition: pix.h:662
PIX * pixRemoveColormap(PIX *pixs, l_int32 type)
pixRemoveColormap()
Definition: pixconv.c:324
PIX * pixConvertTo8(PIX *pixs, l_int32 cmapflag)
pixConvertTo8()
Definition: pixconv.c:3055
PIX * pixProjectivePtaGray(PIX *pixs, PTA *ptad, PTA *ptas, l_uint8 grayval)
pixProjectivePtaGray()
Definition: projective.c:504
PIX * pixProjective(PIX *pixs, l_float32 *vc, l_int32 incolor)
pixProjective()
Definition: projective.c:351
l_ok getProjectiveXformCoeffs(PTA *ptas, PTA *ptad, l_float32 **pvc)
getProjectiveXformCoeffs()
Definition: projective.c:760
PIX * pixProjectiveGray(PIX *pixs, l_float32 *vc, l_uint8 grayval)
pixProjectiveGray()
Definition: projective.c:544
PIX * pixProjectiveColor(PIX *pixs, l_float32 *vc, l_uint32 colorval)
pixProjectiveColor()
Definition: projective.c:444
PIX * pixProjectiveSampled(PIX *pixs, l_float32 *vc, l_int32 incolor)
pixProjectiveSampled()
Definition: projective.c:192
l_ok projectiveXformSampledPt(l_float32 *vc, l_int32 x, l_int32 y, l_int32 *pxp, l_int32 *pyp)
projectiveXformSampledPt()
Definition: projective.c:854
PIX * pixProjectivePta(PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor)
pixProjectivePta()
Definition: projective.c:283
PIX * pixProjectivePtaWithAlpha(PIX *pixs, PTA *ptad, PTA *ptas, PIX *pixg, l_float32 fract, l_int32 border)
pixProjectivePtaWithAlpha()
Definition: projective.c:631
l_ok projectiveXformPt(l_float32 *vc, l_int32 x, l_int32 y, l_float32 *pxp, l_float32 *pyp)
projectiveXformPt()
Definition: projective.c:890
PIX * pixProjectivePtaColor(PIX *pixs, PTA *ptad, PTA *ptas, l_uint32 colorval)
pixProjectivePtaColor()
Definition: projective.c:405
PIX * pixProjectiveSampledPta(PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor)
pixProjectiveSampledPta()
Definition: projective.c:144
l_ok ptaGetPt(PTA *pta, l_int32 index, l_float32 *px, l_float32 *py)
ptaGetPt()
Definition: ptabasic.c:499
l_int32 ptaGetCount(PTA *pta)
ptaGetCount()
Definition: ptabasic.c:480
void ptaDestroy(PTA **ppta)
ptaDestroy()
Definition: ptabasic.c:191
PTA * ptaTransform(PTA *ptas, l_int32 shiftx, l_int32 shifty, l_float32 scalex, l_float32 scaley)
ptaTransform()
Definition: ptafunc1.c:715