src/dewarp.c
l_int32
dewarpApplyDisparity(L_DEWARP  *dew,
                     PIX       *pixs,
                     l_int32    debugflag)
{
PIX  *pixv, *pixd;

    PROCNAME("dewarpApplyDisparity");

    if (!dew)
        return ERROR_INT("dew not defined", procName, 1);
    if (dew->success == 0)
        return ERROR_INT("model failed to build", procName, 1);
    if (!pixs)
        return ERROR_INT("pixs not defined", procName, 1);

        /* Generate the full res disparity arrays if they don't exist;
         * e.g., if they've been minimized or read from file.  */
    dewarpPopulateFullRes(dew);
    pixDestroy(&dew->pixd);  /* remove any previous one */

    if ((pixv = pixApplyVerticalDisparity(pixs, dew->fullvdispar)) == NULL)
        return ERROR_INT("pixv not made", procName, 1);
    if (debugflag) {
        pixDisplayWithTitle(pixv, 300, 0, "pixv", 1);
        pixWriteTempfile("/tmp", "pixv.png", pixv, IFF_PNG, NULL);
    }

    if (dew->applyhoriz) {
        if ((pixd = pixApplyHorizontalDisparity(pixv, dew->fullhdispar,
                                                dew->extraw)) == NULL)
            return ERROR_INT("pixd not made", procName, 1);
        pixDestroy(&pixv);
        dew->pixd = pixd;
        if (debugflag) {
            pixDisplayWithTitle(pixd, 600, 0, "pixd", 1);
            pixWriteTempfile("/tmp", "pixd.png", pixd, IFF_PNG, NULL);
        }
    }
    else
        dew->pixd = pixv;
    return 0;
}
/*!
 *  dewarpApplyDisparity()
 *
 *      Input:  dew
 *              pixs (image to be modified; can be 1, 8 or 32 bpp)
 *              debugflag
 *      Return: 0 if OK, 1 on error
 *
 *  Notes:
 *      (1) This applies the vertical disparity array to the specified
 *          image.  For src pixels above the image, we use the pixels
 *          in the first raster line.
 *      (2) This works with stripped models.  If the full resolution
 *          disparity array(s) are missing, they are remade.
 */
dewarpApplyDisparity()
Input:  dew
pixs (image to be modified; can be 1, 8 or 32 bpp)
debugflag
Return: 0 if OK, 1 on error

(1) This applies the vertical disparity array to the specified
image.  For src pixels above the image, we use the pixels
in the first raster line.
(2) This works with stripped models.  If the full resolution
disparity array(s) are missing, they are remade.
dewarpApplyDisparity () Input : dew pixs ( image to be modified ; can be 1 8 or 32 bpp ) debugflag Return : 0 if OK 1 on error ( 1 ) This applies the vertical disparity array to the specified image . For src pixels above the image we use the pixels in the first raster line . ( 2 ) This works with stripped models . If the full resolution disparity array ( s ) are missing they are remade .
l_int32
dewarpApplyDisparity(L_DEWARP  *dew,
                     PIX       *pixs,
                     l_int32    debugflag)
{
PIX  *pixv, *pixd;
    PROCNAME("dewarpApplyDisparity");
    if (!dew)
        return ERROR_INT("dew not defined", procName, 1);
    if (dew->success == 0)
        return ERROR_INT("model failed to build", procName, 1);
    if (!pixs)
        return ERROR_INT("pixs not defined", procName, 1);
    dewarpPopulateFullRes(dew);
    pixDestroy(&dew->pixd);  
    if ((pixv = pixApplyVerticalDisparity(pixs, dew->fullvdispar)) == NULL)
        return ERROR_INT("pixv not made", procName, 1);
    if (debugflag) {
        pixDisplayWithTitle(pixv, 300, 0, "pixv", 1);
        pixWriteTempfile("/tmp", "pixv.png", pixv, IFF_PNG, NULL);
    }
    if (dew->applyhoriz) {
        if ((pixd = pixApplyHorizontalDisparity(pixv, dew->fullhdispar,
                                                dew->extraw)) == NULL)
            return ERROR_INT("pixd not made", procName, 1);
        pixDestroy(&pixv);
        dew->pixd = pixd;
        if (debugflag) {
            pixDisplayWithTitle(pixd, 600, 0, "pixd", 1);
            pixWriteTempfile("/tmp", "pixd.png", pixd, IFF_PNG, NULL);
        }
    }
    else
        dew->pixd = pixv;
    return 0;
}
l_int32 dewarpApplyDisparity ( L_DEWARP * dew , PIX * pixs , l_int32 debugflag ) { PIX * pixv , * pixd ; PROCNAME ( " " ) ; if ( ! dew ) return ERROR_INT ( " " , procName , 1 ) ; if ( dew -> success == 0 ) return ERROR_INT ( " " , procName , 1 ) ; if ( ! pixs ) return ERROR_INT ( " " , procName , 1 ) ; dewarpPopulateFullRes ( dew ) ; pixDestroy ( & dew -> pixd ) ; if ( ( pixv = pixApplyVerticalDisparity ( pixs , dew -> fullvdispar ) ) == NULL ) return ERROR_INT ( " " , procName , 1 ) ; if ( debugflag ) { pixDisplayWithTitle ( pixv , 300 , 0 , " " , 1 ) ; pixWriteTempfile ( " " , " " , pixv , IFF_PNG , NULL ) ; } if ( dew -> applyhoriz ) { if ( ( pixd = pixApplyHorizontalDisparity ( pixv , dew -> fullhdispar , dew -> extraw ) ) == NULL ) return ERROR_INT ( " " , procName , 1 ) ; pixDestroy ( & pixv ) ; dew -> pixd = pixd ; if ( debugflag ) { pixDisplayWithTitle ( pixd , 600 , 0 , " " , 1 ) ; pixWriteTempfile ( " " , " " , pixd , IFF_PNG , NULL ) ; } } else dew -> pixd = pixv ; return 0 ; }
dewarpApplyDisparity()
      Input:  dew
              pixs (image to be modified; can be 1, 8 or 32 bpp)
              debugflag
      Return: 0 if OK, 1 on error
dewarpApplyDisparity () Input : dew pixs ( image to be modified ; can be 1 8 or 32 bpp ) debugflag Return : 0 if OK 1 on error
/* Generate the full res disparity arrays if they don't exist;
         * e.g., if they've been minimized or read from file.  */ /* remove any previous one */