zbar库中的zbar_scan_y函数

简介: zbar库中的zbar_scan_y函数
zbar_symbol_type_t zbar_scan_y (zbar_scanner_t *scn,
                                int y)
{
    /* FIXME calc and clip to max y range... */
    /* retrieve short value history */
    register int x = scn->x;
    register int y0_1 = scn->y0[(x - 1) & 3];
    register int y0_0 = y0_1;
    if(x) {
        /* update weighted moving average */
        y0_0 += ((int)((y - y0_1) * EWMA_WEIGHT)) >> ZBAR_FIXED;
        scn->y0[x & 3] = y0_0;
    }
    else
        y0_0 = y0_1 = scn->y0[0] = scn->y0[1] = scn->y0[2] = scn->y0[3] = y;
    register int y0_2 = scn->y0[(x - 2) & 3];
    register int y0_3 = scn->y0[(x - 3) & 3];
    /* 1st differential @ x-1 */
    register int y1_1 = y0_1 - y0_2;
    {
        register int y1_2 = y0_2 - y0_3;
        if((abs(y1_1) < abs(y1_2)) &&
           ((y1_1 >= 0) == (y1_2 >= 0)))
            y1_1 = y1_2;
    }
    /* 2nd differentials @ x-1 & x-2 */
    register int y2_1 = y0_0 - (y0_1 * 2) + y0_2;
    register int y2_2 = y0_1 - (y0_2 * 2) + y0_3;
    dprintf(1, "scan: x=%d y=%d y0=%d y1=%d y2=%d",
            x, y, y0_1, y1_1, y2_1);
    zbar_symbol_type_t edge = ZBAR_NONE;
    /* 2nd zero-crossing is 1st local min/max - could be edge */
    if((!y2_1 ||
        ((y2_1 > 0) ? y2_2 < 0 : y2_2 > 0)) &&
       (calc_thresh(scn) <= abs(y1_1)))
    {
        /* check for 1st sign change */
        char y1_rev = (scn->y1_sign > 0) ? y1_1 < 0 : y1_1 > 0;
        if(y1_rev)
            /* intensity change reversal - finalize previous edge */
            edge = process_edge(scn, y1_1);
        if(y1_rev || (abs(scn->y1_sign) < abs(y1_1))) {
            scn->y1_sign = y1_1;
            /* adaptive thresholding */
            /* start at multiple of new min/max */
            scn->y1_thresh = (abs(y1_1) * THRESH_INIT + ROUND) >> ZBAR_FIXED;
            dprintf(1, "\tthr=%d", scn->y1_thresh);
            if(scn->y1_thresh < scn->y1_min_thresh)
                scn->y1_thresh = scn->y1_min_thresh;
            /* update current edge */
            int d = y2_1 - y2_2;
            scn->cur_edge = 1 << ZBAR_FIXED;
            if(!d)
                scn->cur_edge >>= 1;
            else if(y2_1)
                /* interpolate zero crossing */
                scn->cur_edge -= ((y2_1 << ZBAR_FIXED) + 1) / d;
            scn->cur_edge += x << ZBAR_FIXED;
            dprintf(1, "\n");
        }
    }
    else
        dprintf(1, "\n");
    /* FIXME add fall-thru pass to decoder after heuristic "idle" period
       (eg, 6-8 * last width) */
    scn->x = x + 1;
    return(edge);
}
目录
相关文章
|
9月前
|
计算机视觉 Python
成功解决Python导入opencv报错“DLL load failed while importing cv2: 找不到指定的模”
成功解决Python导入opencv报错“DLL load failed while importing cv2: 找不到指定的模”
197 0
|
计算机视觉
交叉编译opencv:undefined reference to `png_riffle_palette_neon
交叉编译opencv:undefined reference to `png_riffle_palette_neon
127 0
|
计算机视觉 Python
Python安装cv2库出错及解决:Could not find a version that satisfies the requirement cv2
Python安装cv2库出错及解决:Could not find a version that satisfies the requirement cv2
542 0
|
Java BI Android开发
MAT(Memory Analyer Tool)入门拾遗
MAT是基于Eclipse的内存分析工具,MAT(Memory Analyer Tool),它是一个快速、功能丰富的Java Heap的分析工具,它可以帮助我们查找内存泄漏和排查问题,而且还有丰富的报表统计等等。我们可以通过插件的形式运行还可以单独下载,在前文中我们介绍了如何安装MAT工具,详情可以翻阅查看。
121 1
MAT(Memory Analyer Tool)入门拾遗
关于 海思平台sample的demo中添加ffmpeg静态库(.a)报错误undefined reference toavpriv_pix_fmt_hps_avi等错误 的解决方法
关于 海思平台sample的demo中添加ffmpeg静态库(.a)报错误undefined reference toavpriv_pix_fmt_hps_avi等错误 的解决方法
关于 海思平台sample的demo中添加ffmpeg静态库(.a)报错误undefined reference toavpriv_pix_fmt_hps_avi等错误 的解决方法
|
机器学习/深度学习 算法 PyTorch
yolov5--从Github下载到运行遇到的错误集锦【pycocotools报错+Can‘t get attribute SPPF+in _next_assert img0 is not None】
yolov5--从Github下载到运行遇到的错误集锦【pycocotools报错+Can‘t get attribute SPPF+in _next_assert img0 is not None】
442 0
yolov5--从Github下载到运行遇到的错误集锦【pycocotools报错+Can‘t get attribute SPPF+in _next_assert img0 is not None】
zbar中的zbar_scan_image 函数
zbar中的zbar_scan_image 函数
333 0
ZBAR库
ZBAR库
191 0
零元学Expression Blend 4 Chapter 22 以实作案例学习Frame及HyperlinkButton
原文:零元学Expression Blend 4 Chapter 22 以实作案例学习Frame及HyperlinkButton 本章将教大家如何以实作善用Blend4的内建功能-「Frame」以及「Hy...
1318 0