[Gimp-developer] Gsoc application for gegl porting



Hello,
My name is Jakub Ozga. Iam 3rd year student on Gdansk University of Technology in Poland. I study computer science. I like to apply for Gegl porting project. I have already worked on 2 projects wich involved computer vision techniques supported by opencv library. Feel free to look at project site: http://sart2.eti.pg.gda.pl/en/index.php?language=en. I suggest to look at project and stuff sections.
 
Code Review and Algorithmic Description of GIMP Plug-ins
 
Each Gimp plugin have functions:
a)run
Prepares parameters for mainfunction. Here dialog and mainfunction are called.
b)query
Creates array with type, name and description for each parameter. Then Installs procedure in procedure database,
with given array.
c)mainfunction
Here everything is done.
d)dialog
Creates window to set preferences for mainfunction.
e)optional preview
Function that is optional depends on plugin. Shows preview image.

#cubism
2. Get background color.
3. Fill image with background color.
4. Calculate number of tiles on Image.
5. Create array with length equals number of tiles. Put index value to each element.
Randomize array by random picking 2 elemnts and swaping them.
6. Run loop with stop at value of tile number. In Loop use above array, randomize functions, tile size
and saturation to calculate position for points, rotation angle and translation vector.
7. Create polygon within 4 calculated points. Rotate it by calculated angle. Translate polygon by vector.
8. Modify x and y values with CLAMP if needed.
9. Get color from modified(or not) x and y position from original Image.
#fill_poly_color(run with x,y above and retrived color)
10. Pick first two points from Polygon. Calculate distance between them and get x, y vectors(normalized) for them.
11. Find maximum x,y and minimum x,y withing all points of Polygon. Get maximum width and height of Polygon.
12. Do scanline pattern for Polygon by height(rows).
13. Convert segments depending on min and max values of scanlines and cordinates of first Polygon point.
14. Calculate the color for each pixel of Polygon depending on scanlines and  other various calculations.


#sinus
1. Create parameters:
a) Set blending which depends on colorization.
b) Create 3 objects, each contains random values like int, double and angle.
c) Do tiling to those 3 objects. Then move them to parameters.
d) Get 2 colors which were perviously defined. Modify those colors and do color2 - color1 with substracting rgba values.
e) Multiply color2 and set color2 to parameters.
2. Get starting point and ending point of rectangle which represent the user selection.
3. Depending on bits per pixel retrived from original image run computing block for each destination region.
4. Assign color to each pixel for region using parameters, sinus and blending power.


#decompose
1. Get the type of image(RGB,HUE...). Types are defined at the top of the source.
2. Check if source image contains atleast 3 bits per pixel and if source image have alpha channel.
3. Define number of new gray images. This number equals specified number which is defined for each image type. Note that
this number cannot exceed maximum number of layers generated by extraction( #define MAX_EXTRACT_IMAGES)
5. Creating images in loop. Image creation includes creating new image with type(BaseType = GIMP_GRAY), filename, resolution and layer.
6. For each soruce pixel region extract channel information and modify channels.
7. Update each Layer(Emit signal) and add alpha channel to each Layer.
8. return number of new images created.

#gaussian-blur
1. Run iir or rle blur functions which depends on configuration and depends also on the blur radius (bug).
Each method uses 2 steps to achieve results: Divide process on 2 passes: vertical and horizontal.
@IIR
2. Calculate vertical standard deviation.
3. Find Gaussian constants using standard deviation.
4. If image has alfa(ex. rgb, gray) then transform alpha channel.
5. Set up 2 initial arrays for color.
6. Do the gaussian calculations using source image, above arrays and constants.
7. If image has alfa then convert alfa channel from premultiplied to separate one.
8. Do steps 2-7 with diffrent orientation.
@RLE
2. Calculate vertical standard deviation.
3. Fill gauss curve using standard deviation.
4. Do the same steps as iire except step 6 which here its diffrent:
-If a lot of pixels are repeated then run fastest algorithm for this case
else run slower one but easier to understand.
 
Sample implementation

diff --git a/examples/hi.c b/examples/hi.c
index e69de29..e26d04a 100644
--- a/examples/hi.c
+++ b/examples/hi.c
@@ -0,0 +1,37 @@
+#include <gegl.h>
+#include <glib/gprintf.h>
+
+gint main (gint argc, gchar **argv)
+{
+   g_thread_init (NULL);
+   gegl_init (&argc, &argv); 
+  
+   if(argc!=2){
+       g_print("Please provide filename with png format!\n");
+       return -1;
+   }
+   GeglNode *gegl = gegl_node_new ();
+   GeglNode *over       = gegl_node_new_child (gegl, "operation", "gegl:over", NULL);
+   GeglNode *load       = gegl_node_new_child (gegl, "operation", "gegl:png-load", "path", argv[1],   NULL);
+   GeglNode *text       = gegl_node_new_child (gegl, "operation", "gegl:text", "size", 10.0, "color", gegl_color_new ("rgb(1.0,1.0,1.0)"), NULL);
+   GeglNode *display    = gegl_node_create_child (gegl, "gegl:display");
+   GeglRectangle rect   = gegl_node_get_bounding_box(load);
+   GeglBuffer* buffer   = gegl_buffer_new(&rect,babl_format ("RGBA float"));   

+   gegl_buffer_save(buffer, "newBuffer", &rect);
+   gegl_node_link_many (load, over, display, NULL);
+   gegl_node_connect_to (text, "output",  over, "aux");
+
+   int i=0;
+   for(;i<100;i++){
+       gchar string[512];
+       g_sprintf (string, "%d",i);
+       gegl_node_set (text, "string", string, NULL);
+       gegl_node_process (display);
+   }
+
+   g_object_unref (gegl);
+   gegl_exit ();
+
+   return 0;
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]