I wonder if it would be worthwhile to resize the images prior to computation and then save that data for alignment of the original images to save processing intensity, and otherwise reduce the complexity of the similarity and alignment processes.
I started by using rescale 50%
to test the original pipeline but ended up not using it.
Also I’m not sure if ssim doesn’t do that internally already.
Hi, i have once again a nooby question : is it possible to draw a circle using a single (thick)spline
?
All i could do was guitar picks and then ended up with this using 6 thicksplines:
OK ok, no circle there but i got lost on the way
Yes it is possible.
I’ve just added a new command thickcircle
in the stdlib, that uses thickspline
:
Here is the code of the thickcircle
command:
#@cli thickcircle : x[%],y[%],R[%],_thickness>=0,_opacity,_color1,...
#@cli : Draw specified colored thick outlined circle on selected images.
#@cli : Default values: 'thickness=3', 'opacity=1' and 'color1=0'.
#@cli : $ 400,400 repeat 15 { R:=lerp(10,190,$>/($>+$<)) thickcircle 200,200,$R,2,1,$R } n 0,255 map 7
thickcircle : check "${4=3}>=0" skip ${5=1},${6=0}
e[0--3] "Draw outlined thick circle at ($1,$2) with radius $3 on image$?, with thickness $4, opacity $5 "\
"and color (${6--1})."
if !$4 return fi
foreach {
4,1,1,4,"begin(
const xc = ispercentage($1)?w*$1:$1;
const yc = ispercentage($2)?h*$2:$2;
const R = ispercentage($3)?hypot(w#0,h#0)*$3:$3;
const R1667 = 1.667*R;
);
U = cexp([0,lerp(0,360,x/w)°]); [ xc + R*U[0], yc + R*U[1], -R1667*U[1], R1667*U[0] ]"
thickspline.. {[I[0],I[1]]},${4--1}
thickspline.. {[I[1],I[2]]},${4--1}
thickspline.. {[I[2],I[3]]},${4--1}
thickspline.. {[I[3],I[0]]},${4--1}
k[0]
}
And here is an example of use:
foo :
400,400
repeat 15 {
R:=lerp(10,190,$>/($>+$<))
thickcircle 200,200,$R,2,1,$R
}
n 0,255 map 7
So, with a simple $ gmic update
, you should be able to access this command.
Let me know.
Ah, you read my mind, thanks.
Any hope for thickpolygon
? Might be a tough one. Or maybe there’s
something else that could use some thickness.
But i see you are using 4 splines. I thought about trying with 1 only, but i guess it’s not possible.
I don’t think this will be tough. It’s just successive calls to command thickline
.
I may give a try.
EDIT: Ha no, using just thickline
won’t work for getting thick vertices that join nicely together.
Hi, the command still doesn’t appear after update (gmic 3.5.4).
My bad, it just wasn’t in autocompletion
$ gmic update
$ gmic h thickpolygon
thickpolygon:
N>=1,x1[%],y1[%],...,xN[%],yN[%],_thickness>=0,_opacity,_color1,... |
[coords],_thickness>=0,_opacity,_color1,...
Draw specified colored thick outlined N-vertices polygon on selected images.
If 'thickness<0', the command draws an open polygon rather than a closed polygon.
Default values: 'thickness=3', 'opacity=1', and 'color1=0'.
Example:
[#1] image.jpg thickpolygon 4,20%,20%,80%,30%,80%,70%,20%,80%,5,1,0,255,0
[#2] image.jpg 2,16,1,1,'u(x?h#0:w#0)' thickpolygon[-2] [-1],5,1,255,0,255 remove[-1]
Example of use:
foo :
shape_cupid 512 edgels -1 k[2] channels 0,1
512,512,1,3,"lerp([70,30,0],[0,0,255],y/h)"
repeat 5 {
f:=$>/($>+$<)
+r[0] 1,{lerp(10,1,$f)}%,1,2
f. "256 + lerp(0.2,1,$f)*(I - 256)" permute. cyzx
thickpolygon[1] .,{lerp(1,10,$f)},0.5,${-RGB} rm.
}
k.
Nice, thanks! I seriously thought i’d never see these thick
drawing commands.
Now i guess it means only thickellipse
is missing I thought you’d start there before
thickcircle
though. Isn’t circle
using ellipse
under the hood?
No, it uses thickspline
.
I mean, the standard circle
?
In that case, yes:
$ gmic e \$\$circle
[gmic]./ Start G'MIC interpreter (v.3.5.4).
skip ${4=1},${5=0},${6=0} if ${"is_pattern "$5""} e[0--3] "Draw outlined circle at ($1,$2) with radius $3 on image$?, with opacity $4, pattern $5 and color (${6--1})." else e[0--3] "Draw filled circle at ($1,$2) with radius $3 on image$?, with opacity $4 and color (${5--1})." fi ellipse $1,$2,$3,$3,0,${4--1}
~~~
Haha, i should remove that Rotation section… I’ve seen it before but completely forgot about it. Oups.