It is currently Sat Jul 06, 2024 2:36 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 58 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Re: Gluas
PostPosted: Mon May 30, 2011 11:44 am  (#11) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12531
It's just an un-written rule that if someone share's their photo for play purposes, that that said person owns all rights to and results create from said photo and you need permission from that person to share results on other forums. Anyway, decided to use a photo from the free photo index to show why I like Kuwahara. Used G'MIC Paint, Kuwahara twice and added some texture for the most part. :)

ref: http://www.fontplay.com/freephotos/seve ... 107-03.jpg


Attachments:
fp021107-03.jpg
fp021107-03.jpg [ 733.13 KiB | Viewed 2492 times ]

_________________
Lyle

Psalm 109:8

Image
Top
 Post subject: Re: Gluas
PostPosted: Mon May 30, 2011 12:29 pm  (#12) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
LYLE - thanks - for another interesting link.
Already difficult to count - how many times you've found interesting things ?
For the convenience of others in the annex (GLUAS SCRIPTS.ZIP) selected scripts to Gluas
(http://www.thebest3d.com/dogwaffle/lua/samples.html:
. . for your enjoyment. Grab'em and experiment, play with different parameters, etc....).
It's strange, but some work only with version 0.1.19


Attachments:
Gluas.png
Gluas.png [ 76.84 KiB | Viewed 2494 times ]
GLUAS SCRIPTS.ZIP [14.49 KiB]
Downloaded 139 times

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: Gluas
PostPosted: Mon May 30, 2011 1:36 pm  (#13) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
None of the dogwaffle or GUI server scripts worked in gimp-gluas. At least not on my machine (Ubuntu).

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Gluas
PostPosted: Mon May 30, 2011 1:44 pm  (#14) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12531
One of the best downsizers (not uprezzing) that I've run across is Decimator (bet someone can get somebody with G'MIC programming capability to do this one right). You have to crop and sharpen afterwards, but still, I'm pretty impressed witht the quality of this. Anyway, you are right Mahvin. Looks like any script that calls a dog(or something) subroutine will not work. A few do though. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: Gluas
PostPosted: Mon May 30, 2011 2:30 pm  (#15) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
I only found one, that did work. Contrast sharpen. It had no references in the code to GUI or dogwaffle, though. Please share any that do work for you. I might be missing them inadvertently.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Gluas
PostPosted: Mon May 30, 2011 2:36 pm  (#16) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12531
Can't remember which ones I got to work from dog-lua Mahvin, but I want to say sharpen by luminosity was one of them. Anyway, I attached a screenshot of all the ones that I have thus far that work (that I tested anyway). :)


Attachments:
gluas_scripts.png
gluas_scripts.png [ 60.62 KiB | Viewed 2478 times ]

_________________
Lyle

Psalm 109:8

Image
Top
 Post subject: Re: Gluas
PostPosted: Mon May 30, 2011 2:44 pm  (#17) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
For Windows (XP 32-bit) with Gluas 0.1.19 [http://www.geocities.jp/gimproject/plug-ins/gluas.html] - all (of GLUAS SCRIPTS.ZIP) work well

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Gluas
PostPosted: Mon May 30, 2011 3:15 pm  (#18) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12531
I didn't realize how to get the version of Gluas til I saw your post MareroQ; since samj's is 0.1.20, decided to try it and for a few of the presets I tested, it still works fine. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: Gluas
PostPosted: Mon May 30, 2011 3:25 pm  (#19) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
My list is the same as yours, minus jitter.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Gluas
PostPosted: Mon May 30, 2011 9:52 pm  (#20) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
MareroQ:

Could you provide copies of your Windows version gluas, so I can test them with Ubuntu?

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Gluas
PostPosted: Mon May 30, 2011 10:41 pm  (#21) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
Maybe for Ubuntu, well worth a try version 0.1.19 ?
http://pippin.gimp.org/plug-ins/gluas/files/

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Gluas
PostPosted: Mon May 30, 2011 10:47 pm  (#22) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
I have those. I noticed the Japanese site had a couple that gimp-gluas doesn't have.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Gluas
PostPosted: Tue May 31, 2011 4:03 am  (#23) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Night Vision :)

Image

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Gluas
PostPosted: Tue May 31, 2011 4:09 am  (#24) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Here is the Kuwahara filter with curves after ward set to a cone line.
Pretty cool grunge effect Lyle. :)

Image

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Gluas
PostPosted: Tue May 31, 2011 5:57 am  (#25) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
Fix the dogwaflle scripts should not be hard , replace the "dog" calls with a equivalent "gimp" call should fix, but i wonder if is worth the effort

may be more interesting port script as Kuwahara to gmic or mathmap (the language seems a bit more similar to MM ) that for sure may support it.

just in case somebody interested here the code


Kuwahara filter
-- origine : http://pippin.gimp.org/image_processing/chap_area.html#example_kuwahara


-- Kuwahara filter
--
--
-- Performs the Kuwahara Filter. This filter is an edge-preserving filter.
--
--
-- ( a  a  ab   b  b)
-- ( a  a  ab   b  b)
-- (ac ac abcd bd bd)
-- ( c  c  cd   d  d)
-- ( c  c  cd   d  d)
--
-- In each of the four regions (a, b, c, d), the mean brightness and the variance are calculated. The
-- output value of the center pixel (abcd) in the window is the mean value of that region that has the
-- smallest variance.
--
-- description copied from http://www.incx.nec.co.jp/imap-vision/library/wouter/kuwahara.html
--
-- implemented by Øyvind Kolås <oeyvindk@hig.no> 2004


-- the sampling window is:  width=size*2+1  height=size*2+1

size = 4

edge_duplicate = 1;

-- local function to get the mean value, and
-- variance from the rectangular area specified
function mean_and_variance (x0,y0,x1,y1)
local variance
local mean

local min         = 1.0
local max         = 0.0
local accumulated = 0
local count       = 0
   
local x, y

for y=y0,y1 do
   for x=x0,x1 do
     local v = get_value(x,y)

     accumulated   = accumulated + v
     count         = count + 1
     
     if v<min then min = v end
     if v>max then max = v end

    end
  end

  variance = max-min
  mean     = accumulated /count
   
  return mean, variance
end

-- local function to get the mean value, and
-- variance from the rectangular area specified
function rgb_mean_and_variance (x0,y0,x1,y1)
local variance
local mean
local r_mean
local g_mean
local b_mean

local min           = 1.0
local max           = 0.0
local accumulated_r = 0
local accumulated_g = 0
local accumulated_b = 0
local count         = 0
   
local x, y

for y=y0,y1 do
   for x=x0,x1 do
     local v     = get_value(x,y)
     local r,g,b = get_rgb (x,y)

     accumulated_r   = accumulated_r + r
     accumulated_g   = accumulated_g + g
     accumulated_b   = accumulated_b + b
     count         = count + 1
     
     if v<min then min = v end
     if v>max then max = v end

    end
  end

  variance = max-min
  mean_r   = accumulated_r /count
  mean_g   = accumulated_g /count
  mean_b   = accumulated_b /count
   
  return mean_r, mean_g, mean_b, variance
end

-- return the kuwahara computed value
function kuwahara(x, y, size)
  local best_mean     = 1.0
  local best_variance = 1.0

  local mean, variance
   
  mean, variance = mean_and_variance (x-size, y-size, x, y)   

  if variance < best_variance then
    best_mean     = mean
    best_variance = variance
  end
   
  mean, variance = mean_and_variance (x, y-size, x+size,y)

  if variance < best_variance then
    best_mean     = mean
    best_variance = variance
  end   
   
  mean, variance = mean_and_variance (x, y, x+size, y+size)

  if variance < best_variance then
    best_mean     = mean
    best_variance = variance
  end   
   
  mean, variance = mean_and_variance (x-size, y, x,y+size)

  if variance < best_variance then
    best_mean     = mean
    best_variance = variance
  end   

  return best_mean
end


-- return the kuwahara computed value
function rgb_kuwahara(x, y, size)
  local best_r, best_g, best_b
  local best_variance = 1.0

  local r,g,b, variance
   
  r,g,b, variance = rgb_mean_and_variance (x-size, y-size, x, y)   

  if variance < best_variance then
    best_r, best_g, best_b = r, g, b
   
    best_variance = variance
  end
   
  r,g,b, variance = rgb_mean_and_variance (x, y-size, x+size,y)

  if variance < best_variance then
    best_r, best_g, best_b = r, g, b
    best_variance = variance
  end   
   
  r,g,b, variance = rgb_mean_and_variance (x, y, x+size, y+size)

  if variance < best_variance then
    best_r, best_g, best_b = r, g, b
    best_variance = variance
  end   
   
  r,g,b, variance = rgb_mean_and_variance (x-size, y, x,y+size)

  if variance < best_variance then
    best_r, best_g, best_b = r, g, b
    best_variance = variance
  end   

  return best_r, best_g, best_b
end

function kuwahara(radius)
  for y=0, height-1 do
    for x=0, width-1 do
      r,g,b = rgb_kuwahara (x,y, radius)
      set_rgb (x,y, r,g,b)
    end
    progress (y/height)
  end
end

kuwahara(2)

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: Gluas
PostPosted: Tue May 31, 2011 6:05 am  (#26) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
Is there any code visible for the Kuwahara effect ? I think this could be done in G'MIC ;)


Top
 Post subject: Re: Gluas
PostPosted: Tue May 31, 2011 6:06 am  (#27) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4050
It's hiding behind PC's spoiler

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: Gluas
PostPosted: Tue May 31, 2011 6:08 am  (#28) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
David maybe the original C script (well look as C to me , but i may be wrong) is easier to port.
The Lua filter was derieved by this


here #include <stddef.h>
#include <imapio.h>
#include <stdimap.h>

/*-----------------------------------------------------------------
Kuwahara Filter

12/01/99
filename: kuwahara.lc
author : W.J.Bokhove
----------------------------------------------------------------*/

/*
M_DOCDEF kuwahara

NAME kuwahara

SYNOPSIS
void kuwahara(src, dst, lines)
sep uchar src[]; /* source image */ /*
sep uchar dst[]; /* destination image */ /*
uint lines; /* number of lines to work on */ /*

MEMORY CONSUMPTION
This function consumes about 22 lines of IMAP memory

DESCRIPTION
Performs the Kuwahara Filter. This filter is an edge-preserving filter.
( a a ab b b)
( a a ab b b)
(ac ac abcd bd bd)
( c c cd d d)
( c c cd d d)
In each of the four regions (a, b, c, d), the mean brightness and the
variance are calculated. The output value of the center pixel (abcd) in
the window is the mean value of that region that has the smallest variance.

M_DOCEND
*/


void kuwahara(sep uchar src[], sep uchar dst[], uint lines)
{
#define square(a) (a*a)
int i;
sep ulong dif;
sep uint dtmp1, dtmp2, dtmp3, dtmp4, acc;
sep uchar var[3], mean[3], vartmp, meantmp;

dst[0] = 0;
dst[1] = 0;
/* Calculate Variance and Mean of first 2 lines */
dtmp2 = square((src[0] - :>src[1]));
dtmp3 = square((src[0] - src[1]));
dtmp4 = square((src[0] - :<src[1]));
dif = :<dtmp2 + dtmp3 + :>dtmp4;
dtmp1 = square((src[1] - :>src[1]));
dif += dtmp1;
dif += :<dtmp1;
dtmp2 = square((src[1] - :>src[2]));
dif += dtmp2;
dtmp3 = square((src[1] - src[2]));
dif += dtmp3;
dtmp4 = square((src[1] - :<src[2]));
dif += dtmp4;
var[1] = dif;
dif = :<dtmp2 + dtmp3 + :>dtmp4;
dtmp1 = square((src[2] - :>src[2]));
dif += dtmp1;
dif += :<dtmp1;
dtmp2 = square((src[2] - :>src[3]));
dif += dtmp2;
dtmp3 = square((src[2] - src[3]));
dif += dtmp3;
dtmp4 = square((src[2] - :<src[3]));
dif += dtmp4;
var[2] = dif;
acc = src[0] + src[1] + src[2];
acc += (:<acc + :>acc);
mean[1] = acc / 9;
acc = src[2] + src[2] + src[3];
acc += (:<acc + :>acc);
mean[2] = acc / 9;

for (i=3 ; i<lines-1; i++ ) {
/* Calculate Variance */
dif = :<dtmp2 + dtmp3 + :>dtmp4;
dtmp1 = square((src[i] - :>src[i]));
dif += dtmp1;
dif += :<dtmp1;
dtmp2 = square((src[i] - :>src[i+1]));
dif += dtmp2;
dtmp3 = square((src[i] - src[i+1]));
dif += dtmp3;
dtmp4 = square((src[i] - :<src[i+1]));
dif += dtmp4;
var[3]= sqrtsepi(dif>>3);
/* Calculate Mean */
acc = src[i-1] + src[i] + src[i+1];
acc += (:<acc + :>acc);
mean[3] = acc / 9;
/* Find minimum variance and its mean */
vartmp = :>var[1];
meantmp = :>mean[1];
mif (:<var[1] < vartmp) {meantmp = :<mean[1]; vartmp = :<var[1];}
mif (:>var[3] < vartmp) {meantmp = :>mean[3]; vartmp = :>var[3];}
mif (:<var[3] < vartmp) meantmp = :<mean[3];
dst[i-1] = meantmp;
var[1] = var[2]; mean[1] = mean[2];
var[2] = var[3]; mean[2] = mean[3];
}
dst[lines-2] = 0;
dst[lines-1] = 0;

From http://web.archive.org/web/200803130937 ... uwahara.lc

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: Gluas
PostPosted: Tue May 31, 2011 8:27 am  (#29) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
Ok, Thanks for the pointers. I've recoded it from scratch in G'MIC, it is quite short to perform in this beautiful language :)

#@gmic kuwahara : size>0
#@gmic : Apply Kuwahara filter of specified size on selected images.
#@gmic : $ image.jpg --kuwahara 5
kuwahara : -check $1>0
-e[^-1] "Apply Kuwahara filter of size $1 on image$?."
-v - -to_rgb -repeat @#
--dilate[0] $1 --erode[0] $1 -compose_channels[-1] min -compose_channels[-2] max --[-2,-1]
$1,1,1,1,{1/$1} -convolve[0] [-1] -transpose[-1] -convolve[0] [-1] -rm[-1]
-a[-2,-1] c
-f "v1=i(x-1,y-1,0,3,1); \
v2=i(x+1,y+1,0,3,1); \
v3=i(x-1,y+1,0,3,1); \
v4=i(x+1,y+1,0,3,1); \
vm=min(v1,v2,v3,v4); \
if(c>=3,i, \
if(vm==v1,i(x-1,y-1,0,c,1),
if(vm==v2,i(x+1,y-1,0,c,1),
if(vm==v3,i(x-1,y+1,0,c,1),
i(x+1,y+1,0,c,1)))))"
-channels[-1] 0,2
-mv[-1] 0 -done -v +

#@gimp Kuwahara filtering : gimp_kuwahara, gimp_kuwahara_preview(0)
#@gimp : Radius = int(3,1,30)
#@gimp : Channel(s) = choice("All","RGBA","RGB","Luminance","Blue/red chrominances","Blue chrominance","Red chrominance","Lightness","ab-components","a-component","b-component","Hue","Saturation","Value","Key","Alpha","ch-components","c-component","h-component")
#@gimp : sep = separator(), Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical")
#@gimp : sep = separator(), note = note("<small>Author : <i>David Tschumperl&#233;</i>. Latest update : <i>2011/05/31</i>.</small>")
gimp_kuwahara :
-apply_channels "-kuwahara $1",$2,0

gimp_kuwahara_preview :
-gimp_split_preview "-gimp_kuwahara ${1--2}",$-1


I got this :

Image

Should be already available after filter update.


Top
 Post subject: Re: Gluas
PostPosted: Tue May 31, 2011 8:39 am  (#30) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
thank David

I am wrong or the original filter was basically equivalent to a Convolution Matrix preset ?
Something as the many presets (erode ,dilate,highpass,etc) that may be created by
http://docs.gimp.org/2.6/en/plug-in-convmatrix.html ?

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
Post new topic Reply to topic  [ 58 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group