afre's G'MIC diary

Update Barely made any progress. Been busy and exhausted. Incoming discussion.

Guided filter Besides getting it ready, I have realized that it is slow for normal use, a limitation of G’MIC scripting, among other factors. Radius 1-2 are very fast but larger radii are much slower. Without optimizing or compromising the code (or writing and compiling C++ code), I might decide to extend the core filter with an iterative (edge-preserving1) version.

1 Long term work in progress. Edge detection gradient_norm is surprisingly elegant, compared to other methods, but as I have noted in other posts, strong edges aren’t only brighter but also thicker. A map with lines with even brightness and thickness would be ideal for pixel weighting. There are other approaches to edge-preservation but they are difficult to understand and implement properly.

Local contrast This would depend on the guided filter, as do many filters on my to do list. Research on this isn’t done. I have much to learn. What I do have is a working filter that is conservative to the point where it behaves like a sharpener.

Sharpen Speaking of which, instead of including my LoG (Laplacian of Gaussian) filter, I have decided to make a new one using FFT.

Dehaze Sorry about hyping it up. The haze removal I want to do requires lots of elements to work individually and in tandem, a robust guided filter being one of them. Currently, it is last on my list of priorities. Original thread: Developing afre_dehaze.

Update updated afre_vigrect and added afre_vigcirc. Edit both in a PR.

These are my vignette filters, one rectangular and the other circular. They add a vignette that either brightens or darkens the periphery, controlling its size, strength and position. afre_vigrect has an additional blur feature to give it more flexibility that I don’t think afre_vigcirc requires: let me know how that goes.

1 Like

Hmm, adding shape vignette seem doable. I’ll attempt that.

@David_Tschumperle By the way, I’m gonna make a pull request. Requesting manual pull request insertion.

Reason - Pull request get lost like in the case of my changes in a pull request on @Joan_Rake1 gmic file. You can see that in a pull request I have made, and that includes a link to the lost pull request. So, since there’s going to be 2 pull request…

Both vignetting filters are in a PR available now. Clarification: Both filters have GUI and CLI.

Will do that in the future but currently I am more interested in upping practical filters. The fun versions will come after I am done with the core commands and filters (which are many).

What shapes would interest you?

Personally, I would be interested in real vignetting examples of lenses and camera + lens + hood (mis)matches.


PS I finally used a bit of git and learnt to do

git push -f origin last_known_good_commit:branch_name

No more clumsily deleting the repository and re-forking it after a mistake. :man_facepalming::woman_facepalming:


Potential afre_vig* features
1 afre_vigrect and afre_vigcirc could go into a GUI multi-filter.
2 Could add other transformations such as rotation and sheering.
3 Could generalize rectangle and circle with polygon and ellipse, respectively.
4 Could give user the option to submit their own shape for manipulation.

Looking at the pull request, what with the ^_^ face? I’m confused about that.

Update

Been working on improving the gradient_norm for my edge detection purposes. afre_edge CLI GUI will do a fairly good job in thinning the edges and evenly brightening them. afre_box CLI has been added to my core set of commands. afre_edge depends on it and so will the guided filter.

Introduced a smiley face in the output. As with the error face, I want to insert some charm into an otherwise boring CLI. If Ed could do it I could do it too. (Not that I wanted to make the reference, but it fits. Speaking of which, a live-action version of Cowboy Bebop is in development. I wonder if it would be any good. Redoing or renewing classics is controversial at best.)

These changes are in a PR right now and will be available soon. Edit Just increased the input range. Bonus Try turning up details and see what happens. With the right combination, you get a web-like appearance.

1 Like

I think I might just use it for another pdn filter replica. Thank you.

That is a compliment. It would be great if you could link to my user page, as shown in the image above and post here so that I could keep track. Thanks.


Another person (@Iain) expressed interest in afre_edge. Since this is a diary, I have some personal (and vulnerable) thoughts on the matter.


Reflection

The code is already up and running. It should be self-explanatory but let me know if you have any specific questions.

The real test of a command, filter or, more abstractly, an idea is that people use it, hopefully with proper attribution. I would encourage you to use the command itself and not simply replicate it because I came up with it myself, expending time, energy and imagination into it. If it is not satisfactory for your uses, I would prefer that we brainstorm or collaborate to make it better together. That way we can learn from one another.

I am brimming with ideas but don’t usually have the tools or resources to realize them. Thanks to this community and those behind it (in particular, @patdavid and @David_Tschumperle), I have gone from knowing nothing to knowing something and being able to actively help our forum members and visitors. If you answer my questions, give feedback or use my commands, that would help me be much more productive.

A deeper and darker reason for this line of thinking is that, for almost all of my life, people have taken advantage and taken credit for my work. So much so that it is as if I didn’t exist or I were a hindrance. I get nothing in return, or worse: lost time, wages or straight up abuse. It is very painful living like that, impoverished and without anyone to have my back (for real).

Which is why I try to be of good cheer in this forum and in the code with these (^_^) (>_<). And so some attribution, encouragement and / or collaboration would help keep me going.

6 Likes

Thanks @afre for all your efforts.

I know that developing G’MIC scripts is not always an easy task, and you have always held on to it, thank you, on behalf of the entire user community!

6 Likes

Thanks. Was feeling a way low yesterday.

1 Like

Hello @afre

I do think you are an extremely talented person.
For sure, your help on this forum is quite appreciated!

If I may crack a joke, just only for being able to code proficiently with the “G’MIC programming language” makes you a super star! :slight_smile: :slight_smile:

4 Likes

I really appreciate you letting us know what you’ve been thinking. I look up to people like you when it comes to GMIC filters. You certainly know a lot about the stuff I don’t know much about. :grinning:

I would encourage you to use the command itself and not simply replicate it because I came up with it myself, expending time, energy and imagination into it. If it is not satisfactory for your uses, I would prefer that we brainstorm or collaborate to make it better together. That way we can learn from one another.

I like this approach a lot.

3 Likes

Au contraire, mes ami: here, you are valued. From my perch, you and @Morgan_Hardwood do more than any other members to keep us on track in these threads. I personally sit up and listen carefully to what you have to say; I haven’t much pitched in to some of the conversations due to multitasking, but that’s changing as I put the day job on the back burner.

One thing on my to-do list is to more completely understand G’MIC programming. Programming languages were my academic focus, but I have to admit G’MIC vexes me. Your proficiency in it is well-regarded, at my desk…

Open-Source thinking is a bit of a glitch in our market economy: exchange of ideas doesn’t necessarily put food on the table, or as you point out, directly instill a sense of accomplishment in the contributor. Even with all the ‘conversation’ taking place here, you can bet we’re all reticent to spill our guts here when we don’t know who will respond mis-understandingly.

@afre, I most definitely value your contributions here.

5 Likes

It took me a year on G’MIC programming, and I still have a lot of questions about doing it. And then there’s unsolved one like this one - Anything to autoconnect points within G'MIC? . I don’t get that much praises on what I do, but I still do it because I definitely want to offer fun filters found on Paint.NET forums and obscure sources to G’MIC. @afre did helped me significantly as well as @David_Tschumperle, but the only way to learn G’MIC programming is to just do it. You’re never going to learn programming/scripting otherwise.

1 Like

The legend of the learning difficulty of the G’MIC language is on the move…

It’s a simple language! :slight_smile:

1 Like

@ggbutcher the feelings are very much mutual - I pay attention to and learn from your insights which I value for the fact that you explain things you’ve actually tested and verified through your coding, and enjoy your thorough and patient style of response.

@afre I find that walking away from the computer and into the woods helps when I’m feeling similar to how you felt.

3 Likes

Being here is like walking in the woods for me. I agree that it would be healthier for me to walk in the actual woods every so often (without bringing Mr Shakes with me; he is a good boy but demanding).

1 Like

I am reminded of a short joke, goes like this: Two guys, sitting next to each other on a train. Guy at the window: 132. (time passes…) 78. (more time…) 254… Guy on the aisle: What are you doing? Window Guy: Counting cows. Aisle Guy: Wow! We’re going at least 70 (MPH, KPH, go with what you’re familiar), how do you do that? Window Guy: Easy. I just count the number of legs and divide by four…

I think interpolation resizing is a lot like that. :smile:

2 Likes

I know this is a little too much to ask for, but I would like to see more details on filters as in information about them. When I do filters, I add info myself.

It’s a simple language!

I agree that it’s the best language for image processing, and it is the bridge for software independence i.e you don’t have to use one software to use x filter or another.

Behind the command Problem solving and determining the viability of a (null) hypothesis is a labour of love or necessity. We all do it at some capacity, whether formally or informally, by brilliance or stumbling in the dark. Mastery is achieved when you have that moment of clarity – call it being in the zone, making a discovery or having a revelation.

I will explain afre_edge since @Iain asked. The concept is dead simple and it embodies the distilling of mastery that I just waxed poetic. I like dead simple because it means that even I can understand it comfortably and the resultant command is guaranteed to be fast, even on the saddest laptop (mine).

Observe the following command.

gmic 51,51,1,1 f x==25?255 o line.png repeat 2 gradient_norm done o gradient_norm.png

A picture, or two, is worth a thousand words. The second is normalized for your viewing pleasure.

line gradient_norm

Subtract the first from the second. afre_edge in a nutshell. :exploding_head: :coconut:


For context, what gradient_norm does to lines is double around them, leaving a void where they were, which is awkward for edge detection but exploitable for afre_edge. The gradient_norm by itself does this (normalized)

As you can observe, lines such as whiskers “double up” when a good detector should keep the line.