Leptonica  1.82.0
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  PROCNAME("pixProjectiveSampledPta");
153 
154  if (!pixs)
155  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
156  if (!ptas)
157  return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
158  if (!ptad)
159  return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
160  if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
161  return (PIX *)ERROR_PTR("invalid incolor", procName, NULL);
162  if (ptaGetCount(ptas) != 4)
163  return (PIX *)ERROR_PTR("ptas count not 4", procName, NULL);
164  if (ptaGetCount(ptad) != 4)
165  return (PIX *)ERROR_PTR("ptad count not 4", procName, NULL);
166 
167  /* Get backwards transform from dest to src, and apply it */
168  getProjectiveXformCoeffs(ptad, ptas, &vc);
169  pixd = pixProjectiveSampled(pixs, vc, incolor);
170  LEPT_FREE(vc);
171 
172  return pixd;
173 }
174 
175 
193 PIX *
195  l_float32 *vc,
196  l_int32 incolor)
197 {
198 l_int32 i, j, w, h, d, x, y, wpls, wpld, color, cmapindex;
199 l_uint32 val;
200 l_uint32 *datas, *datad, *lines, *lined;
201 PIX *pixd;
202 PIXCMAP *cmap;
203 
204  PROCNAME("pixProjectiveSampled");
205 
206  if (!pixs)
207  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
208  if (!vc)
209  return (PIX *)ERROR_PTR("vc not defined", procName, NULL);
210  if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
211  return (PIX *)ERROR_PTR("invalid incolor", procName, NULL);
212  pixGetDimensions(pixs, &w, &h, &d);
213  if (d != 1 && d != 2 && d != 4 && d != 8 && d != 32)
214  return (PIX *)ERROR_PTR("depth not 1, 2, 4, 8 or 16", procName, NULL);
215 
216  /* Init all dest pixels to color to be brought in from outside */
217  pixd = pixCreateTemplate(pixs);
218  if ((cmap = pixGetColormap(pixs)) != NULL) {
219  if (incolor == L_BRING_IN_WHITE)
220  color = 1;
221  else
222  color = 0;
223  pixcmapAddBlackOrWhite(cmap, color, &cmapindex);
224  pixSetAllArbitrary(pixd, cmapindex);
225  } else {
226  if ((d == 1 && incolor == L_BRING_IN_WHITE) ||
227  (d > 1 && incolor == L_BRING_IN_BLACK)) {
228  pixClearAll(pixd);
229  } else {
230  pixSetAll(pixd);
231  }
232  }
233 
234  /* Scan over the dest pixels */
235  datas = pixGetData(pixs);
236  wpls = pixGetWpl(pixs);
237  datad = pixGetData(pixd);
238  wpld = pixGetWpl(pixd);
239  for (i = 0; i < h; i++) {
240  lined = datad + i * wpld;
241  for (j = 0; j < w; j++) {
242  projectiveXformSampledPt(vc, j, i, &x, &y);
243  if (x < 0 || y < 0 || x >=w || y >= h)
244  continue;
245  lines = datas + y * wpls;
246  if (d == 1) {
247  val = GET_DATA_BIT(lines, x);
248  SET_DATA_BIT_VAL(lined, j, val);
249  } else if (d == 8) {
250  val = GET_DATA_BYTE(lines, x);
251  SET_DATA_BYTE(lined, j, val);
252  } else if (d == 32) {
253  lined[j] = lines[x];
254  } else if (d == 2) {
255  val = GET_DATA_DIBIT(lines, x);
256  SET_DATA_DIBIT(lined, j, val);
257  } else if (d == 4) {
258  val = GET_DATA_QBIT(lines, x);
259  SET_DATA_QBIT(lined, j, val);
260  }
261  }
262  }
263 
264  return pixd;
265 }
266 
267 
268 /*---------------------------------------------------------------------*
269  * Interpolated projective image transformation *
270  *---------------------------------------------------------------------*/
286 PIX *
288  PTA *ptad,
289  PTA *ptas,
290  l_int32 incolor)
291 {
292 l_int32 d;
293 l_uint32 colorval;
294 PIX *pixt1, *pixt2, *pixd;
295 
296  PROCNAME("pixProjectivePta");
297 
298  if (!pixs)
299  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
300  if (!ptas)
301  return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
302  if (!ptad)
303  return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
304  if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
305  return (PIX *)ERROR_PTR("invalid incolor", procName, NULL);
306  if (ptaGetCount(ptas) != 4)
307  return (PIX *)ERROR_PTR("ptas count not 4", procName, NULL);
308  if (ptaGetCount(ptad) != 4)
309  return (PIX *)ERROR_PTR("ptad count not 4", procName, NULL);
310 
311  if (pixGetDepth(pixs) == 1)
312  return pixProjectiveSampledPta(pixs, ptad, ptas, incolor);
313 
314  /* Remove cmap if it exists, and unpack to 8 bpp if necessary */
316  d = pixGetDepth(pixt1);
317  if (d < 8)
318  pixt2 = pixConvertTo8(pixt1, FALSE);
319  else
320  pixt2 = pixClone(pixt1);
321  d = pixGetDepth(pixt2);
322 
323  /* Compute actual color to bring in from edges */
324  colorval = 0;
325  if (incolor == L_BRING_IN_WHITE) {
326  if (d == 8)
327  colorval = 255;
328  else /* d == 32 */
329  colorval = 0xffffff00;
330  }
331 
332  if (d == 8)
333  pixd = pixProjectivePtaGray(pixt2, ptad, ptas, colorval);
334  else /* d == 32 */
335  pixd = pixProjectivePtaColor(pixt2, ptad, ptas, colorval);
336  pixDestroy(&pixt1);
337  pixDestroy(&pixt2);
338  return pixd;
339 }
340 
341 
356 PIX *
358  l_float32 *vc,
359  l_int32 incolor)
360 {
361 l_int32 d;
362 l_uint32 colorval;
363 PIX *pixt1, *pixt2, *pixd;
364 
365  PROCNAME("pixProjective");
366 
367  if (!pixs)
368  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
369  if (!vc)
370  return (PIX *)ERROR_PTR("vc not defined", procName, NULL);
371 
372  if (pixGetDepth(pixs) == 1)
373  return pixProjectiveSampled(pixs, vc, incolor);
374 
375  /* Remove cmap if it exists, and unpack to 8 bpp if necessary */
377  d = pixGetDepth(pixt1);
378  if (d < 8)
379  pixt2 = pixConvertTo8(pixt1, FALSE);
380  else
381  pixt2 = pixClone(pixt1);
382  d = pixGetDepth(pixt2);
383 
384  /* Compute actual color to bring in from edges */
385  colorval = 0;
386  if (incolor == L_BRING_IN_WHITE) {
387  if (d == 8)
388  colorval = 255;
389  else /* d == 32 */
390  colorval = 0xffffff00;
391  }
392 
393  if (d == 8)
394  pixd = pixProjectiveGray(pixt2, vc, colorval);
395  else /* d == 32 */
396  pixd = pixProjectiveColor(pixt2, vc, colorval);
397  pixDestroy(&pixt1);
398  pixDestroy(&pixt2);
399  return pixd;
400 }
401 
402 
412 PIX *
414  PTA *ptad,
415  PTA *ptas,
416  l_uint32 colorval)
417 {
418 l_float32 *vc;
419 PIX *pixd;
420 
421  PROCNAME("pixProjectivePtaColor");
422 
423  if (!pixs)
424  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
425  if (!ptas)
426  return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
427  if (!ptad)
428  return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
429  if (pixGetDepth(pixs) != 32)
430  return (PIX *)ERROR_PTR("pixs must be 32 bpp", procName, NULL);
431  if (ptaGetCount(ptas) != 4)
432  return (PIX *)ERROR_PTR("ptas count not 4", procName, NULL);
433  if (ptaGetCount(ptad) != 4)
434  return (PIX *)ERROR_PTR("ptad count not 4", procName, NULL);
435 
436  /* Get backwards transform from dest to src, and apply it */
437  getProjectiveXformCoeffs(ptad, ptas, &vc);
438  pixd = pixProjectiveColor(pixs, vc, colorval);
439  LEPT_FREE(vc);
440 
441  return pixd;
442 }
443 
444 
453 PIX *
455  l_float32 *vc,
456  l_uint32 colorval)
457 {
458 l_int32 i, j, w, h, d, wpls, wpld;
459 l_uint32 val;
460 l_uint32 *datas, *datad, *lined;
461 l_float32 x, y;
462 PIX *pix1, *pix2, *pixd;
463 
464  PROCNAME("pixProjectiveColor");
465 
466  if (!pixs)
467  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
468  pixGetDimensions(pixs, &w, &h, &d);
469  if (d != 32)
470  return (PIX *)ERROR_PTR("pixs must be 32 bpp", procName, NULL);
471  if (!vc)
472  return (PIX *)ERROR_PTR("vc not defined", procName, NULL);
473 
474  datas = pixGetData(pixs);
475  wpls = pixGetWpl(pixs);
476  pixd = pixCreateTemplate(pixs);
477  pixSetAllArbitrary(pixd, colorval);
478  datad = pixGetData(pixd);
479  wpld = pixGetWpl(pixd);
480 
481  /* Iterate over destination pixels */
482  for (i = 0; i < h; i++) {
483  lined = datad + i * wpld;
484  for (j = 0; j < w; j++) {
485  /* Compute float src pixel location corresponding to (i,j) */
486  projectiveXformPt(vc, j, i, &x, &y);
487  linearInterpolatePixelColor(datas, wpls, w, h, x, y, colorval,
488  &val);
489  *(lined + j) = val;
490  }
491  }
492 
493  /* If rgba, transform the pixs alpha channel and insert in pixd */
494  if (pixGetSpp(pixs) == 4) {
495  pix1 = pixGetRGBComponent(pixs, L_ALPHA_CHANNEL);
496  pix2 = pixProjectiveGray(pix1, vc, 255); /* bring in opaque */
497  pixSetRGBComponent(pixd, pix2, L_ALPHA_CHANNEL);
498  pixDestroy(&pix1);
499  pixDestroy(&pix2);
500  }
501 
502  return pixd;
503 }
504 
505 
515 PIX *
517  PTA *ptad,
518  PTA *ptas,
519  l_uint8 grayval)
520 {
521 l_float32 *vc;
522 PIX *pixd;
523 
524  PROCNAME("pixProjectivePtaGray");
525 
526  if (!pixs)
527  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
528  if (!ptas)
529  return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
530  if (!ptad)
531  return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
532  if (pixGetDepth(pixs) != 8)
533  return (PIX *)ERROR_PTR("pixs must be 8 bpp", procName, NULL);
534  if (ptaGetCount(ptas) != 4)
535  return (PIX *)ERROR_PTR("ptas count not 4", procName, NULL);
536  if (ptaGetCount(ptad) != 4)
537  return (PIX *)ERROR_PTR("ptad count not 4", procName, NULL);
538 
539  /* Get backwards transform from dest to src, and apply it */
540  getProjectiveXformCoeffs(ptad, ptas, &vc);
541  pixd = pixProjectiveGray(pixs, vc, grayval);
542  LEPT_FREE(vc);
543 
544  return pixd;
545 }
546 
547 
548 
557 PIX *
559  l_float32 *vc,
560  l_uint8 grayval)
561 {
562 l_int32 i, j, w, h, wpls, wpld, val;
563 l_uint32 *datas, *datad, *lined;
564 l_float32 x, y;
565 PIX *pixd;
566 
567  PROCNAME("pixProjectiveGray");
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  projectiveXformPt(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  * Projective transform including alpha (blend) component *
601  *---------------------------------------------------------------------------*/
646 PIX *
648  PTA *ptad,
649  PTA *ptas,
650  PIX *pixg,
651  l_float32 fract,
652  l_int32 border)
653 {
654 l_int32 ws, hs, d;
655 PIX *pixd, *pixb1, *pixb2, *pixg2, *pixga;
656 PTA *ptad2, *ptas2;
657 
658  PROCNAME("pixProjectivePtaWithAlpha");
659 
660  if (!pixs)
661  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
662  pixGetDimensions(pixs, &ws, &hs, &d);
663  if (d != 32 && pixGetColormap(pixs) == NULL)
664  return (PIX *)ERROR_PTR("pixs not cmapped or 32 bpp", procName, NULL);
665  if (pixg && pixGetDepth(pixg) != 8) {
666  L_WARNING("pixg not 8 bpp; using 'fract' transparent alpha\n",
667  procName);
668  pixg = NULL;
669  }
670  if (!pixg && (fract < 0.0 || fract > 1.0)) {
671  L_WARNING("invalid fract; using 1.0 (fully transparent)\n", procName);
672  fract = 1.0;
673  }
674  if (!pixg && fract == 0.0)
675  L_WARNING("fully opaque alpha; image will not be blended\n", procName);
676  if (!ptad)
677  return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
678  if (!ptas)
679  return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
680 
681  /* Add border; the color doesn't matter */
682  pixb1 = pixAddBorder(pixs, border, 0);
683 
684  /* Transform the ptr arrays to work on the bordered image */
685  ptad2 = ptaTransform(ptad, border, border, 1.0, 1.0);
686  ptas2 = ptaTransform(ptas, border, border, 1.0, 1.0);
687 
688  /* Do separate projective transform of rgb channels of pixs
689  * and of pixg */
690  pixd = pixProjectivePtaColor(pixb1, ptad2, ptas2, 0);
691  if (!pixg) {
692  pixg2 = pixCreate(ws, hs, 8);
693  if (fract == 1.0)
694  pixSetAll(pixg2);
695  else
696  pixSetAllArbitrary(pixg2, (l_int32)(255.0 * fract));
697  } else {
698  pixg2 = pixResizeToMatch(pixg, NULL, ws, hs);
699  }
700  if (ws > 10 && hs > 10) { /* see note 7 */
701  pixSetBorderRingVal(pixg2, 1,
702  (l_int32)(255.0 * fract * AlphaMaskBorderVals[0]));
703  pixSetBorderRingVal(pixg2, 2,
704  (l_int32)(255.0 * fract * AlphaMaskBorderVals[1]));
705 
706  }
707  pixb2 = pixAddBorder(pixg2, border, 0); /* must be black border */
708  pixga = pixProjectivePtaGray(pixb2, ptad2, ptas2, 0);
709  pixSetRGBComponent(pixd, pixga, L_ALPHA_CHANNEL);
710  pixSetSpp(pixd, 4);
711 
712  pixDestroy(&pixg2);
713  pixDestroy(&pixb1);
714  pixDestroy(&pixb2);
715  pixDestroy(&pixga);
716  ptaDestroy(&ptad2);
717  ptaDestroy(&ptas2);
718  return pixd;
719 }
720 
721 
722 /*-------------------------------------------------------------*
723  * Projective coordinate transformation *
724  *-------------------------------------------------------------*/
777 l_ok
779  PTA *ptad,
780  l_float32 **pvc)
781 {
782 l_int32 i;
783 l_float32 x1, y1, x2, y2, x3, y3, x4, y4;
784 l_float32 *b; /* rhs vector of primed coords X'; coeffs returned in *pvc */
785 l_float32 *a[8]; /* 8x8 matrix A */
786 
787  PROCNAME("getProjectiveXformCoeffs");
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] = 1.;
812  a[0][6] = -x1 * b[0];
813  a[0][7] = -y1 * b[0];
814  a[1][3] = x1;
815  a[1][4] = y1;
816  a[1][5] = 1;
817  a[1][6] = -x1 * b[1];
818  a[1][7] = -y1 * b[1];
819  a[2][0] = x2;
820  a[2][1] = y2;
821  a[2][2] = 1.;
822  a[2][6] = -x2 * b[2];
823  a[2][7] = -y2 * b[2];
824  a[3][3] = x2;
825  a[3][4] = y2;
826  a[3][5] = 1;
827  a[3][6] = -x2 * b[3];
828  a[3][7] = -y2 * b[3];
829  a[4][0] = x3;
830  a[4][1] = y3;
831  a[4][2] = 1.;
832  a[4][6] = -x3 * b[4];
833  a[4][7] = -y3 * b[4];
834  a[5][3] = x3;
835  a[5][4] = y3;
836  a[5][5] = 1;
837  a[5][6] = -x3 * b[5];
838  a[5][7] = -y3 * b[5];
839  a[6][0] = x4;
840  a[6][1] = y4;
841  a[6][2] = 1.;
842  a[6][6] = -x4 * b[6];
843  a[6][7] = -y4 * b[6];
844  a[7][3] = x4;
845  a[7][4] = y4;
846  a[7][5] = 1;
847  a[7][6] = -x4 * b[7];
848  a[7][7] = -y4 * b[7];
849 
850  gaussjordan(a, b, 8);
851 
852  for (i = 0; i < 8; i++)
853  LEPT_FREE(a[i]);
854 
855  return 0;
856 }
857 
858 
873 l_ok
875  l_int32 x,
876  l_int32 y,
877  l_int32 *pxp,
878  l_int32 *pyp)
879 {
880 l_float32 factor;
881 l_float64 denom;
882 
883  PROCNAME("projectiveXformSampledPt");
884 
885  if (!vc)
886  return ERROR_INT("vc not defined", procName, 1);
887 
888  if ((denom = vc[6] * x + vc[7] * y + 1.0) == 0.0)
889  return ERROR_INT("denom = 0.0", procName, 1);
890  factor = 1.0 / denom;
891  *pxp = (l_int32)(factor * (vc[0] * x + vc[1] * y + vc[2]) + 0.5);
892  *pyp = (l_int32)(factor * (vc[3] * x + vc[4] * y + vc[5]) + 0.5);
893  return 0;
894 }
895 
896 
911 l_ok
912 projectiveXformPt(l_float32 *vc,
913  l_int32 x,
914  l_int32 y,
915  l_float32 *pxp,
916  l_float32 *pyp)
917 {
918 l_float32 factor;
919 l_float64 denom;
920 
921  PROCNAME("projectiveXformPt");
922 
923  if (!vc)
924  return ERROR_INT("vc not defined", procName, 1);
925 
926  if ((denom = vc[6] * x + vc[7] * y + 1.0) == 0.0)
927  return ERROR_INT("denom = 0.0", procName, 1);
928  factor = 1.0 / denom;
929  *pxp = factor * (vc[0] * x + vc[1] * y + vc[2]);
930  *pyp = factor * (vc[3] * x + vc[4] * y + vc[5]);
931  return 0;
932 }
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
l_ok pixcmapAddBlackOrWhite(PIXCMAP *cmap, l_int32 color, l_int32 *pindex)
pixcmapAddBlackOrWhite()
Definition: colormap.c:639
l_uint32 * pixGetData(PIX *pix)
pixGetData()
Definition: pix1.c:1763
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 * 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
PIX * pixClone(PIX *pixs)
pixClone()
Definition: pix1.c:593
l_ok pixSetBorderRingVal(PIX *pixs, l_int32 dist, l_uint32 val)
pixSetBorderRingVal()
Definition: pix2.c:1667
PIX * pixGetRGBComponent(PIX *pixs, l_int32 comp)
pixGetRGBComponent()
Definition: pix2.c:2479
l_ok pixClearAll(PIX *pix)
pixClearAll()
Definition: pix2.c:789
PIX * pixAddBorder(PIX *pixs, l_int32 npix, l_uint32 val)
pixAddBorder()
Definition: pix2.c:1823
l_ok pixSetAll(PIX *pix)
pixSetAll()
Definition: pix2.c:817
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 * pixRemoveColormap(PIX *pixs, l_int32 type)
pixRemoveColormap()
Definition: pixconv.c:328
PIX * pixConvertTo8(PIX *pixs, l_int32 cmapflag)
pixConvertTo8()
Definition: pixconv.c:3133
PIX * pixProjectivePtaGray(PIX *pixs, PTA *ptad, PTA *ptas, l_uint8 grayval)
pixProjectivePtaGray()
Definition: projective.c:516
PIX * pixProjective(PIX *pixs, l_float32 *vc, l_int32 incolor)
pixProjective()
Definition: projective.c:357
l_ok getProjectiveXformCoeffs(PTA *ptas, PTA *ptad, l_float32 **pvc)
getProjectiveXformCoeffs()
Definition: projective.c:778
PIX * pixProjectiveGray(PIX *pixs, l_float32 *vc, l_uint8 grayval)
pixProjectiveGray()
Definition: projective.c:558
PIX * pixProjectiveColor(PIX *pixs, l_float32 *vc, l_uint32 colorval)
pixProjectiveColor()
Definition: projective.c:454
PIX * pixProjectiveSampled(PIX *pixs, l_float32 *vc, l_int32 incolor)
pixProjectiveSampled()
Definition: projective.c:194
l_ok projectiveXformSampledPt(l_float32 *vc, l_int32 x, l_int32 y, l_int32 *pxp, l_int32 *pyp)
projectiveXformSampledPt()
Definition: projective.c:874
PIX * pixProjectivePta(PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor)
pixProjectivePta()
Definition: projective.c:287
PIX * pixProjectivePtaWithAlpha(PIX *pixs, PTA *ptad, PTA *ptas, PIX *pixg, l_float32 fract, l_int32 border)
pixProjectivePtaWithAlpha()
Definition: projective.c:647
l_ok projectiveXformPt(l_float32 *vc, l_int32 x, l_int32 y, l_float32 *pxp, l_float32 *pyp)
projectiveXformPt()
Definition: projective.c:912
PIX * pixProjectivePtaColor(PIX *pixs, PTA *ptad, PTA *ptas, l_uint32 colorval)
pixProjectivePtaColor()
Definition: projective.c:413
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: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