From: WANG Date: Tue, 3 Sep 2013 08:27:22 +0000 (+0200) Subject: Merge branch 'master' of https://scm.cri.ensmp.fr/git/Faustine X-Git-Url: https://scm.cri.mines-paristech.fr/git/Faustine.git/commitdiff_plain/1cd7d4be8f3cbfc71838c176e56c73774c5ba5fa?hp=8911c3495aec2d4c182e22db60b529d551c406f9 Merge branch 'master' of https://scm.cri.ensmp.fr/git/Faustine --- diff --git a/architecture/morph.lib b/architecture/morph.lib deleted file mode 100644 index 35e65b6..0000000 --- a/architecture/morph.lib +++ /dev/null @@ -1,38 +0,0 @@ -import("fft.lib"); -import("fft2d.lib"); - -DILATION_MIN = 0; -EROSION_MAX = 255; - -strel_shift_dilation = DILATION_MIN : vectorize(1); -strel_shift_erosion = EROSION_MAX : vectorize(1); - -spray_by_three(n) = _ <: par(i, n, ([i], [i+1], [i+2])); - -tri_max = max, _ : max; -tri_maxs(n) = par(i, n, tri_max); -tri_min = min, _ : min; -tri_mins(n) = par(i, n, tri_min); - -dilating(n) = strel_shift_dilation, _, strel_shift_dilation : #, _ : # : spray_by_three(n) : tri_maxs(n) : nconcat(n); -eroding(n) = strel_shift_erosion, _, strel_shift_erosion : #, _ : # : spray_by_three(n) : tri_mins(n) : nconcat(n); - -//dilation(size, iter) = seq(i, iter, dilating(size)); -//erosion(size, iter) = seq(i, iter, eroding(size)); - -dilation_square(x, y) = _ : vectorize(y) : serialize : dilating(x) : vectorize(y) : matrix_transpose(y, x) : serialize : dilating(y) : vectorize(x) : matrix_transpose(x, y) : serialize; - -erosion_square(x, y) = _ : vectorize(y) : serialize : eroding(x) : vectorize(y) : matrix_transpose(y, x) : serialize : eroding(y) : vectorize(x) : matrix_transpose(x, y) : serialize; - -dilations(x, y, iter) = seq(i, iter, dilation_square(x,y)); -erosions(x, y, iter) = seq(i, iter, erosion_square(x,y)); - -open(x, y, iter) = erosions(x, y, iter) : dilations(x, y, iter); -close(x, y, iter) = dilations(x, y, iter) : erosions(x, y, iter); - -//process = dilations(112, 3); -//process = erosions(119, 10); -//process = open(119, 123, 10); -//process = close(119, 123, 1); - - diff --git a/architecture/morpho.lib b/architecture/morpho.lib new file mode 100644 index 0000000..7d86d47 --- /dev/null +++ b/architecture/morpho.lib @@ -0,0 +1,49 @@ +import("fft.lib"); +import("fft2d.lib"); + +DILATION_MIN = 0; +EROSION_MAX = 255; + +strel_shift_dilation = DILATION_MIN : vectorize(1); +strel_shift_erosion = EROSION_MAX : vectorize(1); + +spray_by_three(n) = _ <: par(i, n, ([i], [i+1], [i+2])); + +tri_max = max, _ : max; +tri_maxs(n) = par(i, n, tri_max); +tri_min = min, _ : min; +tri_mins(n) = par(i, n, tri_min); + +dilating(n) = strel_shift_dilation, _, strel_shift_dilation : #, _ : # : spray_by_three(n) : tri_maxs(n) : nconcat(n); +eroding(n) = strel_shift_erosion, _, strel_shift_erosion : #, _ : # : spray_by_three(n) : tri_mins(n) : nconcat(n); + +//dilation(size, iter) = seq(i, iter, dilating(size)); +//erosion(size, iter) = seq(i, iter, eroding(size)); + +dilation_square(x, y) = serialize : dilating(x) : vectorize(y) : matrix_transpose(y, x) : serialize : dilating(y) : vectorize(x) : matrix_transpose(x, y); + +erosion_square(x, y) = serialize : eroding(x) : vectorize(y) : matrix_transpose(y, x) : serialize : eroding(y) : vectorize(x) : matrix_transpose(x, y); + +cross = _, _ <: !, _, _, !; + +//dilations(x, y, iter) = seq(i, iter, dilation_square(x,y)); +//erosions(x, y, iter) = seq(i, iter, erosion_square(x,y)); + +dilations(x, y, iter) = _ : vectorize(y) : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : dilation_square(x, y))~_), (iter - 1)) : rdtable : serialize; +erosions(x, y, iter) = _ : vectorize(y) : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : erosion_square(x, y))~_), (iter - 1)) : rdtable : serialize; + +opening(x, y, iter) = erosions(x, y, iter) : dilations(x, y, iter); +closing(x, y, iter) = dilations(x, y, iter) : erosions(x, y, iter); + +threshold(x, n) = _, (n : vectorize(x)) : >; +and = *; + +licenceplate(x, y, seuil) = _ <: (opening(x, y, 1), closing(x, y, 1) : threshold(x, seuil), threshold(x, seuil) : and : opening(x, y, 1) : dilations(x, y, 1)), _ : and; + +//process = dilations(8, 8, 3); +//process = erosions(8, 8, 3); +//process = open(8, 8, 2); +//process = close(8, 8, 5); +//process = licenceplate(8, 8, 128); + + diff --git a/dsp_files/opening.dsp b/dsp_files/opening.dsp index 93707bf..29d985c 100644 --- a/dsp_files/opening.dsp +++ b/dsp_files/opening.dsp @@ -32,9 +32,9 @@ erosions(x, y, iter) = seq(i, iter, erosion_square(x,y)); open(x, y, iter) = erosions(x, y, iter) : dilations(x, y, iter); close(x, y, iter) = dilations(x, y, iter) : erosions(x, y, iter); -//process = dilation(112, 3); +process = dilation(112, 3); //process = erosion(119, 10); //process = opening(119, 10); -process = close(119, 123, 1); +//process = close(119, 123, 1); diff --git a/examples/open/open.dsp b/examples/open/open.dsp index 0e218de..7c7445b 100644 --- a/examples/open/open.dsp +++ b/examples/open/open.dsp @@ -1,3 +1,3 @@ -import ("../../architecture/morph.lib"); +import ("../../architecture/morpho.lib"); process = open(119, 123, 2); diff --git a/examples/open/open.sh b/examples/open/open.sh index c54a8f3..805dbff 100644 --- a/examples/open/open.sh +++ b/examples/open/open.sh @@ -1 +1 @@ -../../interpretor/faustine -d open.dsp -i circbw.csv --oformat csv +../../interpretor/faustine -d open.dsp -i circbw.csv -t 123 --oformat csv