Leptonica  1.77.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 
27 
113 #include <string.h>
114 #include <math.h>
115 #include "allheaders.h"
116 
117 extern l_float32 AlphaMaskBorderVals[2];
118 
119 
120 /*-------------------------------------------------------------*
121  * Sampled bilinear image transformation *
122  *-------------------------------------------------------------*/
142 PIX *
144  PTA *ptad,
145  PTA *ptas,
146  l_int32 incolor)
147 {
148 l_float32 *vc;
149 PIX *pixd;
150 
151  PROCNAME("pixBilinearSampledPta");
152 
153  if (!pixs)
154  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
155  if (!ptas)
156  return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
157  if (!ptad)
158  return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
159  if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
160  return (PIX *)ERROR_PTR("invalid incolor", procName, NULL);
161  if (ptaGetCount(ptas) != 4)
162  return (PIX *)ERROR_PTR("ptas count not 4", procName, NULL);
163  if (ptaGetCount(ptad) != 4)
164  return (PIX *)ERROR_PTR("ptad count not 4", procName, NULL);
165 
166  /* Get backwards transform from dest to src, and apply it */
167  getBilinearXformCoeffs(ptad, ptas, &vc);
168  pixd = pixBilinearSampled(pixs, vc, incolor);
169  LEPT_FREE(vc);
170 
171  return pixd;
172 }
173 
174 
192 PIX *
194  l_float32 *vc,
195  l_int32 incolor)
196 {
197 l_int32 i, j, w, h, d, x, y, wpls, wpld, color, cmapindex;
198 l_uint32 val;
199 l_uint32 *datas, *datad, *lines, *lined;
200 PIX *pixd;
201 PIXCMAP *cmap;
202 
203  PROCNAME("pixBilinearSampled");
204 
205  if (!pixs)
206  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
207  if (!vc)
208  return (PIX *)ERROR_PTR("vc not defined", procName, NULL);
209  if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
210  return (PIX *)ERROR_PTR("invalid incolor", procName, NULL);
211  pixGetDimensions(pixs, &w, &h, &d);
212  if (d != 1 && d != 2 && d != 4 && d != 8 && d != 32)
213  return (PIX *)ERROR_PTR("depth not 1, 2, 4, 8 or 16", procName, NULL);
214 
215  /* Init all dest pixels to color to be brought in from outside */
216  pixd = pixCreateTemplate(pixs);
217  if ((cmap = pixGetColormap(pixs)) != NULL) {
218  if (incolor == L_BRING_IN_WHITE)
219  color = 1;
220  else
221  color = 0;
222  pixcmapAddBlackOrWhite(cmap, color, &cmapindex);
223  pixSetAllArbitrary(pixd, cmapindex);
224  } else {
225  if ((d == 1 && incolor == L_BRING_IN_WHITE) ||
226  (d > 1 && incolor == L_BRING_IN_BLACK)) {
227  pixClearAll(pixd);
228  } else {
229  pixSetAll(pixd);
230  }
231  }
232 
233  /* Scan over the dest pixels */
234  datas = pixGetData(pixs);
235  wpls = pixGetWpl(pixs);
236  datad = pixGetData(pixd);
237  wpld = pixGetWpl(pixd);
238  for (i = 0; i < h; i++) {
239  lined = datad + i * wpld;
240  for (j = 0; j < w; j++) {
241  bilinearXformSampledPt(vc, j, i, &x, &y);
242  if (x < 0 || y < 0 || x >=w || y >= h)
243  continue;
244  lines = datas + y * wpls;
245  if (d == 1) {
246  val = GET_DATA_BIT(lines, x);
247  SET_DATA_BIT_VAL(lined, j, val);
248  } else if (d == 8) {
249  val = GET_DATA_BYTE(lines, x);
250  SET_DATA_BYTE(lined, j, val);
251  } else if (d == 32) {
252  lined[j] = lines[x];
253  } else if (d == 2) {
254  val = GET_DATA_DIBIT(lines, x);
255  SET_DATA_DIBIT(lined, j, val);
256  } else if (d == 4) {
257  val = GET_DATA_QBIT(lines, x);
258  SET_DATA_QBIT(lined, j, val);
259  }
260  }
261  }
262 
263  return pixd;
264 }
265 
266 
267 /*---------------------------------------------------------------------*
268  * Interpolated bilinear image transformation *
269  *---------------------------------------------------------------------*/
285 PIX *
287  PTA *ptad,
288  PTA *ptas,
289  l_int32 incolor)
290 {
291 l_int32 d;
292 l_uint32 colorval;
293 PIX *pixt1, *pixt2, *pixd;
294 
295  PROCNAME("pixBilinearPta");
296 
297  if (!pixs)
298  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
299  if (!ptas)
300  return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
301  if (!ptad)
302  return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
303  if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
304  return (PIX *)ERROR_PTR("invalid incolor", procName, NULL);
305  if (ptaGetCount(ptas) != 4)
306  return (PIX *)ERROR_PTR("ptas count not 4", procName, NULL);
307  if (ptaGetCount(ptad) != 4)
308  return (PIX *)ERROR_PTR("ptad count not 4", procName, NULL);
309 
310  if (pixGetDepth(pixs) == 1)
311  return pixBilinearSampledPta(pixs, ptad, ptas, incolor);
312 
313  /* Remove cmap if it exists, and unpack to 8 bpp if necessary */
315  d = pixGetDepth(pixt1);
316  if (d < 8)
317  pixt2 = pixConvertTo8(pixt1, FALSE);
318  else
319  pixt2 = pixClone(pixt1);
320  d = pixGetDepth(pixt2);
321 
322  /* Compute actual color to bring in from edges */
323  colorval = 0;
324  if (incolor == L_BRING_IN_WHITE) {
325  if (d == 8)
326  colorval = 255;
327  else /* d == 32 */
328  colorval = 0xffffff00;
329  }
330 
331  if (d == 8)
332  pixd = pixBilinearPtaGray(pixt2, ptad, ptas, colorval);
333  else /* d == 32 */
334  pixd = pixBilinearPtaColor(pixt2, ptad, ptas, colorval);
335  pixDestroy(&pixt1);
336  pixDestroy(&pixt2);
337  return pixd;
338 }
339 
340 
355 PIX *
357  l_float32 *vc,
358  l_int32 incolor)
359 {
360 l_int32 d;
361 l_uint32 colorval;
362 PIX *pixt1, *pixt2, *pixd;
363 
364  PROCNAME("pixBilinear");
365 
366  if (!pixs)
367  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
368  if (!vc)
369  return (PIX *)ERROR_PTR("vc not defined", procName, NULL);
370 
371  if (pixGetDepth(pixs) == 1)
372  return pixBilinearSampled(pixs, vc, incolor);
373 
374  /* Remove cmap if it exists, and unpack to 8 bpp if necessary */
376  d = pixGetDepth(pixt1);
377  if (d < 8)
378  pixt2 = pixConvertTo8(pixt1, FALSE);
379  else
380  pixt2 = pixClone(pixt1);
381  d = pixGetDepth(pixt2);
382 
383  /* Compute actual color to bring in from edges */
384  colorval = 0;
385  if (incolor == L_BRING_IN_WHITE) {
386  if (d == 8)
387  colorval = 255;
388  else /* d == 32 */
389  colorval = 0xffffff00;
390  }
391 
392  if (d == 8)
393  pixd = pixBilinearGray(pixt2, vc, colorval);
394  else /* d == 32 */
395  pixd = pixBilinearColor(pixt2, vc, colorval);
396  pixDestroy(&pixt1);
397  pixDestroy(&pixt2);
398  return pixd;
399 }
400 
401 
411 PIX *
413  PTA *ptad,
414  PTA *ptas,
415  l_uint32 colorval)
416 {
417 l_float32 *vc;
418 PIX *pixd;
419 
420  PROCNAME("pixBilinearPtaColor");
421 
422  if (!pixs)
423  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
424  if (!ptas)
425  return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
426  if (!ptad)
427  return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
428  if (pixGetDepth(pixs) != 32)
429  return (PIX *)ERROR_PTR("pixs must be 32 bpp", procName, NULL);
430  if (ptaGetCount(ptas) != 4)
431  return (PIX *)ERROR_PTR("ptas count not 4", procName, NULL);
432  if (ptaGetCount(ptad) != 4)
433  return (PIX *)ERROR_PTR("ptad count not 4", procName, NULL);
434 
435  /* Get backwards transform from dest to src, and apply it */
436  getBilinearXformCoeffs(ptad, ptas, &vc);
437  pixd = pixBilinearColor(pixs, vc, colorval);
438  LEPT_FREE(vc);
439 
440  return pixd;
441 }
442 
443 
452 PIX *
454  l_float32 *vc,
455  l_uint32 colorval)
456 {
457 l_int32 i, j, w, h, d, wpls, wpld;
458 l_uint32 val;
459 l_uint32 *datas, *datad, *lined;
460 l_float32 x, y;
461 PIX *pix1, *pix2, *pixd;
462 
463  PROCNAME("pixBilinearColor");
464 
465  if (!pixs)
466  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
467  pixGetDimensions(pixs, &w, &h, &d);
468  if (d != 32)
469  return (PIX *)ERROR_PTR("pixs must be 32 bpp", procName, NULL);
470  if (!vc)
471  return (PIX *)ERROR_PTR("vc not defined", procName, NULL);
472 
473  datas = pixGetData(pixs);
474  wpls = pixGetWpl(pixs);
475  pixd = pixCreateTemplate(pixs);
476  pixSetAllArbitrary(pixd, colorval);
477  datad = pixGetData(pixd);
478  wpld = pixGetWpl(pixd);
479 
480  /* Iterate over destination pixels */
481  for (i = 0; i < h; i++) {
482  lined = datad + i * wpld;
483  for (j = 0; j < w; j++) {
484  /* Compute float src pixel location corresponding to (i,j) */
485  bilinearXformPt(vc, j, i, &x, &y);
486  linearInterpolatePixelColor(datas, wpls, w, h, x, y, colorval,
487  &val);
488  *(lined + j) = val;
489  }
490  }
491 
492  /* If rgba, transform the pixs alpha channel and insert in pixd */
493  if (pixGetSpp(pixs) == 4) {
495  pix2 = pixBilinearGray(pix1, vc, 255); /* bring in opaque */
496  pixSetRGBComponent(pixd, pix2, L_ALPHA_CHANNEL);
497  pixDestroy(&pix1);
498  pixDestroy(&pix2);
499  }
500 
501  return pixd;
502 }
503 
504 
514 PIX *
516  PTA *ptad,
517  PTA *ptas,
518  l_uint8 grayval)
519 {
520 l_float32 *vc;
521 PIX *pixd;
522 
523  PROCNAME("pixBilinearPtaGray");
524 
525  if (!pixs)
526  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
527  if (!ptas)
528  return (PIX *)ERROR_PTR("ptas not defined", procName, NULL);
529  if (!ptad)
530  return (PIX *)ERROR_PTR("ptad not defined", procName, NULL);
531  if (pixGetDepth(pixs) != 8)
532  return (PIX *)ERROR_PTR("pixs must be 8 bpp", procName, NULL);
533  if (ptaGetCount(ptas) != 4)
534  return (PIX *)ERROR_PTR("ptas count not 4", procName, NULL);
535  if (ptaGetCount(ptad) != 4)
536  return (PIX *)ERROR_PTR("ptad count not 4", procName, NULL);
537 
538  /* Get backwards transform from dest to src, and apply it */
539  getBilinearXformCoeffs(ptad, ptas, &vc);
540  pixd = pixBilinearGray(pixs, vc, grayval);
541  LEPT_FREE(vc);
542 
543  return pixd;
544 }
545 
546 
555 PIX *
557  l_float32 *vc,
558  l_uint8 grayval)
559 {
560 l_int32 i, j, w, h, wpls, wpld, val;
561 l_uint32 *datas, *datad, *lined;
562 l_float32 x, y;
563 PIX *pixd;
564 
565  PROCNAME("pixBilinearGray");
566 
567  if (!pixs)
568  return (PIX *)ERROR_PTR("pixs not defined", procName, NULL);
569  pixGetDimensions(pixs, &w, &h, NULL);
570  if (pixGetDepth(pixs) != 8)
571  return (PIX *)ERROR_PTR("pixs must be 8 bpp", procName, NULL);
572  if (!vc)
573  return (PIX *)ERROR_PTR("vc not defined", procName, NULL);
574 
575  datas = pixGetData(pixs);
576  wpls = pixGetWpl(pixs);
577  pixd = pixCreateTemplate(pixs);
578  pixSetAllArbitrary(pixd, grayval);
579  datad = pixGetData(pixd);
580  wpld = pixGetWpl(pixd);
581 
582  /* Iterate over destination pixels */
583  for (i = 0; i < h; i++) {
584  lined = datad + i * wpld;
585  for (j = 0; j < w; j++) {
586  /* Compute float src pixel location corresponding to (i,j) */
587  bilinearXformPt(vc, j, i, &x, &y);
588  linearInterpolatePixelGray(datas, wpls, w, h, x, y, grayval, &val);
589  SET_DATA_BYTE(lined, j, val);
590  }
591  }
592 
593  return pixd;
594 }
595 
596 
597 /*-------------------------------------------------------------------------*
598  * Bilinear transform including alpha (blend) component *
599  *-------------------------------------------------------------------------*/
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("pixBilinearPtaWithAlpha");
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 cannot 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 bilinear transform of rgb channels of pixs and of pixg */
686  pixd = pixBilinearPtaColor(pixb1, ptad2, ptas2, 0);
687  if (!pixg) {
688  pixg2 = pixCreate(ws, hs, 8);
689  if (fract == 1.0)
690  pixSetAll(pixg2);
691  else
692  pixSetAllArbitrary(pixg2, (l_int32)(255.0 * fract));
693  } else {
694  pixg2 = pixResizeToMatch(pixg, NULL, ws, hs);
695  }
696  if (ws > 10 && hs > 10) { /* see note 7 */
697  pixSetBorderRingVal(pixg2, 1,
698  (l_int32)(255.0 * fract * AlphaMaskBorderVals[0]));
699  pixSetBorderRingVal(pixg2, 2,
700  (l_int32)(255.0 * fract * AlphaMaskBorderVals[1]));
701 
702  }
703  pixb2 = pixAddBorder(pixg2, border, 0); /* must be black border */
704  pixga = pixBilinearPtaGray(pixb2, ptad2, ptas2, 0);
705  pixSetRGBComponent(pixd, pixga, L_ALPHA_CHANNEL);
706  pixSetSpp(pixd, 4);
707 
708  pixDestroy(&pixg2);
709  pixDestroy(&pixb1);
710  pixDestroy(&pixb2);
711  pixDestroy(&pixga);
712  ptaDestroy(&ptad2);
713  ptaDestroy(&ptas2);
714  return pixd;
715 }
716 
717 
718 /*-------------------------------------------------------------*
719  * Bilinear coordinate transformation *
720  *-------------------------------------------------------------*/
775 l_ok
777  PTA *ptad,
778  l_float32 **pvc)
779 {
780 l_int32 i;
781 l_float32 x1, y1, x2, y2, x3, y3, x4, y4;
782 l_float32 *b; /* rhs vector of primed coords X'; coeffs returned in *pvc */
783 l_float32 *a[8]; /* 8x8 matrix A */
784 
785  PROCNAME("getBilinearXformCoeffs");
786 
787  if (!ptas)
788  return ERROR_INT("ptas not defined", procName, 1);
789  if (!ptad)
790  return ERROR_INT("ptad not defined", procName, 1);
791  if (!pvc)
792  return ERROR_INT("&vc not defined", procName, 1);
793 
794  if ((b = (l_float32 *)LEPT_CALLOC(8, sizeof(l_float32))) == NULL)
795  return ERROR_INT("b not made", procName, 1);
796  *pvc = b;
797 
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  if ((a[i] = (l_float32 *)LEPT_CALLOC(8, sizeof(l_float32))) == NULL)
809  return ERROR_INT("a[i] not made", procName, 1);
810  }
811 
812  a[0][0] = x1;
813  a[0][1] = y1;
814  a[0][2] = x1 * y1;
815  a[0][3] = 1.;
816  a[1][4] = x1;
817  a[1][5] = y1;
818  a[1][6] = x1 * y1;
819  a[1][7] = 1.;
820  a[2][0] = x2;
821  a[2][1] = y2;
822  a[2][2] = x2 * y2;
823  a[2][3] = 1.;
824  a[3][4] = x2;
825  a[3][5] = y2;
826  a[3][6] = x2 * y2;
827  a[3][7] = 1.;
828  a[4][0] = x3;
829  a[4][1] = y3;
830  a[4][2] = x3 * y3;
831  a[4][3] = 1.;
832  a[5][4] = x3;
833  a[5][5] = y3;
834  a[5][6] = x3 * y3;
835  a[5][7] = 1.;
836  a[6][0] = x4;
837  a[6][1] = y4;
838  a[6][2] = x4 * y4;
839  a[6][3] = 1.;
840  a[7][4] = x4;
841  a[7][5] = y4;
842  a[7][6] = x4 * y4;
843  a[7][7] = 1.;
844 
845  gaussjordan(a, b, 8);
846 
847  for (i = 0; i < 8; i++)
848  LEPT_FREE(a[i]);
849 
850  return 0;
851 }
852 
853 
868 l_ok
870  l_int32 x,
871  l_int32 y,
872  l_int32 *pxp,
873  l_int32 *pyp)
874 {
875 
876  PROCNAME("bilinearXformSampledPt");
877 
878  if (!vc)
879  return ERROR_INT("vc not defined", procName, 1);
880 
881  *pxp = (l_int32)(vc[0] * x + vc[1] * y + vc[2] * x * y + vc[3] + 0.5);
882  *pyp = (l_int32)(vc[4] * x + vc[5] * y + vc[6] * x * y + vc[7] + 0.5);
883  return 0;
884 }
885 
886 
901 l_ok
902 bilinearXformPt(l_float32 *vc,
903  l_int32 x,
904  l_int32 y,
905  l_float32 *pxp,
906  l_float32 *pyp)
907 {
908  PROCNAME("bilinearXformPt");
909 
910  if (!vc)
911  return ERROR_INT("vc not defined", procName, 1);
912 
913  *pxp = vc[0] * x + vc[1] * y + vc[2] * x * y + vc[3];
914  *pyp = vc[4] * x + vc[5] * y + vc[6] * x * y + vc[7];
915  return 0;
916 }
l_int32 gaussjordan(l_float32 **a, l_float32 *b, l_int32 n)
gaussjordan()
Definition: affine.c:1345
PIX * pixRemoveColormap(PIX *pixs, l_int32 type)
pixRemoveColormap()
Definition: pixconv.c:322
PIX * pixBilinearColor(PIX *pixs, l_float32 *vc, l_uint32 colorval)
pixBilinearColor()
Definition: bilinear.c:453
l_ok pixSetRGBComponent(PIX *pixd, PIX *pixs, l_int32 comp)
pixSetRGBComponent()
Definition: pix2.c:2463
PIX * pixBilinearPta(PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor)
pixBilinearPta()
Definition: bilinear.c:286
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
struct Pix * pixs
Definition: bilateral.h:117
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 * pixBilinearPtaGray(PIX *pixs, PTA *ptad, PTA *ptas, l_uint8 grayval)
pixBilinearPtaGray()
Definition: bilinear.c:515
PIX * pixBilinear(PIX *pixs, l_float32 *vc, l_int32 incolor)
pixBilinear()
Definition: bilinear.c:356
PIX * pixBilinearPtaWithAlpha(PIX *pixs, PTA *ptad, PTA *ptas, PIX *pixg, l_float32 fract, l_int32 border)
pixBilinearPtaWithAlpha()
Definition: bilinear.c:644
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 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
l_ok getBilinearXformCoeffs(PTA *ptas, PTA *ptad, l_float32 **pvc)
getBilinearXformCoeffs()
Definition: bilinear.c:776
void pixDestroy(PIX **ppix)
pixDestroy()
Definition: pix1.c:543
PIX * pixBilinearSampled(PIX *pixs, l_float32 *vc, l_int32 incolor)
pixBilinearSampled()
Definition: bilinear.c:193
l_ok pixGetDimensions(const PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd)
pixGetDimensions()
Definition: pix1.c:1065
PIX * pixBilinearPtaColor(PIX *pixs, PTA *ptad, PTA *ptas, l_uint32 colorval)
pixBilinearPtaColor()
Definition: bilinear.c:412
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
l_ok bilinearXformPt(l_float32 *vc, l_int32 x, l_int32 y, l_float32 *pxp, l_float32 *pyp)
bilinearXformPt()
Definition: bilinear.c:902
Definition: pix.h:134
void ptaDestroy(PTA **ppta)
ptaDestroy()
Definition: ptabasic.c:192
PIX * pixBilinearSampledPta(PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor)
pixBilinearSampledPta()
Definition: bilinear.c:143
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 * pixBilinearGray(PIX *pixs, l_float32 *vc, l_uint8 grayval)
pixBilinearGray()
Definition: bilinear.c:556
Definition: pix.h:517
l_ok bilinearXformSampledPt(l_float32 *vc, l_int32 x, l_int32 y, l_int32 *pxp, l_int32 *pyp)
bilinearXformSampledPt()
Definition: bilinear.c:869