Hah yes, so it does! Yours is obviously more complex. I notice this method is not perfect either, e.g. you can obtain different results by mirroring on an axis. Not bad for an approximate though.
An interesting test is actually to try inpainting a very sparse colored point cloud.
Doing that, it’s easy to see what kind of function profile your inpainting technique is able to reconstruct.
For instance, I did that to compare the reconstruction of colored point clouds, with harmonic functions, my PDE-based inpainting and RBF :
That leads to quite different profiles (particularly for harmonic functions).
Pfff well, I can only say I’m glad I don’t need to be as rigorous. Interesting to see the complexity of each one though!
@garagecoder Glad you are back and also helping people outside of G’MIC. Keep up with your exercises, lest you become dull like myself. Ha ha.
I have a question, how exactly do I get the name of [0],[1]…[n]?
1,1,1,1,5 nm. img_of_five extracted_name=?
Basically extracted_name should have string containing the name of [0].
I looked, and it’s not possible to get the name.
name={0,n}
Thanks!
I ended up making my very first exporter (Not sure if this is good, but welcomed to criticism as always):
#@cli output_gpl : filename
#@cli : Output selected images as GIMP Palette
output_gpl:
e[^-1] "Output palettes$? as GIMP Palette file.(.gpl)"
(71,73,77,80,32,80,97,108,101,116,116,101,10,35,80,97,108,101,116,116,101,32,78,97,109,101,58,32)
init_header={t} rm.
(10,35,67,111,108,111,114,115,58,32)
init_colors_info={t} rm.
repeat $!
if $!>1 filename=${"filename \"$1\",$>"} else filename="$1" fi
0 nm. $filename rm.
basename,folder,num_of_cols,palname={b},{f},{whd#-1},{0,n}
header_info=$init_header$palname
colors_info=$init_colors_info$num_of_cols
start_header=$header_info$colors_info
pal_info="\n"
mp={w#0-1}
repeat $num_of_cols,p
rgb={I(#0,$>)}
hex_rgb=${rep_int82hex\ $rgb}
r={([$rgb])[0]}
g={([$rgb])[1]}
b={([$rgb])[2]}
pal_info.=$r" "$g" "$b" "$hex_rgb
if $p<$mp pal_info.="\n" fi
done
('$start_header$pal_info')
o. raw:$folder$basename.gpl,uchar
rm[0,-1]
done
EDIT: Also, is there a way to make this work?
echo ${arg\ $1+1,"This contains 3 spaces!","No_Spaces"}
From searching at arg\
in stdlib or in updatexxx.gmic, none of them contains spaces. Dash is used instead of spaces.
should be
echo ${arg\ $1+1,\"This\ contains\ 3\ spaces!\",\"No_Spaces\"}
or better :
echo ${"arg0 $1,\"This contains 3 spaces!\",No_Spaces"}
This is probably not exercise material, but here’s something I’d like to do in bases other than 10:
$ t=40 sa="" sb="" a=1 b={$t} repeat $t sa.=$a sb.=$b a+=1 b-=1 done
Output:
sa=12345678910111213141516171819202122232425262728293031323334353637383940
sb=40393837363534333231302928272625242322212019181716151413121110987654321
Like for base 12, 10 becomes the next character after 9.
This is part of the solution to replicating this - Concatenations — Kerry Mitchell
I would have to do element-wise addition/subtraction since double/float is out of question for large values. And I would have to solve generating a number from two variables (base_10_num,new_base). It’s the last one that’s the problem.
EDIT: I solved it.
This can output what I want
rep_num_to_base_other_than_10:
#$1==current_num
#$2==convert_2_base
num,base={abs($1)},{abs($2)}
digits,use_minus={1+int(log($num)/log($base))},{$1<0}
repeat $digits
rem={$num%$base}
num/=$base
({48+$rem})
if $>
rv[-2,-1]
a[-2,-1] x
fi
done
if $use_minus (45) rv[-2,-1] a[-2,-1] x fi
u {t}
rm.
It is exercise material as long as you show the work.
Agreed. Here’s the result I am getting:
Output
$ +rep_concat_countable_num_str 15,21,0
Base: 10
Direction: Backward
Output: 1,5,1,4,1,3,1,2,1,1,1,0,9,8,7,6,5,4,3,2,1
$ +rep_concat_countable_num_str_alt_base 21,12,31,1
Base: 12
Direction: Forward
Output: 1,2,3,4,5,6,7,8,9,10,11,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9
Code
#@cli +rep_concat_countable_num_str: abs_num,length,direction
#@cli : Insert image containing set of concatenation of countable numbers in order.
+rep_concat_countable_num_str:
direction,length={$3%2},{abs($2)}
start_num,str={!$direction?abs($1):1},""
if $direction
repeat abs($1)
str.=$start_num
start_num+=1
if size('$str')>$length break fi
done
else
repeat abs($1)
str.=$start_num
start_num-=1
if size('$str')>$length break fi
done
fi
('$str')
if w#-1<$length
$length,1,1,1,47
j. ..,1~
nm. {w#-2}
rm..
else r. $length,1,1,1,0,0 nm. $length
fi
-. 48
#@cli +rep_concat_countable_num_str_alt_base: abs_num,base,length,direction
#@cli : Insert image containing set of concatenation of countable numbers in order in bases other than 10.
+rep_concat_countable_num_str_alt_base:
direction,length={$4%2},{abs($3)}
start_num,str={!$direction?abs($1):1},""
if $direction
repeat abs($1)
str.=${rep_num2altbase\ $start_num,$2,1}
start_num+=1
if size('$str')>$length break fi
done
else
repeat abs($1)
str.=${rep_num2altbase\ $start_num,$2,1}
start_num-=1
if size('$str')>$length break fi
done
fi
('$str')
if w#-1<$length
$length,1,1,1
j. ..,1~
nm. {w#-2}
rm..
else r. $length,1,1,1,0,0 nm. $length
fi
-. 1
#@cli rep_num2altbase: abs_num,base,start_num
#@cli : Return number in bases other than 10. Each digit is represented by the character at ASCII codepoint (start_num)+(digit value).
rep_num2altbase:
skip ${3=48}
num,base={abs($1)},{abs($2)}
digits={1+int(log($num)/log($base))}
repeat $digits
rem={$num%$base}
num/=$base
({$3+$rem})
if $>
rv[-2,-1]
a[-2,-1] x
fi
done
u {t} rm.
Now, the only thing for me to do left is to do element-wise addition/subtraction.
Question: On for loop, does it matter if ++ is in front of "it"
or not? On a coding chat, it seems that C++ cares about the position as in there’s a speed difference.
I don’t remember but one of them seems to do slightly more work…
I guess I will just change to ++i instead of i++.
G’MIC operators ++
and --
work the same as in C++, so :
Question:
What are low-resource strategies to determine good factors/coefficient/weights? I have been thinking of ways to reduce compute time mainly because my laptop is inefficient but also because I like fast minimalist commands. My latest afre_denoise
is iterative and tries to limit the loop to 4 iterations by applying heavier weights at the beginning. I have been wondering how much is just right for n=0,1,2,3
. Note the effect is cumulative, so getting the first one right is more important than the next and the next, etc.
I am aware of and appreciate @rawfiner’s and @Iain’s work in normalizing noise. I think their methods would also inform this question. Maybe it is the code or the math that is preventing me from understanding their explanations…
Suggestion, try biconvolution i.e convolving twice per axis. That is how I made emboss/relief much faster recently. Maybe even add code to G’MIC internal to do that.
That’s all I got.
What do you mean by that? Could you give me a simplified example. If anything, I am convolving too many times. Let me think… I may be doing this many loops:
2 x 3 --> afre guided filter
x radius --> applied iteratively
x 4 iter --> progressively
+ 6 --> afre guided filter
if radius = 4
then 2 x 3 x 4 x 4 + 6 = 102 !
PS - 102x is just the guided filter part LOL
How would I make the bracket show up on G’MIC-QT interface?
#@gui :Internal Expression-XY=choice(0,"func_1(v)","func_1(a)+func_2(b)","func_1(func_b(v)+c?v)")
EDIT:
Ah yes, the answer is to use (
and )
respectively.
Bookmarked this solution now.