X-Git-Url: https://svn.cri.ensmp.fr/git/Faustine.git/blobdiff_plain/456ab1eb0f387a99d0bfdc5bb3c42c20d645b331..c55d1f23d06e85b0e21cdf5cbc5c8efb6ac3bc1a:/lib/morpho.lib?ds=inline diff --git a/lib/morpho.lib b/lib/morpho.lib index 5c42861..4b7e21b 100644 --- a/lib/morpho.lib +++ b/lib/morpho.lib @@ -14,31 +14,31 @@ 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); +dilating(n) = strel_shift_dilation, _, strel_shift_dilation : #, _ : # : spray_by_three(n) : tri_maxs(n) : nconcat(n); // vector io +eroding(n) = strel_shift_erosion, _, strel_shift_erosion : #, _ : # : spray_by_three(n) : tri_mins(n) : nconcat(n); // vector io -dilation_line(x, y) = serialize : dilating(x) : vectorize(y); -erosion_line(x, y) = serialize : eroding(x) : vectorize(y); +dilation_line(x, y) = serialize : dilating(x) : vectorize(y); // matrix io +erosion_line(x, y) = serialize : eroding(x) : vectorize(y); // matrix io -dilation_column(x, y) = matrix_transpose(y, x) : serialize : dilating(y) : vectorize(x) : matrix_transpose(x, y); -erosion_column(x, y) = matrix_transpose(y, x) : serialize : eroding(y) : vectorize(x) : matrix_transpose(x, y); +dilation_column(x, y) = matrix_transpose(y, x) : serialize : dilating(y) : vectorize(x) : matrix_transpose(x, y); +erosion_column(x, y) = matrix_transpose(y, x) : serialize : eroding(y) : vectorize(x) : matrix_transpose(x, y); -dilation_square(x, y) = dilation_line(x, y) : dilation_column(x, y); -erosion_square(x, y) = erosion_line(x, y) : erosion_column(x, y); +dilation_square(x, y) = dilation_line(x, y) : dilation_column(x, y); +erosion_square(x, y) = erosion_line(x, y) : erosion_column(x, y); cross = _, _ <: !, _, _, !; -dilations_line(x, y, iter) = _ : vectorize(y) : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : dilation_line(x, y))~_), (iter - 1)) : rdtable : serialize; +dilations_line(x, y, iter) = _ : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : dilation_line(x, y))~_), (iter - 1)) : rdtable; -erosions_line(x, y, iter) = _ : vectorize(y) : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : erosion_line(x, y))~_), (iter - 1)) : rdtable : serialize; +erosions_line(x, y, iter) = _ : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : erosion_line(x, y))~_), (iter - 1)) : rdtable; -dilations_column(x, y, iter) = _ : vectorize(y) : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : dilation_column(x, y))~_), (iter - 1)) : rdtable : serialize; +dilations_column(x, y, iter) = _ : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : dilation_column(x, y))~_), (iter - 1)) : rdtable; -erosions_column(x, y, iter) = _ : vectorize(y) : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : erosion_column(x, y))~_), (iter - 1)) : rdtable : serialize; +erosions_column(x, y, iter) = _ : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : erosion_column(x, y))~_), (iter - 1)) : rdtable; -dilations_square(x, y, iter) = _ : vectorize(y) : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : dilation_square(x, y))~_), (iter - 1)) : rdtable : serialize; +dilations_square(x, y, iter) = _ : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : dilation_square(x, y))~_), (iter - 1)) : rdtable; -erosions_square(x, y, iter) = _ : vectorize(y) : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : erosion_square(x, y))~_), (iter - 1)) : rdtable : serialize; +erosions_square(x, y, iter) = _ : (iter, ((cross : ((0, 1 : prefix), _, _ : select2) : erosion_square(x, y))~_), (iter - 1)) : rdtable; opening_line(x, y, iter) = erosions_line(x, y, iter) : dilations_line(x, y, iter); closing_line(x, y, iter) = dilations_line(x, y, iter) : erosions_line(x, y, iter); @@ -49,19 +49,16 @@ closing_column(x, y, iter) = dilations_column(x, y, iter) : erosions_column(x, y opening_square(x, y, iter) = erosions_square(x, y, iter) : dilations_square(x, y, iter); closing_square(x, y, iter) = dilations_square(x, y, iter) : erosions_square(x, y, iter); -and = *; -threshold(x, low, high) = _ <: (_, (low : vectorize(x)) : >), (_, (high : vectorize(x)) : <) : and; +threshold(x, y, low, high) = _ <: (_, (low : vectorize(x) : vectorize(y)) : >), (_, (high : vectorize(x) : vectorize(y)) : <) : &; -//licenceplate(x, y) = _ <: (opening_line(x, y, 15), closing_line(x, y, 8) : threshold(x, 1, 50), threshold(x, 150, 255) : and : opening_column(x, y, 4) : opening_line(x, y, 4) : dilations_square(x, y, 2)), _ : and; +mask_adjusting(x, y, o7, o8, d9, d10) = opening_column(x, y, o7) : opening_line(x, y, o8) : dilations_square(x, y, d9) : dilations_line(x, y, d10); -licenceplate(x, y, o1, c2, t3, t4, t5, t6, o7, o8, d9, d10) = _ <: (opening_line(x, y, o1), closing_line(x, y, c2) : threshold(x, t3, t4), threshold(x, t5, t6) : and : opening_column(x, y, o7) : opening_line(x, y, o8) : dilations_square(x, y, d9) : dilations_line(x, y, d10)), _ : and; - -//licenceplate(x, y) = _ <: (opening_line(x, y, 4), closing_line(x, y, 2) : threshold(x, 1, 50), threshold(x, 150, 255) : and : opening_column(x, y, 4) : opening_line(x, y, 4) : dilations_square(x, y, 4)), _ : and; +licenceplate(x, y, o1, c2, t3, t4, t5, t6, o7, o8, d9, d10) = vectorize(y) <: (opening_line(x, y, o1), closing_line(x, y, c2) : threshold(x, y, t3, t4), threshold(x, y, t5, t6) : & : mask_adjusting(x, y, o7, o8, d9, d10)), _ : * : serialize; //process = dilations_line(8, 8, 3); //process = erosions(8, 8, 3); //process = open(8, 8, 2); //process = close(8, 8, 5); -//process = licenceplate(4, 4, 15, 8, 1, 50, 150, 255, 4, 4, 2, 20); +//process = licenceplate(4, 4, 1, 4, 1, 50, 150, 255, 1, 1, 5, 20);