It requires only the 1:1 view. E.g., if it shows the mask (only black and white values), it seems that the magnitude scaling (black/white point) when the threshold is computed depends on the area shown. It works correct with different areas on the command line.
@chris
The problem is the combination of view area and “-lt $1%”. Using a percentage means base it on min/max values in the area supplied to the filter.
You could either base it on a fixed min/max or you could make the preview full image, but neither are likely to be perfect anyway. Perhaps there’s some other way I haven’t thought of though.
Hm, but on the command line the “-lt x%” seems independent of the actual input data range but in GIMP it seems not. What’s the difference and how can I achieve identical behaviour, such that I can reuse the parameters found in GIMP on the command line?
The -lt. $1% is intended to depend on the min/max values of the whole image, which means that in the preview you’ll compute the threshold uniquely based on the min/max values of a cropped region. Not good or an accurate preview, if you zoom only on very dark or bright regions for instance. I suggest you use an absolute value instead of a percentage (the RGB input image has always values constrained to be in [0,255], so -lt. {$1*255%} should be great here.
Feel free to include this into G’MIC if you think it could be useful for other people. Maybe better change the name then, ICE may be trademarked in the context of scratch removal. Since in Germany ICE is a type of high speed train and G’MIC is a french product, I would suggest “TGV scratch removal” ;-).
Edit: If you decide to do so, I of course would contribute documentation on the whole process.
I’ve worked a bit on your code, to make it more clean :
I’ve added a Split preview option.
I’ve separated the preview process and the final process, so that you always get the final result when you actually apply the filter (even when the Preview as option is different).
I’ve added a loop to make your filter work with multiple input layers (and do not crash when input image is not in RGBA).
I’ve added a credit note at the end of the filter.
That’s how the code looks now, feel free to suggest any modification you would like to see:
That looks great, I already checked in GIMP. Nevertheless, it seems odd for me to claim authorship, it is mainly garagecoder’s and your work. However, I am going to take care of the filter and will start over with writing a proper tutorial the next days (or maybe some weeks, depending on other workload).
I may be wrong about this, but seem to remember the infrared layer needs to be merged into the alpha/opacity layer of the image. In other words combine the RGB + infra into a single RGBA.
Btw, could you tell where (which software etc.) you got this format from? If this is a standard output of another software, maybe it should be considered as another input option in the filter.
Furthermore, I would like to ask if it was useful for you or if there was anything missing (besides documentation, it’s still on my task list, but real life …).
If you require further assistance, please let me know. It’s good to see there are people with similar problems around .
since I am interested to look into this problem also for Kodachrome slides in detail, I installed the latest version of Gimp and the G’MIC plugin. However, when I ran the scratch removal, I get an error message:
Is there any more detailed documentation than the reference manual to understand what the various versions of inpaint do? I would very much appreciate more information on that.
@Jossie same problem for me… maybe coincidence but the preview command was updated recently. Perhaps one for @David_Tschumperle
He’s no doubt the best to answer questions about the inpaint methods as well. They range from simple to sophisticated, I think the newest is based on “patchmatch” algorithm which you can find easily.
I’m sorry guys, I’ve indeed broke the split preview command today with a small update.
I’ve fixed it, and after updating your filters (push the filter update button), it should be working again.
Sorry for the inconvenience.
I am new to G’MIC. The scratch removal it provides is something I was long thinking about working on. Now the issue seems to be solved at least for negatives and E6-emulsion. However, for Kodachrome there is the problem that the IR-channel contains a strong signal from the scene (due to the high Ag-content).
For the VueScan scratch removal approach on Kodachrome this is a disaster (applying corrections all over dark areas and thus reducing contrast there considerably) and it should not be used in my opinion. The G’MIC script and also SilverFast have problems with satisfactory consistent corrections both in dark and bright areas of the image. The correction either affects also dark areas, where there are no artefacts, or by lowering the threshold, artefacts in brighter regions are not corrected satisfactorily. Here I would like to find a solution with G’MIC.
Is there a more detailed description (more detailed than in the reference manual) on what the various inpaint commands actually do?
I guess, I will find instructions on how to write my own script in the documentation, which I have not yet studied carefully.