Leptonica  1.77.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 #include <string.h>
112 #include <math.h>
113 #include "allheaders.h"
114 
115 extern l_float32 AlphaMaskBorderVals[2];
116 
117 
118 /*------------------------------------------------------------n
119  * Sampled projective image transformation *
120  *-------------------------------------------------------------*/
140 PIX *
142  PTA *ptad,
143  PTA *ptas,
144  l_int32 incolor)
145 {
146 l_float32 *vc;
147 PIX *pixd;
148 
149  PROCNAME("pixProjectiveSampledPta");
150 
151  if (!pixs)
152  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
153  if (!ptas)
154  return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
155  if (!ptad)
156  return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
157  if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
158  return (PIX *)ERROR_PTR("invalid incolor", procName, NULL);
159  if (ptaGetCount(ptas) != 4)
160  return (PIX *)ERROR_PTR("ptas count not 4", procName, NULL);
161  if (ptaGetCount(ptad) != 4)
162  return (PIX *)ERROR_PTR("ptad count not 4", procName, NULL);
163 
164  /* Get backwards transform from dest to src, and apply it */
165  getProjectiveXformCoeffs(ptad, ptas, &vc);
166  pixd = pixProjectiveSampled(pixs, vc, incolor);
167  LEPT_FREE(vc);
168 
169  return pixd;
170 }
171 
172 
190 PIX *
192  l_float32 *vc,
193  l_int32 incolor)
194 {
195 l_int32 i, j, w, h, d, x, y, wpls, wpld, color, cmapindex;
196 l_uint32 val;
197 l_uint32 *datas, *datad, *lines, *lined;
198 PIX *pixd;
199 PIXCMAP *cmap;
200 
201  PROCNAME("pixProjectiveSampled");
202 
203  if (!pixs)
204  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
205  if (!vc)
206  return (PIX *)ERROR_PTR("vc not defined", procName, NULL);
207  if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
208  return (PIX *)ERROR_PTR("invalid incolor", procName, NULL);
209  pixGetDimensions(pixs, &w, &h, &d);
210  if (d != 1 && d != 2 && d != 4 && d != 8 && d != 32)
211  return (PIX *)ERROR_PTR("depth not 1, 2, 4, 8 or 16", procName, NULL);
212 
213  /* Init all dest pixels to color to be brought in from outside */
214  pixd = pixCreateTemplate(pixs);
215  if ((cmap = pixGetColormap(pixs)) != NULL) {
216  if (incolor == L_BRING_IN_WHITE)
217  color = 1;
218  else
219  color = 0;
220  pixcmapAddBlackOrWhite(cmap, color, &cmapindex);
221  pixSetAllArbitrary(pixd, cmapindex);
222  } else {
223  if ((d == 1 && incolor == L_BRING_IN_WHITE) ||
224  (d > 1 && incolor == L_BRING_IN_BLACK)) {
225  pixClearAll(pixd);
226  } else {
227  pixSetAll(pixd);
228  }
229  }
230 
231  /* Scan over the dest pixels */
232  datas = pixGetData(pixs);
233  wpls = pixGetWpl(pixs);
234  datad = pixGetData(pixd);
235  wpld = pixGetWpl(pixd);
236  for (i = 0; i < h; i++) {
237  lined = datad + i * wpld;
238  for (j = 0; j < w; j++) {
239  projectiveXformSampledPt(vc, j, i, &x, &y);
240  if (x < 0 || y < 0 || x >=w || y >= h)
241  continue;
242  lines = datas + y * wpls;
243  if (d == 1) {
244  val = GET_DATA_BIT(lines, x);
245  SET_DATA_BIT_VAL(lined, j, val);
246  } else if (d == 8) {
247  val = GET_DATA_BYTE(lines, x);
248  SET_DATA_BYTE(lined, j, val);
249  } else if (d == 32) {
250  lined[j] = lines[x];
251  } else if (d == 2) {
252  val = GET_DATA_DIBIT(lines, x);
253  SET_DATA_DIBIT(lined, j, val);
254  } else if (d == 4) {
255  val = GET_DATA_QBIT(lines, x);
256  SET_DATA_QBIT(lined, j, val);
257  }
258  }
259  }
260 
261  return pixd;
262 }
263 
264 
265 /*---------------------------------------------------------------------*
266  * Interpolated projective image transformation *
267  *---------------------------------------------------------------------*/
283 PIX *
285  PTA *ptad,
286  PTA *ptas,
287  l_int32 incolor)
288 {
289 l_int32 d;
290 l_uint32 colorval;
291 PIX *pixt1, *pixt2, *pixd;
292 
293  PROCNAME("pixProjectivePta");
294 
295  if (!pixs)
296  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
297  if (!ptas)
298  return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
299  if (!ptad)
300  return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
301  if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
302  return (PIX *)ERROR_PTR("invalid incolor", procName, NULL);
303  if (ptaGetCount(ptas) != 4)
304  return (PIX *)ERROR_PTR("ptas count not 4", procName, NULL);
305  if (ptaGetCount(ptad) != 4)
306  return (PIX *)ERROR_PTR("ptad count not 4", procName, NULL);
307 
308  if (pixGetDepth(pixs) == 1)
309  return pixProjectiveSampledPta(pixs, ptad, ptas, incolor);
310 
311  /* Remove cmap if it exists, and unpack to 8 bpp if necessary */
313  d = pixGetDepth(pixt1);
314  if (d < 8)
315  pixt2 = pixConvertTo8(pixt1, FALSE);
316  else
317  pixt2 = pixClone(pixt1);
318  d = pixGetDepth(pixt2);
319 
320  /* Compute actual color to bring in from edges */
321  colorval = 0;
322  if (incolor == L_BRING_IN_WHITE) {
323  if (d == 8)
324  colorval = 255;
325  else /* d == 32 */
326  colorval = 0xffffff00;
327  }
328 
329  if (d == 8)
330  pixd = pixProjectivePtaGray(pixt2, ptad, ptas, colorval);
331  else /* d == 32 */
332  pixd = pixProjectivePtaColor(pixt2, ptad, ptas, colorval);
333  pixDestroy(&pixt1);
334  pixDestroy(&pixt2);
335  return pixd;
336 }
337 
338 
353 PIX *
355  l_float32 *vc,
356  l_int32 incolor)
357 {
358 l_int32 d;
359 l_uint32 colorval;
360 PIX *pixt1, *pixt2, *pixd;
361 
362  PROCNAME("pixProjective");
363 
364  if (!pixs)
365  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
366  if (!vc)
367  return (PIX *)ERROR_PTR("vc not defined", procName, NULL);
368 
369  if (pixGetDepth(pixs) == 1)
370  return pixProjectiveSampled(pixs, vc, incolor);
371 
372  /* Remove cmap if it exists, and unpack to 8 bpp if necessary */
374  d = pixGetDepth(pixt1);
375  if (d < 8)
376  pixt2 = pixConvertTo8(pixt1, FALSE);
377  else
378  pixt2 = pixClone(pixt1);
379  d = pixGetDepth(pixt2);
380 
381  /* Compute actual color to bring in from edges */
382  colorval = 0;
383  if (incolor == L_BRING_IN_WHITE) {
384  if (d == 8)
385  colorval = 255;
386  else /* d == 32 */
387  colorval = 0xffffff00;
388  }
389 
390  if (d == 8)
391  pixd = pixProjectiveGray(pixt2, vc, colorval);
392  else /* d == 32 */
393  pixd = pixProjectiveColor(pixt2, vc, colorval);
394  pixDestroy(&pixt1);
395  pixDestroy(&pixt2);
396  return pixd;
397 }
398 
399 
409 PIX *
411  PTA *ptad,
412  PTA *ptas,
413  l_uint32 colorval)
414 {
415 l_float32 *vc;
416 PIX *pixd;
417 
418  PROCNAME("pixProjectivePtaColor");
419 
420  if (!pixs)
421  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
422  if (!ptas)
423  return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
424  if (!ptad)
425  return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
426  if (pixGetDepth(pixs) != 32)
427  return (PIX *)ERROR_PTR("pixs must be 32 bpp", procName, NULL);
428  if (ptaGetCount(ptas) != 4)
429  return (PIX *)ERROR_PTR("ptas count not 4", procName, NULL);
430  if (ptaGetCount(ptad) != 4)
431  return (PIX *)ERROR_PTR("ptad count not 4", procName, NULL);
432 
433  /* Get backwards transform from dest to src, and apply it */
434  getProjectiveXformCoeffs(ptad, ptas, &vc);
435  pixd = pixProjectiveColor(pixs, vc, colorval);
436  LEPT_FREE(vc);
437 
438  return pixd;
439 }
440 
441 
450 PIX *
452  l_float32 *vc,
453  l_uint32 colorval)
454 {
455 l_int32 i, j, w, h, d, wpls, wpld;
456 l_uint32 val;
457 l_uint32 *datas, *datad, *lined;
458 l_float32 x, y;
459 PIX *pix1, *pix2, *pixd;
460 
461  PROCNAME("pixProjectiveColor");
462 
463  if (!pixs)
464  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
465  pixGetDimensions(pixs, &w, &h, &d);
466  if (d != 32)
467  return (PIX *)ERROR_PTR("pixs must be 32 bpp", procName, NULL);
468  if (!vc)
469  return (PIX *)ERROR_PTR("vc not defined", procName, NULL);
470 
471  datas = pixGetData(pixs);
472  wpls = pixGetWpl(pixs);
473  pixd = pixCreateTemplate(pixs);
474  pixSetAllArbitrary(pixd, colorval);
475  datad = pixGetData(pixd);
476  wpld = pixGetWpl(pixd);
477 
478  /* Iterate over destination pixels */
479  for (i = 0; i < h; i++) {
480  lined = datad + i * wpld;
481  for (j = 0; j < w; j++) {
482  /* Compute float src pixel location corresponding to (i,j) */
483  projectiveXformPt(vc, j, i, &x, &y);
484  linearInterpolatePixelColor(datas, wpls, w, h, x, y, colorval,
485  &val);
486  *(lined + j) = val;
487  }
488  }
489 
490  /* If rgba, transform the pixs alpha channel and insert in pixd */
491  if (pixGetSpp(pixs) == 4) {
492  pix1 = pixGetRGBComponent(pixs, L_ALPHA_CHANNEL);
493  pix2 = pixProjectiveGray(pix1, vc, 255); /* bring in opaque */
494  pixSetRGBComponent(pixd, pix2, L_ALPHA_CHANNEL);
495  pixDestroy(&pix1);
496  pixDestroy(&pix2);
497  }
498 
499  return pixd;
500 }
501 
502 
512 PIX *
514  PTA *ptad,
515  PTA *ptas,
516  l_uint8 grayval)
517 {
518 l_float32 *vc;
519 PIX *pixd;
520 
521  PROCNAME("pixProjectivePtaGray");
522 
523  if (!pixs)
524  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
525  if (!ptas)
526  return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
527  if (!ptad)
528  return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
529  if (pixGetDepth(pixs) != 8)
530  return (PIX *)ERROR_PTR("pixs must be 8 bpp", procName, NULL);
531  if (ptaGetCount(ptas) != 4)
532  return (PIX *)ERROR_PTR("ptas count not 4", procName, NULL);
533  if (ptaGetCount(ptad) != 4)
534  return (PIX *)ERROR_PTR("ptad count not 4", procName, NULL);
535 
536  /* Get backwards transform from dest to src, and apply it */
537  getProjectiveXformCoeffs(ptad, ptas, &vc);
538  pixd = pixProjectiveGray(pixs, vc, grayval);
539  LEPT_FREE(vc);
540 
541  return pixd;
542 }
543 
544 
545 
554 PIX *
556  l_float32 *vc,
557  l_uint8 grayval)
558 {
559 l_int32 i, j, w, h, wpls, wpld, val;
560 l_uint32 *datas, *datad, *lined;
561 l_float32 x, y;
562 PIX *pixd;
563 
564  PROCNAME("pixProjectiveGray");
565 
566  if (!pixs)
567  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
568  pixGetDimensions(pixs, &w, &h, NULL);
569  if (pixGetDepth(pixs) != 8)
570  return (PIX *)ERROR_PTR("pixs must be 8 bpp", procName, NULL);
571  if (!vc)
572  return (PIX *)ERROR_PTR("vc not defined", procName, NULL);
573 
574  datas = pixGetData(pixs);
575  wpls = pixGetWpl(pixs);
576  pixd = pixCreateTemplate(pixs);
577  pixSetAllArbitrary(pixd, grayval);
578  datad = pixGetData(pixd);
579  wpld = pixGetWpl(pixd);
580 
581  /* Iterate over destination pixels */
582  for (i = 0; i < h; i++) {
583  lined = datad + i * wpld;
584  for (j = 0; j < w; j++) {
585  /* Compute float src pixel location corresponding to (i,j) */
586  projectiveXformPt(vc, j, i, &x, &y);
587  linearInterpolatePixelGray(datas, wpls, w, h, x, y, grayval, &val);
588  SET_DATA_BYTE(lined, j, val);
589  }
590  }
591 
592  return pixd;
593 }
594 
595 
596 /*---------------------------------------------------------------------------*
597  * Projective transform including alpha (blend) component *
598  *---------------------------------------------------------------------------*/
643 PIX *
645  PTA *ptad,
646  PTA *ptas,
647  PIX *pixg,
648  l_float32 fract,
649  l_int32 border)
650 {
651 l_int32 ws, hs, d;
652 PIX *pixd, *pixb1, *pixb2, *pixg2, *pixga;
653 PTA *ptad2, *ptas2;
654 
655  PROCNAME("pixProjectivePtaWithAlpha");
656 
657  if (!pixs)
658  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
659  pixGetDimensions(pixs, &ws, &hs, &d);
660  if (d != 32 && pixGetColormap(pixs) == NULL)
661  return (PIX *)ERROR_PTR("pixs not cmapped or 32 bpp", procName, NULL);
662  if (pixg && pixGetDepth(pixg) != 8) {
663  L_WARNING("pixg not 8 bpp; using 'fract' transparent alpha\n",
664  procName);
665  pixg = NULL;
666  }
667  if (!pixg && (fract < 0.0 || fract > 1.0)) {
668  L_WARNING("invalid fract; using 1.0 (fully transparent)\n", procName);
669  fract = 1.0;
670  }
671  if (!pixg && fract == 0.0)
672  L_WARNING("fully opaque alpha; image will not be blended\n", procName);
673  if (!ptad)
674  return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
675  if (!ptas)
676  return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
677 
678  /* Add border; the color doesn't matter */
679  pixb1 = pixAddBorder(pixs, border, 0);
680 
681  /* Transform the ptr arrays to work on the bordered image */
682  ptad2 = ptaTransform(ptad, border, border, 1.0, 1.0);
683  ptas2 = ptaTransform(ptas, border, border, 1.0, 1.0);
684 
685  /* Do separate projective transform of rgb channels of pixs
686  * and of pixg */
687  pixd = pixProjectivePtaColor(pixb1, ptad2, ptas2, 0);
688  if (!pixg) {
689  pixg2 = pixCreate(ws, hs, 8);
690  if (fract == 1.0)
691  pixSetAll(pixg2);
692  else
693  pixSetAllArbitrary(pixg2, (l_int32)(255.0 * fract));
694  } else {
695  pixg2 = pixResizeToMatch(pixg, NULL, ws, hs);
696  }
697  if (ws > 10 && hs > 10) { /* see note 7 */
698  pixSetBorderRingVal(pixg2, 1,
699  (l_int32)(255.0 * fract * AlphaMaskBorderVals[0]));
700  pixSetBorderRingVal(pixg2, 2,
701  (l_int32)(255.0 * fract * AlphaMaskBorderVals[1]));
702 
703  }
704  pixb2 = pixAddBorder(pixg2, border, 0); /* must be black border */
705  pixga = pixProjectivePtaGray(pixb2, ptad2, ptas2, 0);
706  pixSetRGBComponent(pixd, pixga, L_ALPHA_CHANNEL);
707  pixSetSpp(pixd, 4);
708 
709  pixDestroy(&pixg2);
710  pixDestroy(&pixb1);
711  pixDestroy(&pixb2);
712  pixDestroy(&pixga);
713  ptaDestroy(&ptad2);
714  ptaDestroy(&ptas2);
715  return pixd;
716 }
717 
718 
719 /*-------------------------------------------------------------*
720  * Projective coordinate transformation *
721  *-------------------------------------------------------------*/
774 l_ok
776  PTA *ptad,
777  l_float32 **pvc)
778 {
779 l_int32 i;
780 l_float32 x1, y1, x2, y2, x3, y3, x4, y4;
781 l_float32 *b; /* rhs vector of primed coords X'; coeffs returned in *pvc */
782 l_float32 *a[8]; /* 8x8 matrix A */
783 
784  PROCNAME("getProjectiveXformCoeffs");
785 
786  if (!ptas)
787  return ERROR_INT("ptas not defined", procName, 1);
788  if (!ptad)
789  return ERROR_INT("ptad not defined", procName, 1);
790  if (!pvc)
791  return ERROR_INT("&vc not defined", procName, 1);
792 
793  if ((b = (l_float32 *)LEPT_CALLOC(8, sizeof(l_float32))) == NULL)
794  return ERROR_INT("b not made", procName, 1);
795  *pvc = b;
796 
797  ptaGetPt(ptas, 0, &x1, &y1);
798  ptaGetPt(ptas, 1, &x2, &y2);
799  ptaGetPt(ptas, 2, &x3, &y3);
800  ptaGetPt(ptas, 3, &x4, &y4);
801  ptaGetPt(ptad, 0, &b[0], &b[1]);
802  ptaGetPt(ptad, 1, &b[2], &b[3]);
803  ptaGetPt(ptad, 2, &b[4], &b[5]);
804  ptaGetPt(ptad, 3, &b[6], &b[7]);
805 
806  for (i = 0; i < 8; i++) {
807  if ((a[i] = (l_float32 *)LEPT_CALLOC(8, sizeof(l_float32))) == NULL)
808  return ERROR_INT("a[i] not made", procName, 1);
809  }
810 
811  a[0][0] = x1;
812  a[0][1] = y1;
813  a[0][2] = 1.;
814  a[0][6] = -x1 * b[0];
815  a[0][7] = -y1 * b[0];
816  a[1][3] = x1;
817  a[1][4] = y1;
818  a[1][5] = 1;
819  a[1][6] = -x1 * b[1];
820  a[1][7] = -y1 * b[1];
821  a[2][0] = x2;
822  a[2][1] = y2;
823  a[2][2] = 1.;
824  a[2][6] = -x2 * b[2];
825  a[2][7] = -y2 * b[2];
826  a[3][3] = x2;
827  a[3][4] = y2;
828  a[3][5] = 1;
829  a[3][6] = -x2 * b[3];
830  a[3][7] = -y2 * b[3];
831  a[4][0] = x3;
832  a[4][1] = y3;
833  a[4][2] = 1.;
834  a[4][6] = -x3 * b[4];
835  a[4][7] = -y3 * b[4];
836  a[5][3] = x3;
837  a[5][4] = y3;
838  a[5][5] = 1;
839  a[5][6] = -x3 * b[5];
840  a[5][7] = -y3 * b[5];
841  a[6][0] = x4;
842  a[6][1] = y4;
843  a[6][2] = 1.;
844  a[6][6] = -x4 * b[6];
845  a[6][7] = -y4 * b[6];
846  a[7][3] = x4;
847  a[7][4] = y4;
848  a[7][5] = 1;
849  a[7][6] = -x4 * b[7];
850  a[7][7] = -y4 * b[7];
851 
852  gaussjordan(a, b, 8);
853 
854  for (i = 0; i < 8; i++)
855  LEPT_FREE(a[i]);
856 
857  return 0;
858 }
859 
860 
875 l_ok
877  l_int32 x,
878  l_int32 y,
879  l_int32 *pxp,
880  l_int32 *pyp)
881 {
882 l_float32 factor;
883 
884  PROCNAME("projectiveXformSampledPt");
885 
886  if (!vc)
887  return ERROR_INT("vc not defined", procName, 1);
888 
889  factor = 1. / (vc[6] * x + vc[7] * y + 1.);
890  *pxp = (l_int32)(factor * (vc[0] * x + vc[1] * y + vc[2]) + 0.5);
891  *pyp = (l_int32)(factor * (vc[3] * x + vc[4] * y + vc[5]) + 0.5);
892  return 0;
893 }
894 
895 
910 l_ok
911 projectiveXformPt(l_float32 *vc,
912  l_int32 x,
913  l_int32 y,
914  l_float32 *pxp,
915  l_float32 *pyp)
916 {
917 l_float32 factor;
918 
919  PROCNAME("projectiveXformPt");
920 
921  if (!vc)
922  return ERROR_INT("vc not defined", procName, 1);
923 
924  factor = 1. / (vc[6] * x + vc[7] * y + 1.);
925  *pxp = factor * (vc[0] * x + vc[1] * y + vc[2]);
926  *pyp = factor * (vc[3] * x + vc[4] * y + vc[5]);
927  return 0;
928 }
l_int32 gaussjordan(l_float32 **a, l_float32 *b, l_int32 n)
gaussjordan()
Definition: affine.c:1345
PIX * pixProjectivePtaColor(PIX *pixs, PTA *ptad, PTA *ptas, l_uint32 colorval)
pixProjectivePtaColor()
Definition: projective.c:410
PIX * pixProjectiveSampled(PIX *pixs, l_float32 *vc, l_int32 incolor)
pixProjectiveSampled()
Definition: projective.c:191
PIX * pixRemoveColormap(PIX *pixs, l_int32 type)
pixRemoveColormap()
Definition: pixconv.c:322
PIX * pixProjectivePtaGray(PIX *pixs, PTA *ptad, PTA *ptas, l_uint8 grayval)
pixProjectivePtaGray()
Definition: projective.c:513
l_ok pixSetRGBComponent(PIX *pixd, PIX *pixs, l_int32 comp)
pixSetRGBComponent()
Definition: pix2.c:2463
PIX * pixProjective(PIX *pixs, l_float32 *vc, l_int32 incolor)
pixProjective()
Definition: projective.c:354
l_ok projectiveXformSampledPt(l_float32 *vc, l_int32 x, l_int32 y, l_int32 *pxp, l_int32 *pyp)
projectiveXformSampledPt()
Definition: projective.c:876
PIX * pixConvertTo8(PIX *pixs, l_int32 cmapflag)
pixConvertTo8()
Definition: pixconv.c:3041
PIX * pixCreate(l_int32 width, l_int32 height, l_int32 depth)
pixCreate()
Definition: pix1.c:302
l_ok pixSetAll(PIX *pix)
pixSetAll()
Definition: pix2.c:741
#define SET_DATA_QBIT(pdata, n, val)
Definition: arrayaccess.h:168
l_int32 ptaGetCount(PTA *pta)
ptaGetCount()
Definition: ptabasic.c:504
l_uint32 * pixGetData(PIX *pix)
pixGetData()
Definition: pix1.c:1624
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:1266
#define GET_DATA_BIT(pdata, n)
Definition: arrayaccess.h:123
PIX * pixCreateTemplate(PIX *pixs)
pixCreateTemplate()
Definition: pix1.c:367
PIX * pixGetRGBComponent(PIX *pixs, l_int32 comp)
pixGetRGBComponent()
Definition: pix2.c:2404
PIX * pixAddBorder(PIX *pixs, l_int32 npix, l_uint32 val)
pixAddBorder()
Definition: pix2.c:1748
#define SET_DATA_DIBIT(pdata, n, val)
Definition: arrayaccess.h:149
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:1180
l_ok pixSetAllArbitrary(PIX *pix, l_uint32 val)
pixSetAllArbitrary()
Definition: pix2.c:876
PIX * pixProjectivePtaWithAlpha(PIX *pixs, PTA *ptad, PTA *ptas, PIX *pixg, l_float32 fract, l_int32 border)
pixProjectivePtaWithAlpha()
Definition: projective.c:644
PIX * pixProjectivePta(PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor)
pixProjectivePta()
Definition: projective.c:284
PIX * pixProjectiveGray(PIX *pixs, l_float32 *vc, l_uint8 grayval)
pixProjectiveGray()
Definition: projective.c:555
l_ok pixClearAll(PIX *pix)
pixClearAll()
Definition: pix2.c:712
l_ok pixSetBorderRingVal(PIX *pixs, l_int32 dist, l_uint32 val)
pixSetBorderRingVal()
Definition: pix2.c:1592
l_ok projectiveXformPt(l_float32 *vc, l_int32 x, l_int32 y, l_float32 *pxp, l_float32 *pyp)
projectiveXformPt()
Definition: projective.c:911
l_ok ptaGetPt(PTA *pta, l_int32 index, l_float32 *px, l_float32 *py)
ptaGetPt()
Definition: ptabasic.c:525
#define SET_DATA_BYTE(pdata, n, val)
Definition: arrayaccess.h:198
#define GET_DATA_QBIT(pdata, n)
Definition: arrayaccess.h:164
#define GET_DATA_BYTE(pdata, n)
Definition: arrayaccess.h:188
#define SET_DATA_BIT_VAL(pdata, n, val)
Definition: arrayaccess.h:135
PIX * pixClone(PIX *pixs)
pixClone()
Definition: pix1.c:515
void pixDestroy(PIX **ppix)
pixDestroy()
Definition: pix1.c:543
l_ok pixGetDimensions(const PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
Definition: pix1.c:1065
l_ok getProjectiveXformCoeffs(PTA *ptas, PTA *ptad, l_float32 **pvc)
getProjectiveXformCoeffs()
Definition: projective.c:775
l_ok pixcmapAddBlackOrWhite(PIXCMAP *cmap, l_int32 color, l_int32 *pindex)
pixcmapAddBlackOrWhite()
Definition: colormap.c:566
#define GET_DATA_DIBIT(pdata, n)
Definition: arrayaccess.h:145
Definition: pix.h:134
void ptaDestroy(PTA **ppta)
ptaDestroy()
Definition: ptabasic.c:192
PIX * pixResizeToMatch(PIX *pixs, PIX *pixt, l_int32 w, l_int32 h)
pixResizeToMatch()
Definition: pix5.c:1252
PTA * ptaTransform(PTA *ptas, l_int32 shiftx, l_int32 shifty, l_float32 scalex, l_float32 scaley)
ptaTransform()
Definition: ptafunc1.c:735
PIX * pixProjectiveSampledPta(PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor)
pixProjectiveSampledPta()
Definition: projective.c:141
PIX * pixProjectiveColor(PIX *pixs, l_float32 *vc, l_uint32 colorval)
pixProjectiveColor()
Definition: projective.c:451
Definition: pix.h:517