Ejemplo n.º 1
0
bool ModeJpeg::Process(RASTERDATA *input)
{
    if (input == NULL)
    {
        return false;
    }
    if (input->rasterdata[COLORTYPE_COLOR])
    {
        if (m_iColorMode == 0)
        {
            memcpy(m_pbyInputBuffer + (m_iRowNumber * m_iRowWidth), input->rasterdata[COLORTYPE_COLOR],
                   input->rastersize[COLORTYPE_COLOR]);
        }
        else
        {
            rgbToGray(input->rasterdata[COLORTYPE_COLOR], input->rastersize[COLORTYPE_COLOR]);
        }
    }
    m_iRowNumber++;
    if (m_iRowNumber == m_iBandHeight)
    {
        compress();
        return true;
    }
    return false;
}
Ejemplo n.º 2
0
int sobelFilter(byte *rgb, byte **gray, byte **sobel_h_res, byte **sobel_v_res, byte **contour_img, int width, int height) {
    int sobel_h[] = {-1, 0, 1, -2, 0, 2, -1, 0, 1},
        sobel_v[] = {1, 2, 1, 0, 0, 0, -1, -2, -1};

    int rgb_size = width*height*3;

    // Get gray representation of the image
    int gray_size = rgbToGray(rgb, gray, rgb_size);

    // Make sobel operations
    itConv(*gray, gray_size, width, sobel_h, sobel_h_res);
    itConv(*gray, gray_size, width, sobel_v, sobel_v_res);

    // Calculate contour matrix
    contour(*sobel_h_res, *sobel_v_res, gray_size, contour_img);

    return gray_size;
}