[Gimp-developer] GSOC-2011 - Gimp plug-ins to Gegl operations

2011-08-26 Thread Robert Sasu
Hello,

Here is the list of op's I ported (made):
1. Color rotate
2. Color to alpha
3. Convolution matrix
4. Cubism
5. Deinterlace
6. Emboss
7. Fractal-trace
8. Lens correct (with Lensfun library)
9. Lens-distortion
10. Plasma
11. Polar-coordinates
12. Red-eye-removal
13. Ripple

I also made a showcase: http://sasurobert.github.com/GSoC-2011/

It was a really amazing experience, and I will continue to port plug-ins
and/or make some tools (anything you need) after GSoC.
Thanks for everything.

Robert Sasu
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] GsoC - 2011 - Porting GIMP plugins to GEGL operations

2011-04-07 Thread Robert Sasu
After writing the code reviews I ported the emboss plug-in to gegl. Should I
upload to GIMP bugzilla ?

Thanks,
Robert Sasu
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] GsoC - 2011 - Porting GIMP plugins to GEGL operations

2011-04-07 Thread Robert Sasu
Here is my last task. I attached the emboss plug-in ported to gegl. Just
paste in the gegl/operations/common, compile and run it.
If there is something wrong please write it and I will immidiatelly correct
it.

Thank you,
Robert Sasu
#include config.h
#include glib/gi18n-lib.h

#ifdef GEGL_CHANT_PROPERTIES

gegl_chant_double (azimuth, _(Azimuth), 0.0, 360.0, 30.0,
   _(The value of azimuth))
gegl_chant_double (elevation, _(Elevation), 0.0, 180.0, 45.0,
   _(The value of elevation))
gegl_chant_int(depth, _(Depth), 1, 100, 20,
   _(Pixel depth))
gegl_chant_string (filter, _(Filter), emboss,
   _(Optional parameter to override automatic selection of emboss filert. 
 Choices are emboss, blur-map ))

#else

#define GEGL_CHANT_TYPE_AREA_FILTER

#define GEGL_CHANT_C_FILE	emboss.c
#define RADIUS 3


#include gegl-chant.h
#include math.h
#include stdio.h

static void 
emboss   (GeglBuffer  *src,
  const GeglRectangle *src_rect,
  GeglBuffer  *dst,
  const GeglRectangle *dst_rect,
	  gchar		  *text,
  gint		   floats_per_pixel, /*floats per pixel*/
	  gint		   alpha,
	  gdouble		   azimuth,
	  gdouble		   elevation,
	  gint		   depth)
{
  gfloat *src_buf;
  gfloat *dst_buf;
  gint	  x;
  gint	  y;
  gintoffset, verify;
  gint	  bytes;

  gdouble Lx   = cos (azimuth) * cos (elevation);
  gdouble Ly   = sin (azimuth) * cos (elevation);
  gdouble Lz   = sin (elevation) ;
  gdouble Nz2  = 1 / (depth * depth);
  gdouble NzLz = (1 / depth) * Lz;

  bytes = (alpha) ? floats_per_pixel - 1 : floats_per_pixel;

  src_buf = g_new0 (gfloat, src_rect-width * src_rect-height * floats_per_pixel);
  dst_buf = g_new0 (gfloat, dst_rect-width * dst_rect-height * floats_per_pixel);
  
  gegl_buffer_get (src, 1.0, src_rect, babl_format (text),
   src_buf, GEGL_AUTO_ROWSTRIDE);

  verify = src_rect-width*src_rect-height*floats_per_pixel;
  offset = 0;
  for (x = 0; x  dst_rect-height; x++)
{
for (y = 0; y  dst_rect-width; y++)
	{
	  gint	  i, j, b, count;
	  gfloat  Nx, Ny, NdotL;
  gfloat  shade;
	  gfloat  M[3][3];
  gfloat  a;

	  for (i = 0; i  3; i++)
for (j = 0; j  3; j++)
   M[i][j] = 0.0;	  
  
	  for (b = 0; b  bytes; b++)
   {
   for (i = 0; i  3; i++)
 for (j = 0; j  3; j++)
   {
		 count = ((x+i-1)*src_rect-width + (y+j-1))*floats_per_pixel + bytes;
		/*verify each time that we are in the source image*/
 if (alpha  count = 0  count  verify)
   a = src_buf[count];
 else
   a = 1.0;

		/*calculate recalculate the sorrounding pixels by multiplication*/
		/*after we have that we can calculate new value of the pixel*/
		 if ((count - bytes + b) = 0  (count - bytes + b)  verify)
M[i][j] += a * src_buf[count - bytes + b];	
		}
}
	
	   Nx = M[0][0] + M[1][0] + M[2][0] - M[0][2] - M[1][2] - M[2][2];
   Ny = M[2][0] + M[2][1] + M[2][2] - M[0][0] - M[0][1] - M[0][2];
	  

	   /*calculating the shading result (same as in gimp)*/
	   if ( Nx == 0  Ny == 0 )
  shade = Lz;
   else if ( (NdotL = Nx * Lx + Ny * Ly + NzLz)  0 )
  shade = 0;
   else
  shade = NdotL / sqrt(Nx*Nx + Ny*Ny + Nz2);

	   count = (x*src_rect-width + y)*floats_per_pixel;

  	   if (bytes == 1)
	 	dst_buf[offset++] = shade; /*setting the destination buffer*/
	   else
	  {
		for (b = 0; b  bytes; b++)
		   if ((count + b) = 0  (count + b)  verify) /*recalculating every byte of a pixel*/
  	  dst_buf[offset++] = (src_buf[count+b] * shade) ;  /*by multiplying with the shading result*/
		   else
		  dst_buf[offset++] = 1.0;

  	if (alpha  (count + bytes) = 0  (count + bytes)  verify) /*preserving alpha*/
	   dst_buf[offset++] = src_buf[count + bytes];
		else
		   dst_buf[offset++] = 1.0 ; 
  }
	}
 }
  gegl_buffer_set (dst, dst_rect, babl_format (text),
   dst_buf, GEGL_AUTO_ROWSTRIDE);
  g_free (src_buf);
  g_free (dst_buf);
}


static void prepare (GeglOperation *operation)
{
  GeglChantO  *o   = GEGL_CHANT_PROPERTIES (operation);
  GeglOperationAreaFilter *op_area = GEGL_OPERATION_AREA_FILTER (operation);
  gchar 		  *type;
  gboolean  	   filter_blurmap;

  op_area-left=op_area-right=op_area-top=op_area-bottom=3;
  
  filter_blurmap = o-filter  !strcmp(o-filter, blur-map);
  
  type = (filter_blurmap) ? RGBA float : Y float;
  
  gegl_operation_set_format (operation, output, babl_format (type));
}

static gboolean
process (GeglOperation   *operation,
 GeglBuffer  *input,
 GeglBuffer  *output,
 const GeglRectangle *result)
{
  GeglChantO  *o   = GEGL_CHANT_PROPERTIES (operation);
  GeglOperationAreaFilter *op_area

Re: [Gimp-developer] GsoC - 2011 - Porting GIMP plugins to GEGL operations

2011-04-07 Thread Robert Sasu
I've revised my code, adding comments and references. If there is anything
to correct please write it.

Thank you,
Robert Sasu
/* This file is an image processing operation for GEGL
 *
 * GEGL is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * GEGL is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with GEGL; if not, see http://www.gnu.org/licenses/.
 *
 * Algorithm 1997 Eric L. Hernes (er...@rrnet.com)
 * Copyright 2011 Robert Sasu (sasu.rob...@gmail.com)
 */


#include config.h
#include glib/gi18n-lib.h

#ifdef GEGL_CHANT_PROPERTIES

gegl_chant_double (azimuth, _(Azimuth), 0.0, 360.0, 30.0,
   _(The value of azimuth))
gegl_chant_double (elevation, _(Elevation), 0.0, 180.0, 45.0,
   _(The value of elevation))
gegl_chant_int(depth, _(Depth), 1, 100, 20,
   _(Pixel depth))
gegl_chant_string (filter, _(Filter), emboss,
   _(Optional parameter to override automatic selection of emboss filert. 
 Choices are emboss, blur-map ))

#else

#define GEGL_CHANT_TYPE_AREA_FILTER

#define GEGL_CHANT_C_FILE	emboss.c
#define RADIUS 3


#include gegl-chant.h
#include math.h
#include stdio.h


/*
 * ANSI C code from the article
 * Fast Embossing Effects on Raster Image Data
 * by John Schlag, j...@kerner.com
 * in Graphics Gems IV, Academic Press, 1994
 *
 *
 * Emboss - shade 24-bit pixels using a single distant light source.
 * Normals are obtained by differentiating a monochrome 'bump' image.
 * The unary case ('texture' == NULL) uses the shading result as output.
 * The binary case multiples the optional 'texture' image by the shade.
 * Images are in row major order with interleaved color components (rgbrgb...).
 * E.g., component c of pixel x,y of 'dst' is dst[3*(y*width + x) + c].
 *
 */


static void 
emboss   (gfloat		  *src_buf,
  const GeglRectangle *src_rect,
  gfloat		  *dst_buf,
  const GeglRectangle *dst_rect,
	  gint		   x,
	  gchar		  *text,
  gint		   floats_per_pixel,
	  gint		   alpha,
	  gdouble		   azimuth,
	  gdouble		   elevation,
	  gint		   depth)
{
  gint	  y;
  gintoffset, verify;
  gint	  bytes;

  gdouble Lx   = cos (azimuth) * cos (elevation);
  gdouble Ly   = sin (azimuth) * cos (elevation);
  gdouble Lz   = sin (elevation) ;
  gdouble Nz2  = 1 / (depth * depth);
  gdouble NzLz = (1 / depth) * Lz;

  bytes = (alpha) ? floats_per_pixel - 1 : floats_per_pixel;

  verify = src_rect-width*src_rect-height*floats_per_pixel;
  offset = x * dst_rect-width * floats_per_pixel;
  for (y = 0; y  dst_rect-width; y++)
	{
	  gint	  i, j, b, count;
	  gfloat  Nx, Ny, NdotL;
  gfloat  shade;
	  gfloat  M[3][3];
  gfloat  a;

	  for (i = 0; i  3; i++)
for (j = 0; j  3; j++)
   M[i][j] = 0.0;	  
  
	  for (b = 0; b  bytes; b++)
   {
   for (i = 0; i  3; i++)
 for (j = 0; j  3; j++)
   {
		 count = ((x+i-1)*src_rect-width + (y+j-1))*floats_per_pixel + bytes;

		/*verify each time that we are in the source image*/
 if (alpha  count = 0  count  verify)
   a = src_buf[count];
 else
   a = 1.0;

		/*calculate recalculate the sorrounding pixels by multiplication*/
		/*after we have that we can calculate new value of the pixel*/
		 if ((count - bytes + b) = 0  (count - bytes + b)  verify)
M[i][j] += a * src_buf[count - bytes + b];	
		}
}
	
	   Nx = M[0][0] + M[1][0] + M[2][0] - M[0][2] - M[1][2] - M[2][2];
   Ny = M[2][0] + M[2][1] + M[2][2] - M[0][0] - M[0][1] - M[0][2];
	  

	   /*calculating the shading result (same as in gimp)*/
	   if ( Nx == 0  Ny == 0 )
  shade = Lz;
   else if ( (NdotL = Nx * Lx + Ny * Ly + NzLz)  0 )
  shade = 0;
   else
  shade = NdotL / sqrt(Nx*Nx + Ny*Ny + Nz2);

	   count = (x*src_rect-width + y)*floats_per_pixel;

	   /*setting the value of the destination buffer*/
  	   if (bytes == 1)
	 	dst_buf[offset++] = shade; 
	   else
	  {
		/*recalculating every byte of a pixel*/
		/*by multiplying with the shading result*/

		for (b = 0; b  bytes; b++)
		   if ((count + b) = 0  (count + b)  verify) 
  	  dst_buf[offset++] = (src_buf[count+b] * shade) ;  
		   else
		  dst_buf[offset++] = 1.0;

		/*preserving alpha*/
  	if (alpha  (count + bytes) = 0  (count + bytes)  verify) 
	   dst_buf[offset++] = src_buf[count + bytes];
		else
		   dst_buf[offset

Re: [Gimp-developer] GsoC - 2011 - Porting GIMP plugins to GEGL operations

2011-04-07 Thread Robert Sasu
I've revised my code, adding comments and references. If there is anything
to correct please write it.

Thank you,
Robert Sasu
/* This file is an image processing operation for GEGL
 *
 * GEGL is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * GEGL is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with GEGL; if not, see http://www.gnu.org/licenses/.
 *
 * Algorithm 1997 Eric L. Hernes (er...@rrnet.com)
 * Copyright 2011 Robert Sasu (sasu.rob...@gmail.com)
 */


#include config.h
#include glib/gi18n-lib.h

#ifdef GEGL_CHANT_PROPERTIES

gegl_chant_double (azimuth, _(Azimuth), 0.0, 360.0, 30.0,
   _(The value of azimuth))
gegl_chant_double (elevation, _(Elevation), 0.0, 180.0, 45.0,
   _(The value of elevation))
gegl_chant_int(depth, _(Depth), 1, 100, 20,
   _(Pixel depth))
gegl_chant_string (filter, _(Filter), emboss,
   _(Optional parameter to override automatic selection of emboss filert. 
 Choices are emboss, blur-map ))

#else

#define GEGL_CHANT_TYPE_AREA_FILTER

#define GEGL_CHANT_C_FILE	emboss.c
#define RADIUS 3


#include gegl-chant.h
#include math.h
#include stdio.h


/*
 * ANSI C code from the article
 * Fast Embossing Effects on Raster Image Data
 * by John Schlag, j...@kerner.com
 * in Graphics Gems IV, Academic Press, 1994
 *
 *
 * Emboss - shade 24-bit pixels using a single distant light source.
 * Normals are obtained by differentiating a monochrome 'bump' image.
 * The unary case ('texture' == NULL) uses the shading result as output.
 * The binary case multiples the optional 'texture' image by the shade.
 * Images are in row major order with interleaved color components (rgbrgb...).
 * E.g., component c of pixel x,y of 'dst' is dst[3*(y*width + x) + c].
 *
 */


static void 
emboss   (gfloat		  *src_buf,
  const GeglRectangle *src_rect,
  gfloat		  *dst_buf,
  const GeglRectangle *dst_rect,
	  gint		   x,
	  gchar		  *text,
  gint		   floats_per_pixel,
	  gint		   alpha,
	  gdouble		   azimuth,
	  gdouble		   elevation,
	  gint		   depth)
{
  gint	  y;
  gintoffset, verify;
  gint	  bytes;

  gdouble Lx   = cos (azimuth) * cos (elevation);
  gdouble Ly   = sin (azimuth) * cos (elevation);
  gdouble Lz   = sin (elevation) ;
  gdouble Nz2  = 1 / (depth * depth);
  gdouble NzLz = (1 / depth) * Lz;

  bytes = (alpha) ? floats_per_pixel - 1 : floats_per_pixel;

  verify = src_rect-width*src_rect-height*floats_per_pixel;
  offset = x * dst_rect-width * floats_per_pixel;
  for (y = 0; y  dst_rect-width; y++)
	{
	  gint	  i, j, b, count;
	  gfloat  Nx, Ny, NdotL;
  gfloat  shade;
	  gfloat  M[3][3];
  gfloat  a;

	  for (i = 0; i  3; i++)
for (j = 0; j  3; j++)
   M[i][j] = 0.0;	  
  
	  for (b = 0; b  bytes; b++)
   {
   for (i = 0; i  3; i++)
 for (j = 0; j  3; j++)
   {
		 count = ((x+i-1)*src_rect-width + (y+j-1))*floats_per_pixel + bytes;

		/*verify each time that we are in the source image*/
 if (alpha  count = 0  count  verify)
   a = src_buf[count];
 else
   a = 1.0;

		/*calculate recalculate the sorrounding pixels by multiplication*/
		/*after we have that we can calculate new value of the pixel*/
		 if ((count - bytes + b) = 0  (count - bytes + b)  verify)
M[i][j] += a * src_buf[count - bytes + b];	
		}
}
	
	   Nx = M[0][0] + M[1][0] + M[2][0] - M[0][2] - M[1][2] - M[2][2];
   Ny = M[2][0] + M[2][1] + M[2][2] - M[0][0] - M[0][1] - M[0][2];
	  

	   /*calculating the shading result (same as in gimp)*/
	   if ( Nx == 0  Ny == 0 )
  shade = Lz;
   else if ( (NdotL = Nx * Lx + Ny * Ly + NzLz)  0 )
  shade = 0;
   else
  shade = NdotL / sqrt(Nx*Nx + Ny*Ny + Nz2);

	   count = (x*src_rect-width + y)*floats_per_pixel;

	   /*setting the value of the destination buffer*/
  	   if (bytes == 1)
	 	dst_buf[offset++] = shade; 
	   else
	  {
		/*recalculating every byte of a pixel*/
		/*by multiplying with the shading result*/

		for (b = 0; b  bytes; b++)
		   if ((count + b) = 0  (count + b)  verify) 
  	  dst_buf[offset++] = (src_buf[count+b] * shade) ;  
		   else
		  dst_buf[offset++] = 1.0;

		/*preserving alpha*/
  	if (alpha  (count + bytes) = 0  (count + bytes)  verify) 
	   dst_buf[offset++] = src_buf[count + bytes];
		else
		   dst_buf[offset

Re: [Gimp-developer] GsoC - 2011 - Porting GIMP plugins to GEGL operations

2011-04-07 Thread Robert Sasu
I removed the tabs and rewrite the code again. If there is anything to do,
please let me know.

Thank you,
Robert Sasu
/* This file is an image processing operation for GEGL
 *
 * GEGL is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * GEGL is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with GEGL; if not, see http://www.gnu.org/licenses/.
 *
 * Algorithm 1997 Eric L. Hernes (er...@rrnet.com)
 * Copyright 2011 Robert Sasu (sasu.rob...@gmail.com)
 */


#include config.h
#include glib/gi18n-lib.h

#ifdef GEGL_CHANT_PROPERTIES

gegl_chant_double (azimuth, _(Azimuth), 0.0, 360.0, 30.0,
   _(The value of azimuth))
gegl_chant_double (elevation, _(Elevation), 0.0, 180.0, 45.0,
   _(The value of elevation))
gegl_chant_int(depth, _(Depth), 1, 100, 20,
   _(Pixel depth))
gegl_chant_string (filter, _(Filter), emboss,
   _(Optional parameter to override automatic selection of emboss filert. 
 Choices are emboss, blur-map ))

#else

#define GEGL_CHANT_TYPE_AREA_FILTER

#define GEGL_CHANT_C_FILEemboss.c
#define RADIUS 3


#include gegl-chant.h
#include math.h
#include stdio.h


/*
 * ANSI C code from the article
 * Fast Embossing Effects on Raster Image Data
 * by John Schlag, j...@kerner.com
 * in Graphics Gems IV, Academic Press, 1994
 *
 *
 * Emboss - shade 24-bit pixels using a single distant light source.
 * Normals are obtained by differentiating a monochrome 'bump' image.
 * The unary case ('texture' == NULL) uses the shading result as output.
 * The binary case multiples the optional 'texture' image by the shade.
 * Images are in row major order with interleaved color components (rgbrgb...).
 * E.g., component c of pixel x,y of 'dst' is dst[3*(y*width + x) + c].
 *
 */


static void 
emboss   (gfloat  *src_buf,
  const GeglRectangle *src_rect,
  gfloat  *dst_buf,
  const GeglRectangle *dst_rect,
  gint x,
  gchar   *text,
  gint floats_per_pixel,
  gint alpha,
  gdouble  azimuth,
  gdouble  elevation,
  gint depth)
{
  gint  y;
  gint  offset, verify;
  gint  bytes;

  gdouble Lx   = cos (azimuth) * cos (elevation);
  gdouble Ly   = sin (azimuth) * cos (elevation);
  gdouble Lz   = sin (elevation) ;
  gdouble Nz2  = 1 / (depth * depth);
  gdouble NzLz = (1 / depth) * Lz;

  bytes = (alpha) ? floats_per_pixel - 1 : floats_per_pixel;

  verify = src_rect-width*src_rect-height*floats_per_pixel;
  offset = x * dst_rect-width * floats_per_pixel;
  for (y = 0; y  dst_rect-width; y++)
{
ginti, j, b, count;
gfloat  Nx, Ny, NdotL;
gfloat  shade;
gfloat  M[3][3];
gfloat  a;

for (i = 0; i  3; i++)
   for (j = 0; j  3; j++)
  M[i][j] = 0.0;  
  
for (b = 0; b  bytes; b++)
  {
  for (i = 0; i  3; i++)
for (j = 0; j  3; j++)
  {
  count = ((x+i-1)*src_rect-width + (y+j-1))*floats_per_pixel + bytes;

  /*verify each time that we are in the source image*/
  if (alpha  count = 0  count  verify)
  a = src_buf[count];
  else
  a = 1.0;

 /*calculate recalculate the sorrounding pixels by multiplication*/
 /*after we have that we can calculate new value of the pixel*/
 if ((count - bytes + b) = 0  (count - bytes + b)  verify)
  M[i][j] += a * src_buf[count - bytes + b];
  }
  }

Nx = M[0][0] + M[1][0] + M[2][0] - M[0][2] - M[1][2] - M[2][2];
Ny = M[2][0] + M[2][1] + M[2][2] - M[0][0] - M[0][1] - M[0][2];
  

/*calculating the shading result (same as in gimp)*/
if ( Nx == 0  Ny == 0 )
shade = Lz;
else if ( (NdotL = Nx * Lx + Ny * Ly + NzLz)  0 )
  shade = 0;
else
shade = NdotL / sqrt(Nx*Nx + Ny*Ny + Nz2);

count = (x*src_rect-width + y)*floats_per_pixel;

/*setting the value of the destination buffer*/
if (bytes == 1)
dst_buf[offset++] = shade; 
else
{
/*recalculating every byte of a pixel*/
/*by multiplying with the shading result*/

for (b = 0; b  bytes; b++)
if ((count + b) = 0  (count + b)  verify) 
 dst_buf[offset++] = (src_buf[count+b] * shade) ;  
else
 dst_buf[offset++] = 1.0;

/*preserving alpha*/
if (alpha  (count + bytes) = 0

Re: [Gimp-developer] GsoC - 2011 - Porting GIMP plugins to GEGL operations

2011-03-31 Thread Robert Sasu
 of the horizontal direction.
After calculating the black and white percentage values (ramp down and ramp
up). Relative difference is equal with the average pixel intensity of the
blur radius image per the average pixel intersity of the maske radius image.
While calculating the intensity of each pixel it also calculates the
lightness of the drawable image between 0 and 255.
   intensity multiply = 1
   if relative diff  Threshold
if ramp_down == 0 intensity multiply = 0
else intensity mult = (ramp_down - MIN (ramp_down, (Threshold -
relative
difference))) / ramp_down
   else if ramp_down !=0 mult = MIN (ramp_up,(relative difference -
Threshold)) / ramp_up;
Knowing the lightness calculates the value of each pixel and draws the
image.

compute ramp and find constants functions are the same as in the cartoon
plug-in.



Compute ramp and find constants could be directly written in gegl api as
not to write the same thing twice. For recalculating the pixels by adding
lightness we could use a lightness plug-in for it.

I have an exam saturday, so I will finish and send the plug-in ported to
gegl on sunday.
If there is anything else I should do please write it. If there is
something wrong with the code reviews tell it and I will rewrite it.

Thanks,
Robert Sasu
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


[Gimp-developer] GsoC - 2011 - Porting GIMP plugins to GEGL operations

2011-03-30 Thread Robert Sasu
 in further depths.
do_plasma: Calculates the mid-point of the rectangle and in case of depht=-1
(first case) randoms the color values for the corners and the middle of the
image.
If depth is 0 (in case the rectangle has less then 4 pixels) for every case
we get the pixel values from the current image, average it and adds a new
random value for each alpha.
Else it calls the function recursively for the 4 divided rectangles.

This can also be written using for example a perlin noise function and
calculating for each component of c sin(f(x,y)*frequency(c)).

Code review and algorithm descrition(GEGL op):


1. Gaussian-blur:
Algorithm: After calculating the Gaussian matrix with the known function for
a certain radius, we ortonormalize it by dividen each element with the sum
of all elements. Then apply this to the image and calculating the value of
each pixel with weighted median.
Using Gaussian linearly separable property we can divide the process into 2
passes. First a vector is used to blur the image in horizontal or vertical
direction, then another vector is used to blur the image for the remaining
direction.
Area Filter base class is used because the color value of every pixel is
calculated with the help of the surrounding pixels (from the pixels of a
certain area).

 fir_gen_convolve_matrix calculates the Gaussian matrix for a certain
radius, and depending on the offset (x or y) fir_ver_blur or fir_hor_blur
calculates the value of each color byte for each color with weighted median.
iir_young_hor_blur (or ver) calculates the values of each new pixel by
calculating for each row (column) its new values. The colour vector blur
stores the calculated color values off the pixels, calculated by weighted
media (vector b is the weight of a color, buf stores the original color of
the pixel).


If there is some problem with code review or anything else please write it
and I will correct it.

Thanks,
Robert Sasu
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] GsoC - 2011 - Porting GIMP plugins to GEGL operations

2011-03-30 Thread Robert Sasu
 in further depths.
do_plasma: Calculates the mid-point of the rectangle and in case of depht=-1
(first case) randoms the color values for the corners and the middle of the
image.
If depth is 0 (in case the rectangle has less then 4 pixels) for every case
we get the pixel values from the current image, average it and adds a new
random value for each alpha.
Else it calls the function recursively for the 4 divided rectangles.

This can also be written using for example a perlin noise function and
calculating for each component of c sin(f(x,y)*frequency(c)).

Code review and algorithm descrition(GEGL op):


1. Gaussian-blur:
Algorithm: After calculating the Gaussian matrix with the known function for
a certain radius, we ortonormalize it by dividen each element with the sum
of all elements. Then apply this to the image and calculating the value of
each pixel with weighted median.
Using Gaussian linearly separable property we can divide the process into 2
passes. First a vector is used to blur the image in horizontal or vertical
direction, then another vector is used to blur the image for the remaining
direction.
Area Filter base class is used because the color value of every pixel is
calculated with the help of the surrounding pixels (from the pixels of a
certain area).

 fir_gen_convolve_matrix calculates the Gaussian matrix for a certain
radius, and depending on the offset (x or y) fir_ver_blur or fir_hor_blur
calculates the value of each color byte for each color with weighted median.
iir_young_hor_blur (or ver) calculates the values of each new pixel by
calculating for each row (column) its new values. The colour vector blur
stores the calculated color values off the pixels, calculated by weighted
media (vector b is the weight of a color, buf stores the original color of
the pixel).


If there is some problem with code review or anything else please write it
and I will correct it.

Thanks,
Robert Sasu
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


[Gimp-developer] GSoc 2011 - Adaptive Image Cloning

2011-03-22 Thread Robert Sasu
Hello,

My name is Robert Sasu and I study Computer Science at Polytechnic
University of Bucharest, Romania.
I would like to participate to GSoC 2011 and I found the Adaptive Image
cloning project interesting. I have strong background in C/C++ and C#
programming,
algorithms and I have also done some projects with image filtering. I really
like
mathematics:I recently participated to SEEMOUS(seemous.eu) and I earned a
silver medal.
I compiled Gimp from Git and looked over the coding style and the algorithms
used
by gimp. I've read about the mean value interpolation, starting from the
mvclone
pdf and then searching in google for more explanation.
I would like to now how important is this project for you and what your
requirements
and expectations from the students applying? Do you want to implement
the mean value interpolation algorithm or you want to finish the Laplacian
method
used by gimp?
I think in the implementation of one of this algorithm we should use the
selection
tools from gimp and for the healing certain brush elements. If it is
possible we could
also implement Matlab(Octave) code for increasing the performance of
calculating
pixel values.
   It would be also possible to add another aspect by letting the user
choose a border within
he/she wants the inserting(the interpolation). It would be easy to implement
MVC matting
to help the user and then giving him the chace to put the selected part of
one image in the
other.

Thank you,
Robert Sasu
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


[Gimp-developer] GsoC - 2011 - Porting GIMP plugins to GEGL operations

2011-03-22 Thread Robert Sasu
Hello,

I am Robert Sasu and I wrote an e-mail in the morning about the application
for the Adaptive Image Cloning. Since then I've spoken with mentors on IRC,
and they said that this project is no more available. I was also recommended
to look at Porting GIMP plugins to GEGL.
As I wrote in my last e-mail I have strong C/C++ and algorithms background
and I have done some image processing/filtering projects.
I've also compiled GIMP from GIT with all the libraries and dependencies. I
also looked over the coding style and started to familiarize with the code
in GEGL and GIMP.
I propose simply to rewrite GIMP plugins in gegl operations as there are
many predefined functions, and the implementation is not so hard.
How important do you find this project, compared with others for this years
GSoC?
I would like to know which are the plugins I should start to look at and
port to GEGL. I would also ask for some specific information about this
project. How did you imagine the porting: by rewriting the entire code for
every plugins doing some adaptation to the logic?

Thank you,
Robert Sasu
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


[Gimp-developer] GsoC - 2011 - Porting GIMP plugins to GEGL operations

2011-03-22 Thread Robert Sasu
I've read the e-mails about this project from the mailing list and I found
actually what I have to do. I also looked at the source code and the
differences between gimp and gegl implementation. If it is possible I would
like a short list of plugins to look at, which are needed to be implemented
?
And again: how important do you find this project compared to others for
this years GSoC?

Thank you,
Robert Sasu
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer