35#include "allheaders.h"
37PIX *pixHMTDwa_1(
PIX *pixd,
PIX *pixs,
const char *selname);
38PIX *pixFHMTGen_1(
PIX *pixd,
PIX *pixs,
const char *selname);
39l_int32 fhmtgen_low_1(l_uint32 *datad, l_int32 w,
40 l_int32 h, l_int32 wpld,
41 l_uint32 *datas, l_int32 wpls,
44static l_int32 NUM_SELS_GENERATED = 10;
45static char SEL_NAMES[][80] = {
77PIX *pixt1, *pixt2, *pixt3;
80 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, pixd);
81 if (pixGetDepth(pixs) != 1)
82 return (
PIX *)ERROR_PTR(
"pixs must be 1 bpp", __func__, pixd);
84 pixt1 = pixAddBorder(pixs, 32, 0);
85 pixt2 = pixFHMTGen_1(NULL, pixt1, selname);
86 pixt3 = pixRemoveBorder(pixt2, 32);
119pixFHMTGen_1(
PIX *pixd,
123l_int32 i, index, found, w, h, wpls, wpld;
124l_uint32 *datad, *datas, *datat;
128 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, pixd);
129 if (pixGetDepth(pixs) != 1)
130 return (
PIX *)ERROR_PTR(
"pixs must be 1 bpp", __func__, pixd);
133 for (i = 0; i < NUM_SELS_GENERATED; i++) {
134 if (strcmp(selname, SEL_NAMES[i]) == 0) {
141 return (
PIX *)ERROR_PTR(
"sel index not found", __func__, pixd);
144 if ((pixd = pixCreateTemplate(pixs)) == NULL)
145 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
148 pixResizeImageData(pixd, pixs);
149 wpls = pixGetWpl(pixs);
150 wpld = pixGetWpl(pixd);
156 w = pixGetWidth(pixs) - 64;
157 h = pixGetHeight(pixs) - 64;
158 datas = pixGetData(pixs) + 32 * wpls + 1;
159 datad = pixGetData(pixd) + 32 * wpld + 1;
162 if ((pixt = pixCopy(NULL, pixs)) == NULL)
163 return (
PIX *)ERROR_PTR(
"pixt not made", __func__, pixd);
164 datat = pixGetData(pixt) + 32 * wpls + 1;
165 fhmtgen_low_1(datad, w, h, wpld, datat, wpls, index);
169 fhmtgen_low_1(datad, w, h, wpld, datas, wpls, index);