Esempio n. 1
0
QPixmap ImageFilter::operator ()(QPixmap sourcePixmap, Filter::FilterType filter, int delta)
{
    QImage origin(sourcePixmap.toImage());

    switch (filter)
    {
    case Filter::Gray_Scale:
        return grayScale(origin);
        break;
    case Filter::Brightness:
        return brightness(origin, delta);
        break;
    case Filter::Temperature:
        return temperature(origin, delta);
        break;
    case Filter::Saturation:
        return saturate(origin, delta);
        break;
    case Filter::Blur:
        return blur(origin);
        break;
    case Filter::Sharpen:
        return sharpen(origin);
        break;
    case Filter::Sepia:
        return sepia(origin);
        break;
    }
}
Esempio n. 2
0
int main( int argc, char* argv[] )
{
  int i;
  int resr, resg, resb;
  int results_data_r[DATA_SIZE][DATA_SIZE];
  int results_data_g[DATA_SIZE][DATA_SIZE];
  int results_data_b[DATA_SIZE][DATA_SIZE];
  int cycles, insts;
  cycles = getTime();
  insts = getInsts();
  for (i = 0; i < DATA_SIZE; i++)
  {
    sharpen( input_data_r, input_data_g, input_data_b,
                results_data_r, results_data_g, results_data_b);
  }
  cycles = getTime() - cycles;
  insts = getInsts() - insts;
  printStr("Cycles = "); printInt(cycles); printChar('\n');
  printStr("Insts  = "); printInt(insts); printChar('\n');
  
  // Check the results

  resr = verify(results_data_r, verify_data_r);
  resg = verify(results_data_g, verify_data_g);
  resb = verify(results_data_b, verify_data_b);

  return (resr != 1 || resg != 1 || resb != 1);
}
void imageturn(Mat imagein,Mat &imageout)//将rgb转化hsv,然后改变hsv图像。
{
IplImage imgtemp=imagein;
IplImage* src =cvCloneImage(&imgtemp);
IplImage* floathsv = NULL;
IplImage* floatimgH = NULL;
IplImage* floatimgS = NULL;
IplImage* floatimgV = NULL;
IplImage* floatimgZ = NULL;
CvSize size = cvGetSize( src );
IplImage* imgout=cvCreateImage( size, 8, 3 );
floathsv = cvCreateImage( size, 8, 3 );
floatimgH = cvCreateImage( size, 8, 1 );
floatimgS = cvCreateImage( size,8, 1 );
floatimgV = cvCreateImage( size, 8, 1 );
floatimgZ = cvCreateImage( size, 8, 1 );
cvCvtColor(src,floathsv,CV_BGR2HSV);
cvSplit( floathsv, floatimgH, floatimgS, floatimgV, NULL);
Mat V(floatimgV,true);
Mat Vout;
sharpen(V,Vout);
imgtemp=Vout;
floatimgV=cvCloneImage(&imgtemp);
cvSmooth(floatimgV, floatimgZ, CV_MEDIAN);//中值滤波
cvEqualizeHist( floatimgZ, floatimgV ); //直方图均衡化
cvMerge( floatimgH, floatimgS, floatimgV,0,imgout);
Mat M(imgout,true);
imageout=M;
}
int main() {
    Imagem* img;
    int opcao = 1;
    int i=0,j=0;
    int limiar=-1;
    char nome[255];
    int grau=0;


    while (opcao != 0) {
        opcao = mostrar_menu();

        if (opcao == 1) {
            printf("Nome do arquivo: ");
            scanf("%s", nome);
            img = ler_imagem(nome);
        } else if (opcao == 2) {
            img = blur(img);
        } else if (opcao == 3) {
            img = sharpen(img);
    	} else if(opcao == 4){
			img = borda(img);
		}else if(opcao == 5){
		    printf("Digite o limiar: ");
            scanf("%i", &limiar);
            img = binarizacao_imagem(img, limiar);
		}else if(opcao == 6){
			printf("Grau de rotacao (90, 180 ou 270º): ");
			scanf("%i", &grau);
			if(grau == 90){
				img = rotacionar90(img);
			}else if(grau == 180){
				img = rotacionar180(img);
			}else if(grau == 270){
				img = rotacionar270(img);
			}else{
				printf("O grau informado nao e permitido.");
			}
		}else if(opcao == 7){
			img = zoom2x(img);
		}else if(opcao == 8){
			img = reduzir2x(img);
		}else if(opcao == 9){
			img = gaussianblur(img);
		}else if (opcao == 10){
		    printf("Nome do arquivo: ");
            scanf("%s", nome);
            salvar_imagem(img, nome);
        }else{
        	printf("Opção inválida.");
		}
    }

    return 0;
}
Esempio n. 5
0
static void _sharpen(QString sourceFile, QString destFile)
{
    QImage image(sourceFile);
    if(image.isNull())
    {
        qDebug() << "load " << sourceFile << " failed! ";
        return;
    }
    int width = image.width();
    int height = image.height();
    int threshold = 80;
    QImage sharpen(width, height, QImage::Format_ARGB32);
    int r, g, b, gradientR, gradientG, gradientB;
    QRgb rgb00, rgb01, rgb10;
    for(int i = 0; i < width; i++)
    {
        for(int j= 0; j < height; j++)
        {
            if(image.valid(i, j) &&
                    image.valid(i+1, j) &&
                    image.valid(i, j+1))
            {
                rgb00 = image.pixel(i, j);
                rgb01 = image.pixel(i, j+1);
                rgb10 = image.pixel(i+1, j);
                r = qRed(rgb00);
                g = qGreen(rgb00);
                b = qBlue(rgb00);
                gradientR = abs(r - qRed(rgb01)) + abs(r - qRed(rgb10));
                gradientG = abs(g - qGreen(rgb01)) + abs(g - qGreen(rgb10));
                gradientB = abs(b - qBlue(rgb01)) + abs(b - qBlue(rgb10));

                if(gradientR > threshold)
                {
                    r = qMin(gradientR + 100, 255);
                }

                if(gradientG > threshold)
                {
                    g = qMin( gradientG + 100, 255);
                }

                if(gradientB > threshold)
                {
                    b = qMin( gradientB + 100, 255);
                }

                sharpen.setPixel(i, j, qRgb(r, g, b));
            }
        }
    }

    sharpen.save(destFile);
}
int main()
{
	cv::Mat image= cv::imread("boldt.jpg");
	if (!image.data)
		return 0; 
	// image is resize for book printing
	cv::resize(image, image, cv::Size(), 0.6, 0.6);

	cv::Mat result;

	double time= static_cast<double>(cv::getTickCount());
	sharpen(image, result);
	time= (static_cast<double>(cv::getTickCount())-time)/cv::getTickFrequency();
	std::cout << "time= " << time << std::endl;

	cv::namedWindow("Image");
	cv::imshow("Image",result);

    // open the image in gray-level
	image= cv::imread("boldt.jpg",0);
	// image is resize for book printing
	cv::resize(image, image, cv::Size(), 0.6, 0.6);

	time = static_cast<double>(cv::getTickCount());
	sharpenIterator(image, result);
	time= (static_cast<double>(cv::getTickCount())-time)/cv::getTickFrequency();
	std::cout << "time 3= " << time << std::endl;

	cv::namedWindow("Sharpened Image");
	cv::imshow("Sharpened Image",result);

	image= cv::imread("boldt.jpg");
	// image is resize for book printing
	cv::resize(image, image, cv::Size(), 0.6, 0.6);

	time = static_cast<double>(cv::getTickCount());
	sharpen2D(image, result);
	time= (static_cast<double>(cv::getTickCount())-time)/cv::getTickFrequency();
	std::cout << "time 2D= " << time << std::endl;

	cv::namedWindow("Image 2D");
	cv::imshow("Image 2D",result);

	cv::waitKey();

	return 0;
}
Esempio n. 7
0
/* Generate pixel and capture into table */
static ntsc_rgb_t* gen_pixel( ntsc_to_rgb_t* ntsc, int ntsc_pos, int rescaled_pos, ntsc_rgb_t* out )
{
	ntsc_to_rgb( ntsc, composite_border + ntsc_pos, ntsc->rgb [rgb_pad] );
	rescale( ntsc->rgb [0], rescaled_size, ntsc->rescaled [1] );
	sharpen( ntsc->rescaled [1], ntsc->sharpness, rescaled_size, ntsc->rescaled [0] );
	
	{
		short const* in = ntsc->rescaled [rescaled_pos];
		int n = rgb_kernel_size;
		while ( n-- )
		{
			*out++ = MAKE_KRGB( in [0], in [1], in [2] );
			in += 3;
		}
	}
	return out;
}
Esempio n. 8
0
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    cv::Mat image = cv::imread("/Users/Haoyang/Downloads/boldtgray.jpg");
    cv::Mat result;
    sharpen(image,result);
    cv::namedWindow("sharpen");
    imshow("sharpen",result);


    cv::namedWindow("2D");
    sharpen2D(image,result);
    imshow("2D",result);


    return a.exec();
}
Esempio n. 9
0
/*
水彩效果平滑图像的不规则部分,然后强调色彩边界
(grayscale or color image, 8- or 24-bit. ) 
*/
BOOL VPicEx::WaterColor()
{
	imgdes *srcimg=GetImgDes();

	imgdes tmpsrc;
	int cols, rows, rcode;
	double gamma = 0.7;
	cols = CALC_WIDTH(srcimg);
	rows = CALC_HEIGHT(srcimg);
	allocimage(&tmpsrc, cols, rows, srcimg->bmh->biBitCount);
	copyimage(srcimg, &tmpsrc);
	gammabrighten(gamma, &tmpsrc, &tmpsrc);
	removenoise(&tmpsrc, &tmpsrc);
	removenoise(&tmpsrc, &tmpsrc);
	removenoise(&tmpsrc, &tmpsrc);
	sharpen(&tmpsrc, &tmpsrc);
	rcode = copyimage(&tmpsrc, srcimg);
	freeimage(&tmpsrc); 
	return(rcode == NO_ERROR);
}
Esempio n. 10
0
QImage ImgConvolutions::applyConvolution(convolutionList op, QImage *img1, int filterSize){
    switch(op){
        case CONV_PASABAJOS:
            return pasaBajos(img1, filterSize);
        case CONV_BARTLETT:
        case CONV_GAUSSIANO:
        case CONV_SHARPEN:
            return sharpen(img1, filterSize);
        case CONV_MOTIONBLUR:
            return motionBlur(img1, filterSize);
        case CONV_PASAALTOS:
            return pasaAltos(img1, filterSize);
        case CONV_SOBEL:
            return sobel(img1);
        case CONV_PA_LPv4:
            return laplacianov4(img1);
        case CONV_PA_LPv8:
            return laplacianov8(img1);
    }
    return QImage();
}
Esempio n. 11
0
int main()
{
    cv::Mat image = cv::imread("../images/boldt.jpg", 0);
    if (!image.data)
        return 0;

    cv::Mat result;
    result.create(image.size(), image.type());

    double time = static_cast<double>(cv::getTickCount());
    sharpen(image, result);
    time = (static_cast<double>(cv::getTickCount()) - time) / cv::getTickFrequency();
    std::cout << "time= " << time << std::endl;

    cv::namedWindow("Image");
    cv::imshow("Image", result);

    image = cv::imread("../images/boldt.jpg", 0);
    time = static_cast<double>(cv::getTickCount());
    sharpen3(image, result);
    time = (static_cast<double>(cv::getTickCount()) - time) / cv::getTickFrequency();
    std::cout << "time 3= " << time << std::endl;

    cv::namedWindow("Image 3");
    cv::imshow("Image 3", result);

    image = cv::imread("../images/boldt.jpg", 0);
    time = static_cast<double>(cv::getTickCount());
    sharpen2D(image, result);
    time = (static_cast<double>(cv::getTickCount()) - time) / cv::getTickFrequency();
    std::cout << "time 2D= " << time << std::endl;

    cv::namedWindow("Image 2D");
    cv::imshow("Image 2D", result);

    cv::waitKey();

    return 0;
}
Esempio n. 12
0
int main(int argc, char *argv[])
{
  if (argc != 4)
  {
    cout << "Usage: " << argv[0] << " cpu|gpu out_func out_prefix" << endl;
    return 1;
  }

  ImageParam input(UInt(8), 3, "input");
  Func clamped("clamped");
  Func convolved("convolved");
  Func sharpen("sharpen");
  Var c("c"), x("x"), y("y");

  // Algorithm
  clamped(x, y, c) = input(
    clamp(x, 0, input.width()-1),
    clamp(y, 0, input.height()-1),
    c) / 255.f;

  Image<int16_t> kernel(3, 3);
  kernel(0, 0) = -1;
  kernel(0, 1) = -1;
  kernel(0, 2) = -1;
  kernel(1, 0) = -1;
  kernel(1, 1) = 8;
  kernel(1, 2) = -1;
  kernel(2, 0) = -1;
  kernel(2, 1) = -1;
  kernel(2, 2) = -1;

  RDom r(kernel);
  convolved(x, y, c) += kernel(r.x, r.y) * clamped(x + r.x - 1, y + r.y - 1, c);
  sharpen(x, y, c) = u8(
    clamp(convolved(x, y, c)/8 + clamped(x, y, c), 0, 1) * 255
  );

  // Channel order
  input.set_stride(0, 4);
  input.set_extent(2, 4);
  sharpen.reorder_storage(c, x, y);
  sharpen.output_buffer().set_stride(0, 4);
  sharpen.output_buffer().set_extent(2, 4);

  // Schedules
  if (!strcmp(argv[1], "cpu"))
  {
    sharpen.parallel(y).vectorize(c, 4);
  }
  else if (!strcmp(argv[1], "gpu"))
  {
    sharpen.cuda_tile(x, y, 16, 4);
  }
  else
  {
    cout << "Invalid schedule type '" << argv[1] << "'" << endl;
    return 1;
  }

  compile(sharpen, input, argv[2], argv[3]);

  return 0;
}
Esempio n. 13
0
static void
run (const gchar      *name,
     gint              nparams,
     const GimpParam  *param,
     gint             *nreturn_vals,
     GimpParam       **return_vals)
{
  static GimpParam   values[1]; /* Return values */
  GimpRunMode        run_mode;  /* Current run mode */
  GimpPDBStatusType  status;    /* Return status */
  GimpDrawable      *drawable;  /* Current image */

  /*
   * Initialize parameter data...
   */

  status   = GIMP_PDB_SUCCESS;
  run_mode = param[0].data.d_int32;

  INIT_I18N ();

  *nreturn_vals = 1;
  *return_vals  = values;

  values[0].type          = GIMP_PDB_STATUS;
  values[0].data.d_status = status;

  /*
   * Get drawable information...
   */

  drawable = gimp_drawable_get (param[2].data.d_drawable);
  gimp_tile_cache_ntiles (2 * drawable->ntile_cols);


  /*
   * See how we will run
   */

  switch (run_mode)
    {
    case GIMP_RUN_INTERACTIVE:
      /*
       * Possibly retrieve data...
       */
      gimp_get_data (PLUG_IN_PROC, &sharpen_params);

      /*
       * Get information from the dialog...
       */
      if (!sharpen_dialog (drawable))
        return;
      break;

    case GIMP_RUN_NONINTERACTIVE:
      /*
       * Make sure all the arguments are present...
       */
      if (nparams != 4)
        status = GIMP_PDB_CALLING_ERROR;
      else
        sharpen_params.sharpen_percent = param[3].data.d_int32;
      break;

    case GIMP_RUN_WITH_LAST_VALS:
      /*
       * Possibly retrieve data...
       */
      gimp_get_data (PLUG_IN_PROC, &sharpen_params);
      break;

    default:
      status = GIMP_PDB_CALLING_ERROR;
      break;
    }

  /*
   * Sharpen the image...
   */

  if (status == GIMP_PDB_SUCCESS)
    {
      if ((gimp_drawable_is_rgb (drawable->drawable_id) ||
           gimp_drawable_is_gray (drawable->drawable_id)))
        {
          /*
           * Run!
           */
          sharpen (drawable);

          /*
           * If run mode is interactive, flush displays...
           */
          if (run_mode != GIMP_RUN_NONINTERACTIVE)
            gimp_displays_flush ();

          /*
           * Store data...
           */
          if (run_mode == GIMP_RUN_INTERACTIVE)
            gimp_set_data (PLUG_IN_PROC,
                           &sharpen_params, sizeof (SharpenParams));
        }
      else
        status = GIMP_PDB_EXECUTION_ERROR;
    }

  /*
   * Reset the current run status...
   */
  values[0].data.d_status = status;

  /*
   * Detach from the drawable...
   */
  gimp_drawable_detach (drawable);
}
Esempio n. 14
0
int main( int agrc, char** argv )
{
    uint8_t *raw;
    char *filename = argv[1];
    image_width = atoi( argv[2] );
    image_height = atoi( argv[3] );
    printf( "%s %d %d\n", filename, image_width, image_height );
    stride = image_width+2;
    raw = read_raw( filename );
    write_padded( "padded.raw", raw );
    uint8_t *blurred = malloc( stride*(image_height+2)*4 );

    clock_t start = clock();
    /* Box Blur applied 3 times is extremely similar to Gaussian blur */
    for ( int y = 0; y < image_height+2; y++ )
    {
        for ( int x = 0; x < stride; x++ )
        {
            average_neighbors( raw, blurred, x, y );
        }
    }
    for ( int y = 0; y < image_height+2; y++ )
    {
        for ( int x = 0; x < stride; x++ )
        {
            average_neighbors( blurred, blurred, x, y );
        }
    }
    for ( int y = 0; y < image_height+2; y++ )
    {
        for ( int x = 0; x < stride; x++ )
        {
            average_neighbors( blurred, blurred, x, y );
        }
    }
    clock_t end = clock();
    float seconds = (float)(end - start) / CLOCKS_PER_SEC;
    printf( "Regular box blur took %f seconds\n", seconds );
    write_raw( "blurred.raw", blurred );

    start = clock();
    memset( blurred, 0, stride*(image_height+2)*4 );
    /* Box Blur applied 3 times is extremely similar to Gaussian blur */
    for ( int y = 0; y < image_height+2; y++ )
    {
        for ( int x = 0; x < stride; x+=2 )
        {
            average_neighbors_simd( raw, blurred, x, y );
        }
    }
    for ( int y = 0; y < image_height+2; y++ )
    {
        for ( int x = 0; x < stride; x+=2 )
        {
            average_neighbors_simd( blurred, blurred, x, y );
        }
    }
    for ( int y = 0; y < image_height+2; y++ )
    {
        for ( int x = 0; x < stride; x+=2 )
        {
            average_neighbors_simd( blurred, blurred, x, y );
        }
    }
    end = clock();
    seconds = (float)(end - start) / CLOCKS_PER_SEC;
    printf( "SIMD blur took %f seconds\n", seconds );
    write_raw( "blurred_simd.raw", blurred );

    start = clock();
    memset( blurred, 0, stride*(image_height+2)*4 );
    for ( int y = 0; y < image_height+2; y++ )
    {
        for ( int x = 0; x < stride; x++ )
        {
            grayscale( raw, blurred, x, y );
        }
    }
    end = clock();
    seconds = (float)(end - start) / CLOCKS_PER_SEC;
    printf( "grayscale took %f seconds\n", seconds );
    write_raw( "grayscale.raw", blurred );

    start = clock();
    memset( blurred, 0, stride*(image_height+2)*4 );
    for ( int y = 0; y < image_height+2; y++ )
    {
        for ( int x = 0; x < stride; x+=8 )
        {
            grayscale_simd( raw, blurred, x, y );
        }
    }
    end = clock();
    seconds = (float)(end - start) / CLOCKS_PER_SEC;
    printf( "grayscale SIMD took %f seconds\n", seconds );
    write_raw( "grayscale_simd.raw", blurred );

    start = clock();
    memset( blurred, 0, stride*(image_height+2)*4 );
    for ( int y = 0; y < image_height+2; y++ )
    {
        for ( int x = 0; x < stride; x++ )
        {
            sharpen( raw, blurred, x, y );
        }
    }
    end = clock();
    seconds = (float)(end - start) / CLOCKS_PER_SEC;
    printf( "sharpen took %f seconds\n", seconds );
    write_raw( "sharpen.raw", blurred );

    start = clock();
    memset( blurred, 0, stride*(image_height+2)*4 );
    for ( int y = 0; y < image_height+2; y++ )
    {
        for ( int x = 0; x < stride; x++ )
        {
            sharpen_simd( raw, blurred, x, y );
        }
    }
    end = clock();
    seconds = (float)(end - start) / CLOCKS_PER_SEC;
    printf( "sharpen SIMD took %f seconds\n", seconds );
    write_raw( "sharpen_simd.raw", blurred );

    free( raw );
    free( blurred );
    return 0;
}
static void preview_alt_normal(gint32 image_ID) {
/*******************************************************************************
 * Begin H and Normal
 ******************************************************************************/    
    gint32 mergedLayer_ID = -1;
    gint32 normalmap_ID = -1;
    gfloat wsize = (gfloat)gimp_image_width(image_ID);
    gfloat hsize = (gfloat)gimp_image_width(image_ID);
    /** Get active layer. */
    gint32 drawable_temp_ID = gimp_image_get_active_layer(image_ID);
    /** Copy active layer. */
    /** LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL */
    gint32 diffuse_ID = gimp_layer_copy (drawable_temp_ID);
    /** Add new layer to image. */
    gimp_image_add_layer(image_ID, diffuse_ID, -1);
    /** Set new layer as active. */
    gimp_image_set_active_layer(image_ID, diffuse_ID);
    /** Here I should hide previous active layer, make not visible. */
    gtk_label_set_text(GTK_LABEL(progress_label), "Smoothing");

    /**
     * Since copied, don't need this here.
     * blur seems to not create an extra layer.
     */
    blur(image_ID, diffuse_ID, wsize, hsize, local_vals.LargeDetails, 0, local_vals.ao);
    gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.15);
    
    normalmap_ID = gimp_image_get_active_layer(image_ID);
    if(local_vals.smoothstep)
    {
        gtk_label_set_text(GTK_LABEL(progress_label), "Smoothing");
        /**
         * Filter "Blur" applied
         * Standard plug-in. Source code ships with GIMP.
         */
        if (plug_in_blur_connector(image_ID, normalmap_ID) != 1) return;
        gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.20);
    }
    else
    {
        gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.20);        
    }

    if(local_vals.invh)
    {
        /**
         * Colors Menu->Invert
         * Standard plug-in. Source code ships with GIMP.
         */
        if (plug_in_vinvert_connector(image_ID, normalmap_ID) != 1) return;
        gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.25);
    }
    else
    {
        gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.25);
    }
    
    /** Here is _p Displacement drawable. */
    pDrawables.drawable_p = gimp_drawable_get(normalmap_ID);
    gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.30);

    /** Extra layer here. */
    /** LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL */
    gtk_label_set_text(GTK_LABEL(progress_label), "Base Mapping");
    doBaseMap(image_ID, diffuse_ID, local_vals.Depth, local_vals.LargeDetails, local_vals.ao);
    gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.35);
    normalmap_ID = gimp_image_get_active_layer(image_ID);
    gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.40);
    
    /** Here is _ln low normal. l l l l l l l l l l l l l l l l */
    if (gcNeedNormal == 'l') {
        pDrawables.drawable_n = gimp_drawable_get(normalmap_ID);
    }

    /** Creates an extra layer. */
    /** LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL */
    shapeRecognise(image_ID, normalmap_ID, local_vals.ShapeRecog, local_vals.ao);
    if(local_vals.smoothstep)
    {
        normalmap_ID = gimp_image_get_active_layer(image_ID);

        gtk_label_set_text(GTK_LABEL(progress_label), "Smoothing");
        /**
         * Filter "Blur" applied
         * Standard plug-in. Source code ships with GIMP.
         */
        if (plug_in_blur_connector(image_ID, normalmap_ID) != 1) return;
        gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.45);
    }
    else
    {
        gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.45);
    }
    
    /** Here is _sn super normal. s s s s s s s s s s s s s s s s */
    if (gcNeedNormal == 's') {
        pDrawables.drawable_n = gimp_drawable_get(normalmap_ID);
    }
    gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.50);
    gtk_label_set_text(GTK_LABEL(progress_label), "Sharpen");

    /** Creates an extra layer. */
    /** LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL */
    sharpen(image_ID, diffuse_ID, local_vals.Depth, 0, local_vals.SmallDetails);
    gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.55);
    normalmap_ID = gimp_image_get_active_layer(image_ID);

    gtk_label_set_text(GTK_LABEL(progress_label), "Sharpen more");
    gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.65);
    
    /**
    * Filter Enhance "Sharpen" applied
    * Standard plug-in. Source code ships with GIMP.
    */
    if (plug_in_sharpen_connector(image_ID, normalmap_ID, 20) != 1) return;
    
    /** Here is _hn high normal. h h h h h h h h h h h h h h h h */
    if (gcNeedNormal == 'h') {
        pDrawables.drawable_n = gimp_drawable_get(normalmap_ID);
    }

    gtk_label_set_text(GTK_LABEL(progress_label), "Sharpen again");
    /** Creates an extra layer. */
    /** LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL */
    sharpen(image_ID, diffuse_ID, local_vals.Depth, 6, local_vals.MediumDetails);
    gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.70);
    normalmap_ID = gimp_image_get_active_layer(image_ID);
    
    gtk_label_set_text(GTK_LABEL(progress_label), "Smoothing");
    /**
     * Filter "Blur" applied
     * Standard plug-in. Source code ships with GIMP.
     */
    if (plug_in_blur_connector(image_ID, normalmap_ID) != 1) return;
    gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.75);
    
    /** Here is _mn medium normal m m m m m m m m m m m m m m m m */
    if (gcNeedNormal == 'm') {
        pDrawables.drawable_n = gimp_drawable_get(normalmap_ID);
    }
    gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress), 0.78);

    gimp_drawable_set_visible(diffuse_ID, 0);
    
    /**
     * Don't do the next line:
     * 
     * gimp_image_merge_visible_layers(image_ID, 0);
     * 
     * Do this instead for preview:
     */
    mergedLayer_ID = gimp_layer_new_from_visible(image_ID, image_ID, "temp");
    /** Add copied layer to image. */
    gimp_image_add_layer(image_ID, mergedLayer_ID, -1);
}