35 #include <config_auto.h> 39 #include "allheaders.h" 41 PIX *pixMorphDwa_2(
PIX *pixd,
PIX *
pixs, l_int32 operation,
char *selname);
42 PIX *pixFMorphopGen_2(
PIX *pixd,
PIX *
pixs, l_int32 operation,
char *selname);
43 l_int32 fmorphopgen_low_2(l_uint32 *datad, l_int32
w,
44 l_int32
h, l_int32 wpld,
45 l_uint32 *datas, l_int32 wpls,
48 static l_int32 NUM_SELS_GENERATED = 76;
49 static char SEL_NAMES[][80] = {
147 pixMorphDwa_2(
PIX *pixd,
152 l_int32 bordercolor, bordersize;
153 PIX *pixt1, *pixt2, *pixt3;
155 PROCNAME(
"pixMorphDwa_2");
158 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, pixd);
159 if (pixGetDepth(
pixs) != 1)
160 return (
PIX *)ERROR_PTR(
"pixs must be 1 bpp", procName, pixd);
165 if (bordercolor == 0 && operation == L_MORPH_CLOSE)
169 pixt2 = pixFMorphopGen_2(NULL, pixt1, operation, selname);
207 pixFMorphopGen_2(
PIX *pixd,
212 l_int32 i, index, found,
w,
h, wpls, wpld, bordercolor, erodeop, borderop;
213 l_uint32 *datad, *datas, *datat;
216 PROCNAME(
"pixFMorphopGen_2");
219 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, pixd);
220 if (pixGetDepth(
pixs) != 1)
221 return (
PIX *)ERROR_PTR(
"pixs must be 1 bpp", procName, pixd);
225 if (bordercolor == 1)
231 for (i = 0; i < NUM_SELS_GENERATED; i++) {
232 if (strcmp(selname, SEL_NAMES[i]) == 0) {
239 return (
PIX *)ERROR_PTR(
"sel index not found", procName, pixd);
243 return (
PIX *)ERROR_PTR(
"pixd not made", procName, NULL);
247 wpls = pixGetWpl(
pixs);
248 wpld = pixGetWpl(pixd);
254 w = pixGetWidth(
pixs) - 64;
255 h = pixGetHeight(
pixs) - 64;
259 if (operation == L_MORPH_DILATE || operation == L_MORPH_ERODE) {
261 if (operation == L_MORPH_ERODE) {
267 return (
PIX *)ERROR_PTR(
"pixt not made", procName, pixd);
270 fmorphopgen_low_2(datad,
w,
h, wpld, datat, wpls, index);
275 fmorphopgen_low_2(datad,
w,
h, wpld, datas, wpls, index);
280 return (
PIX *)ERROR_PTR(
"pixt not made", procName, pixd);
282 if (operation == L_MORPH_OPEN) {
284 fmorphopgen_low_2(datat,
w,
h, wpls, datas, wpls, index+1);
286 fmorphopgen_low_2(datad,
w,
h, wpld, datat, wpls, index);
290 fmorphopgen_low_2(datat,
w,
h, wpls, datas, wpls, index);
292 fmorphopgen_low_2(datad,
w,
h, wpld, datat, wpls, index+1);
l_ok pixResizeImageData(PIX *pixd, const PIX *pixs)
pixResizeImageData()
l_uint32 getMorphBorderPixelColor(l_int32 type, l_int32 depth)
getMorphBorderPixelColor()
PIX * pixCreateTemplate(const PIX *pixs)
pixCreateTemplate()
PIX * pixCopy(PIX *pixd, const PIX *pixs)
pixCopy()
l_uint32 * pixGetData(PIX *pix)
pixGetData()
l_ok pixSetOrClearBorder(PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot, l_int32 op)
pixSetOrClearBorder()
PIX * pixAddBorder(PIX *pixs, l_int32 npix, l_uint32 val)
pixAddBorder()
PIX * pixRemoveBorder(PIX *pixs, l_int32 npix)
pixRemoveBorder()
void pixDestroy(PIX **ppix)
pixDestroy()