Leptonica  1.83.1
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 
120 extern l_float32 AlphaMaskBorderVals[2];
121 
122 /*-------------------------------------------------------------*
123  * Sampled bilinear image transformation *
124  *-------------------------------------------------------------*/
144 PIX *
146  PTA *ptad,
147  PTA *ptas,
148  l_int32 incolor)
149 {
150 l_float32 *vc;
151 PIX *pixd;
152 
153  if (!pixs)
154  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
155  if (!ptas)
156  return (PIX *)ERROR_PTR("ptas not defined", __func__, NULL);
157  if (!ptad)
158  return (PIX *)ERROR_PTR("ptad not defined", __func__, NULL);
159  if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
160  return (PIX *)ERROR_PTR("invalid incolor", __func__, NULL);
161  if (ptaGetCount(ptas) != 4)
162  return (PIX *)ERROR_PTR("ptas count not 4", __func__, NULL);
163  if (ptaGetCount(ptad) != 4)
164  return (PIX *)ERROR_PTR("ptad count not 4", __func__, 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  if (!pixs)
204  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
205  if (!vc)
206  return (PIX *)ERROR_PTR("vc not defined", __func__, NULL);
207  if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
208  return (PIX *)ERROR_PTR("invalid incolor", __func__, 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", __func__, 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  bilinearXformSampledPt(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 bilinear 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  if (!pixs)
294  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
295  if (!ptas)
296  return (PIX *)ERROR_PTR("ptas not defined", __func__, NULL);
297  if (!ptad)
298  return (PIX *)ERROR_PTR("ptad not defined", __func__, NULL);
299  if (incolor != L_BRING_IN_WHITE && incolor != L_BRING_IN_BLACK)
300  return (PIX *)ERROR_PTR("invalid incolor", __func__, NULL);
301  if (ptaGetCount(ptas) != 4)
302  return (PIX *)ERROR_PTR("ptas count not 4", __func__, NULL);
303  if (ptaGetCount(ptad) != 4)
304  return (PIX *)ERROR_PTR("ptad count not 4", __func__, NULL);
305 
306  if (pixGetDepth(pixs) == 1)
307  return pixBilinearSampledPta(pixs, ptad, ptas, incolor);
308 
309  /* Remove cmap if it exists, and unpack to 8 bpp if necessary */
311  d = pixGetDepth(pixt1);
312  if (d < 8)
313  pixt2 = pixConvertTo8(pixt1, FALSE);
314  else
315  pixt2 = pixClone(pixt1);
316  d = pixGetDepth(pixt2);
317 
318  /* Compute actual color to bring in from edges */
319  colorval = 0;
320  if (incolor == L_BRING_IN_WHITE) {
321  if (d == 8)
322  colorval = 255;
323  else /* d == 32 */
324  colorval = 0xffffff00;
325  }
326 
327  if (d == 8)
328  pixd = pixBilinearPtaGray(pixt2, ptad, ptas, colorval);
329  else /* d == 32 */
330  pixd = pixBilinearPtaColor(pixt2, ptad, ptas, colorval);
331  pixDestroy(&pixt1);
332  pixDestroy(&pixt2);
333  return pixd;
334 }
335 
336 
351 PIX *
353  l_float32 *vc,
354  l_int32 incolor)
355 {
356 l_int32 d;
357 l_uint32 colorval;
358 PIX *pixt1, *pixt2, *pixd;
359 
360  if (!pixs)
361  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
362  if (!vc)
363  return (PIX *)ERROR_PTR("vc not defined", __func__, NULL);
364 
365  if (pixGetDepth(pixs) == 1)
366  return pixBilinearSampled(pixs, vc, incolor);
367 
368  /* Remove cmap if it exists, and unpack to 8 bpp if necessary */
370  d = pixGetDepth(pixt1);
371  if (d < 8)
372  pixt2 = pixConvertTo8(pixt1, FALSE);
373  else
374  pixt2 = pixClone(pixt1);
375  d = pixGetDepth(pixt2);
376 
377  /* Compute actual color to bring in from edges */
378  colorval = 0;
379  if (incolor == L_BRING_IN_WHITE) {
380  if (d == 8)
381  colorval = 255;
382  else /* d == 32 */
383  colorval = 0xffffff00;
384  }
385 
386  if (d == 8)
387  pixd = pixBilinearGray(pixt2, vc, colorval);
388  else /* d == 32 */
389  pixd = pixBilinearColor(pixt2, vc, colorval);
390  pixDestroy(&pixt1);
391  pixDestroy(&pixt2);
392  return pixd;
393 }
394 
395 
405 PIX *
407  PTA *ptad,
408  PTA *ptas,
409  l_uint32 colorval)
410 {
411 l_float32 *vc;
412 PIX *pixd;
413 
414  if (!pixs)
415  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
416  if (!ptas)
417  return (PIX *)ERROR_PTR("ptas not defined", __func__, NULL);
418  if (!ptad)
419  return (PIX *)ERROR_PTR("ptad not defined", __func__, NULL);
420  if (pixGetDepth(pixs) != 32)
421  return (PIX *)ERROR_PTR("pixs must be 32 bpp", __func__, NULL);
422  if (ptaGetCount(ptas) != 4)
423  return (PIX *)ERROR_PTR("ptas count not 4", __func__, NULL);
424  if (ptaGetCount(ptad) != 4)
425  return (PIX *)ERROR_PTR("ptad count not 4", __func__, NULL);
426 
427  /* Get backwards transform from dest to src, and apply it */
428  getBilinearXformCoeffs(ptad, ptas, &vc);
429  pixd = pixBilinearColor(pixs, vc, colorval);
430  LEPT_FREE(vc);
431 
432  return pixd;
433 }
434 
435 
444 PIX *
446  l_float32 *vc,
447  l_uint32 colorval)
448 {
449 l_int32 i, j, w, h, d, wpls, wpld;
450 l_uint32 val;
451 l_uint32 *datas, *datad, *lined;
452 l_float32 x, y;
453 PIX *pix1, *pix2, *pixd;
454 
455  if (!pixs)
456  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
457  pixGetDimensions(pixs, &w, &h, &d);
458  if (d != 32)
459  return (PIX *)ERROR_PTR("pixs must be 32 bpp", __func__, NULL);
460  if (!vc)
461  return (PIX *)ERROR_PTR("vc not defined", __func__, NULL);
462 
463  datas = pixGetData(pixs);
464  wpls = pixGetWpl(pixs);
465  pixd = pixCreateTemplate(pixs);
466  pixSetAllArbitrary(pixd, colorval);
467  datad = pixGetData(pixd);
468  wpld = pixGetWpl(pixd);
469 
470  /* Iterate over destination pixels */
471  for (i = 0; i < h; i++) {
472  lined = datad + i * wpld;
473  for (j = 0; j < w; j++) {
474  /* Compute float src pixel location corresponding to (i,j) */
475  bilinearXformPt(vc, j, i, &x, &y);
476  linearInterpolatePixelColor(datas, wpls, w, h, x, y, colorval,
477  &val);
478  *(lined + j) = val;
479  }
480  }
481 
482  /* If rgba, transform the pixs alpha channel and insert in pixd */
483  if (pixGetSpp(pixs) == 4) {
484  pix1 = pixGetRGBComponent(pixs, L_ALPHA_CHANNEL);
485  pix2 = pixBilinearGray(pix1, vc, 255); /* bring in opaque */
486  pixSetRGBComponent(pixd, pix2, L_ALPHA_CHANNEL);
487  pixDestroy(&pix1);
488  pixDestroy(&pix2);
489  }
490 
491  return pixd;
492 }
493 
494 
504 PIX *
506  PTA *ptad,
507  PTA *ptas,
508  l_uint8 grayval)
509 {
510 l_float32 *vc;
511 PIX *pixd;
512 
513  if (!pixs)
514  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
515  if (!ptas)
516  return (PIX *)ERROR_PTR("ptas not defined", __func__, NULL);
517  if (!ptad)
518  return (PIX *)ERROR_PTR("ptad not defined", __func__, NULL);
519  if (pixGetDepth(pixs) != 8)
520  return (PIX *)ERROR_PTR("pixs must be 8 bpp", __func__, NULL);
521  if (ptaGetCount(ptas) != 4)
522  return (PIX *)ERROR_PTR("ptas count not 4", __func__, NULL);
523  if (ptaGetCount(ptad) != 4)
524  return (PIX *)ERROR_PTR("ptad count not 4", __func__, NULL);
525 
526  /* Get backwards transform from dest to src, and apply it */
527  getBilinearXformCoeffs(ptad, ptas, &vc);
528  pixd = pixBilinearGray(pixs, vc, grayval);
529  LEPT_FREE(vc);
530 
531  return pixd;
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  bilinearXformPt(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  * Bilinear transform including alpha (blend) component *
585  *-------------------------------------------------------------------------*/
629 PIX *
631  PTA *ptad,
632  PTA *ptas,
633  PIX *pixg,
634  l_float32 fract,
635  l_int32 border)
636 {
637 l_int32 ws, hs, d;
638 PIX *pixd, *pixb1, *pixb2, *pixg2, *pixga;
639 PTA *ptad2, *ptas2;
640 
641  if (!pixs)
642  return (PIX *)ERROR_PTR("pixs not defined", __func__, NULL);
643  pixGetDimensions(pixs, &ws, &hs, &d);
644  if (d != 32 && pixGetColormap(pixs) == NULL)
645  return (PIX *)ERROR_PTR("pixs not cmapped or 32 bpp", __func__, NULL);
646  if (pixg && pixGetDepth(pixg) != 8) {
647  L_WARNING("pixg not 8 bpp; using 'fract' transparent alpha\n",
648  __func__);
649  pixg = NULL;
650  }
651  if (!pixg && (fract < 0.0 || fract > 1.0)) {
652  L_WARNING("invalid fract; using 1.0 (fully transparent)\n", __func__);
653  fract = 1.0;
654  }
655  if (!pixg && fract == 0.0)
656  L_WARNING("fully opaque alpha; image cannot be blended\n", __func__);
657  if (!ptad)
658  return (PIX *)ERROR_PTR("ptad not defined", __func__, NULL);
659  if (!ptas)
660  return (PIX *)ERROR_PTR("ptas not defined", __func__, NULL);
661 
662  /* Add border; the color doesn't matter */
663  pixb1 = pixAddBorder(pixs, border, 0);
664 
665  /* Transform the ptr arrays to work on the bordered image */
666  ptad2 = ptaTransform(ptad, border, border, 1.0, 1.0);
667  ptas2 = ptaTransform(ptas, border, border, 1.0, 1.0);
668 
669  /* Do separate bilinear transform of rgb channels of pixs and of pixg */
670  pixd = pixBilinearPtaColor(pixb1, ptad2, ptas2, 0);
671  if (!pixg) {
672  pixg2 = pixCreate(ws, hs, 8);
673  if (fract == 1.0)
674  pixSetAll(pixg2);
675  else
676  pixSetAllArbitrary(pixg2, (l_int32)(255.0 * fract));
677  } else {
678  pixg2 = pixResizeToMatch(pixg, NULL, ws, hs);
679  }
680  if (ws > 10 && hs > 10) { /* see note 7 */
681  pixSetBorderRingVal(pixg2, 1,
682  (l_int32)(255.0 * fract * AlphaMaskBorderVals[0]));
683  pixSetBorderRingVal(pixg2, 2,
684  (l_int32)(255.0 * fract * AlphaMaskBorderVals[1]));
685 
686  }
687  pixb2 = pixAddBorder(pixg2, border, 0); /* must be black border */
688  pixga = pixBilinearPtaGray(pixb2, ptad2, ptas2, 0);
689  pixSetRGBComponent(pixd, pixga, L_ALPHA_CHANNEL);
690  pixSetSpp(pixd, 4);
691 
692  pixDestroy(&pixg2);
693  pixDestroy(&pixb1);
694  pixDestroy(&pixb2);
695  pixDestroy(&pixga);
696  ptaDestroy(&ptad2);
697  ptaDestroy(&ptas2);
698  return pixd;
699 }
700 
701 
702 /*-------------------------------------------------------------*
703  * Bilinear coordinate transformation *
704  *-------------------------------------------------------------*/
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] = x1 * y1;
792  a[0][3] = 1.;
793  a[1][4] = x1;
794  a[1][5] = y1;
795  a[1][6] = x1 * y1;
796  a[1][7] = 1.;
797  a[2][0] = x2;
798  a[2][1] = y2;
799  a[2][2] = x2 * y2;
800  a[2][3] = 1.;
801  a[3][4] = x2;
802  a[3][5] = y2;
803  a[3][6] = x2 * y2;
804  a[3][7] = 1.;
805  a[4][0] = x3;
806  a[4][1] = y3;
807  a[4][2] = x3 * y3;
808  a[4][3] = 1.;
809  a[5][4] = x3;
810  a[5][5] = y3;
811  a[5][6] = x3 * y3;
812  a[5][7] = 1.;
813  a[6][0] = x4;
814  a[6][1] = y4;
815  a[6][2] = x4 * y4;
816  a[6][3] = 1.;
817  a[7][4] = x4;
818  a[7][5] = y4;
819  a[7][6] = x4 * y4;
820  a[7][7] = 1.;
821 
822  gaussjordan(a, b, 8);
823 
824  for (i = 0; i < 8; i++)
825  LEPT_FREE(a[i]);
826  return 0;
827 }
828 
829 
844 l_ok
846  l_int32 x,
847  l_int32 y,
848  l_int32 *pxp,
849  l_int32 *pyp)
850 {
851 
852  if (!vc)
853  return ERROR_INT("vc not defined", __func__, 1);
854 
855  *pxp = (l_int32)(vc[0] * x + vc[1] * y + vc[2] * x * y + vc[3] + 0.5);
856  *pyp = (l_int32)(vc[4] * x + vc[5] * y + vc[6] * x * y + vc[7] + 0.5);
857  return 0;
858 }
859 
860 
875 l_ok
876 bilinearXformPt(l_float32 *vc,
877  l_int32 x,
878  l_int32 y,
879  l_float32 *pxp,
880  l_float32 *pyp)
881 {
882  if (!vc)
883  return ERROR_INT("vc not defined", __func__, 1);
884 
885  *pxp = vc[0] * x + vc[1] * y + vc[2] * x * y + vc[3];
886  *pyp = vc[4] * x + vc[5] * y + vc[6] * x * y + vc[7];
887  return 0;
888 }
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
PIX * pixBilinearSampled(PIX *pixs, l_float32 *vc, l_int32 incolor)
pixBilinearSampled()
Definition: bilinear.c:193
l_ok bilinearXformPt(l_float32 *vc, l_int32 x, l_int32 y, l_float32 *pxp, l_float32 *pyp)
bilinearXformPt()
Definition: bilinear.c:876
PIX * pixBilinear(PIX *pixs, l_float32 *vc, l_int32 incolor)
pixBilinear()
Definition: bilinear.c:352
PIX * pixBilinearSampledPta(PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor)
pixBilinearSampledPta()
Definition: bilinear.c:145
PIX * pixBilinearPtaWithAlpha(PIX *pixs, PTA *ptad, PTA *ptas, PIX *pixg, l_float32 fract, l_int32 border)
pixBilinearPtaWithAlpha()
Definition: bilinear.c:630
PIX * pixBilinearPtaGray(PIX *pixs, PTA *ptad, PTA *ptas, l_uint8 grayval)
pixBilinearPtaGray()
Definition: bilinear.c:505
l_ok bilinearXformSampledPt(l_float32 *vc, l_int32 x, l_int32 y, l_int32 *pxp, l_int32 *pyp)
bilinearXformSampledPt()
Definition: bilinear.c:845
PIX * pixBilinearGray(PIX *pixs, l_float32 *vc, l_uint8 grayval)
pixBilinearGray()
Definition: bilinear.c:544
PIX * pixBilinearPta(PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor)
pixBilinearPta()
Definition: bilinear.c:284
PIX * pixBilinearColor(PIX *pixs, l_float32 *vc, l_uint32 colorval)
pixBilinearColor()
Definition: bilinear.c:445
PIX * pixBilinearPtaColor(PIX *pixs, PTA *ptad, PTA *ptas, l_uint32 colorval)
pixBilinearPtaColor()
Definition: bilinear.c:406
l_ok getBilinearXformCoeffs(PTA *ptas, PTA *ptad, l_float32 **pvc)
getBilinearXformCoeffs()
Definition: bilinear.c:760
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
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