Focus stacks possible?

Hey guys,

I am looking into getting back into some programming/scripting and want to dive into the world of image processing to make learning more interesting and creating some personal tools.

I was considering possibly learning g’mic scripting to make some one off processes. Would it say be possible to use g’mic scripting to focus merge a image by implementing say a pyramid or depth map algorithm?

If not there are other options just wondering because g’mic seems to be very handy after seeing some filters people have made.

G’MIC is good at prototyping. So yes, it can be done with enough patience. :wink: The downside is that it is on the slow side. For faster processing, you would have to use its lower level C++ counterpart CImg.

1 Like

Thanks will look into that. Any tips on learning g’mic anyway it looks like it can be really useful in other ways even if not for focus stacking.

I would start with simple filters to understand syntax of g’mic-qt, and read up on https://gmic.eu/reference.shtml .

Some things you should know as a basic.

fill is equivalent to for x,for y, for z (insert value at end at x,y,z), and begin()/end() can be used to define variables. I use it for non-constant variables that needs to be updated after begin organize constant variables as well as macro.

Arguments within g’mic-qt are treated as strings.

eval is better for processing that are not inserted within x,y,z on for x,y,z.

shared is used to speed up filter. Rather than using s c, you can use shared to perform operation on a channel, then remove it.

repeat $! l[$>] endl done is a classical way of applying a filter toward different images

1 Like

Thanks for the info will look through it and experiment I guess that is the only way to really learn it. As well as getting enough understanding to look at other filters to learn from then. The syntax looks pretty cryptic :joy:

@blj, here are some useful resources to start with:

1.G’MIC Scripting basis : https://gmic.eu/tutorial/basics.shtml (a bit outdated but mostly valid). The main things that changed is that --command is now +command, and that -command is just command.
2. An example of step-by-step scripting : https://gmic.eu/tutorials/bouncing_balls3d/
3. The complete technical reference : https://gmic.eu/reference.shtml (a bit harder to read but has interesting info in it).

The G’MIC syntax indeed looks a bit cryptic, but mainly because it has been designed to make short programs. Once you’ve got the idea of item substitution (https://gmic.eu/reference.shtml#section8), everything becomes more clear.

1 Like

Thank you should be a big help.