void MyProcessingClass::PreProcessingToEntropy()
{

    /*
     *
     * function [preProcessed_Im] = PreProcessingToEntropy(image,size)

    red = double(image(:,:,1));
    green = double(image(:,:,2));
    blue = double(image(:,:,3));

    I = uint8((double(red) + double(green) + double(blue))/3);

    %to use a medfilter
    medfilt_I = medfilt2(I,[size size]);

    %use a CLAHE
    preProcessed_Im = adapthisteq(medfilt_I(:,:));

     * */
    std::vector<cv::Mat> image_channels(3);

    cv::split(m_input_image, image_channels);

    m_red_channel = image_channels.at(0);
    m_green_channel = image_channels.at(1);
    m_blue_channel = image_channels.at(2);


    cv::Mat for_median_filter = (m_red_channel + m_green_channel + m_blue_channel) / 3.0;

    cv::medianBlur(for_median_filter, for_median_filter, m_median_filet_kernel_size);

    cv::Ptr<cv::CLAHE> clahe = cv::createCLAHE();
    clahe->setClipLimit(4.0);

    clahe->apply(for_median_filter, pre_processed_image);
}
Beispiel #2
0
      Sdraw_vertical_gradient, (repv img, repv from_, repv to_), rep_Subr3)
{
    unsigned char from[3], to[3];
    int width, height, stride, channels;
    int x, y;
    unsigned char *data;

    rep_DECLARE1(img, IMAGEP);
    rep_DECLARE2(from_, COLORP);
    rep_DECLARE3(to_, COLORP);

    data = image_pixels (VIMAGE(img));
    width = image_width (VIMAGE(img));
    height = image_height (VIMAGE(img));
    stride = image_row_stride (VIMAGE(img));
    channels = image_channels (VIMAGE(img));

    from[0] = VCOLOR(from_)->red / 256;
    from[1] = VCOLOR(from_)->green / 256;
    from[2] = VCOLOR(from_)->blue / 256;
    to[0] = VCOLOR(to_)->red / 256;
    to[1] = VCOLOR(to_)->green / 256;
    to[2] = VCOLOR(to_)->blue / 256;

    for (y = 0; y < height; y++)
    {
	for (x = 0; x < width; x++)
	{
	    data[y*stride+x*channels+0] = (from[0] + (to[0] - from[0])
					   * y / height);
	    data[y*stride+x*channels+1] = (from[1] + (to[1] - from[1])