[gegl] workshop: expose some of the parameters for constructing concentric ring feature vector
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] workshop: expose some of the parameters for constructing concentric ring feature vector
- Date: Fri, 28 Jun 2019 23:26:22 +0000 (UTC)
commit 7e47cd222da241842b4a85d18d44c4def0871fa7
Author: Øyvind Kolås <pippin gimp org>
Date: Sat Jun 29 01:26:02 2019 +0200
workshop: expose some of the parameters for constructing concentric ring feature vector
operations/workshop/inpaint.c | 19 +++++++++++++++----
operations/workshop/pixel-duster.h | 23 +++++++++++++++--------
2 files changed, 30 insertions(+), 12 deletions(-)
---
diff --git a/operations/workshop/inpaint.c b/operations/workshop/inpaint.c
index 719e1d86b..dd585850d 100644
--- a/operations/workshop/inpaint.c
+++ b/operations/workshop/inpaint.c
@@ -26,7 +26,7 @@
#ifdef GEGL_PROPERTIES
-property_int (seek_distance, "seek radius", 32)
+property_int (seek_distance, "seek radius", 30)
value_range (4, 512)
property_int (min_neigh, "min neigh", 4)
@@ -41,6 +41,14 @@ property_int (improvement_iters, "improvement iters", 1)
property_double (chance_try, "try chance", 0.8)
value_range (0.0, 1.0)
+property_double (ring_gap, "ring gap", 1.2)
+ value_range (0.0, 4.0)
+property_double (ring_gamma, "ring gamma", 1.0)
+ value_range (0.0, 4.0)
+property_double (ring_twist, "ring twist", 0.1)
+ value_range (0.0, 1.0)
+
+
property_double (chance_retry, "retry chance", 1)
value_range (0.0, 1.0)
@@ -87,14 +95,17 @@ process (GeglOperation *operation,
GeglRectangle out_rect = *gegl_buffer_get_extent (output);
PixelDuster *duster = pixel_duster_new (input, input, output, &in_rect, &out_rect,
o->seek_distance,
- 1,
+ 1, // max_k
o->min_neigh,
o->min_iter,
o->chance_try,
o->chance_retry,
- 1.0,
- 1.0,
+ 1.0, // scale_x
+ 1.0, // scale_y
o->improvement_iters,
+ o->ring_gap,
+ o->ring_gamma,
+ o->ring_twist,
operation);
gegl_buffer_copy (input, NULL, GEGL_ABYSS_NONE, output, NULL);
pixel_duster_add_probes_for_transparent (duster);
diff --git a/operations/workshop/pixel-duster.h b/operations/workshop/pixel-duster.h
index 886fef60d..61cbbb5cb 100644
--- a/operations/workshop/pixel-duster.h
+++ b/operations/workshop/pixel-duster.h
@@ -60,6 +60,10 @@ typedef struct
float scale_x;
float scale_y;
+ float ring_gap;
+ float ring_gamma;
+ float ring_twist;
+
GHashTable *ht[1];
GHashTable *probes_ht;
@@ -75,13 +79,10 @@ typedef struct
#define MAX_K 4
-#define RINGS 4
-#define RAYS 6
+#define RINGS 4 // increments works up to 7-8 with no adver
+#define RAYS 12 // good values for testing 6 8 10 12 16
#define NEIGHBORHOOD (RINGS*RAYS+1)
-#define GAP 1.2
-#define RINGGAMMA 1.1
-#define TWIST 0.0
typedef struct Probe {
int target_x;
@@ -126,9 +127,9 @@ static void init_order(PixelDuster *duster)
for (int circleno = 0; circleno < RINGS; circleno++)
for (float angleno = 0; angleno < RAYS; angleno++)
{
- float mag = pow(GAP * (circleno + 1), RINGGAMMA);
- float x = cosf ((angleno / RAYS + TWIST*circleno) * M_PI * 2) * mag;
- float y = sinf ((angleno / RAYS + TWIST*circleno) * M_PI * 2) * mag;
+ float mag = pow(duster->ring_gap * (circleno + 1), duster->ring_gamma);
+ float x = cosf ((angleno / RAYS + duster->ring_twist*circleno) * M_PI * 2) * mag;
+ float y = sinf ((angleno / RAYS + duster->ring_twist*circleno) * M_PI * 2) * mag;
duster->order[i][0] = x;
duster->order[i][1] = y;
duster->order[i][2] = powf (1.0 / (POW2(x)+POW2(y)), 1.0);
@@ -171,6 +172,9 @@ static PixelDuster * pixel_duster_new (GeglBuffer *reference,
float scale_x,
float scale_y,
int improvement_iterations,
+ float ring_gap,
+ float ring_gamma,
+ float ring_twist,
GeglOperation *op)
{
PixelDuster *ret = g_malloc0 (sizeof (PixelDuster));
@@ -188,6 +192,9 @@ static PixelDuster * pixel_duster_new (GeglBuffer *reference,
ret->min_x = 10000;
ret->min_y = 10000;
ret->max_age = improvement_iterations;
+ ret->ring_gap = ring_gap;
+ ret->ring_gamma = ring_gamma;
+ ret->ring_twist = ring_twist;
if (max_k < 1) max_k = 1;
if (max_k > MAX_K) max_k = MAX_K;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]