Auto Threshold |
|
Dec 8, 2011, 14:01
Post: #1
|
|||
|
|||
|
Auto Threshold
The Apply Threshold functionality in the ui has an option called Auto, which sets the lower threshold value. Any idea is this function/option is available to use in a plugin? The gimp-threshold and gimp-histogram functions doesn't seem to have these options
|
|||
|
Dec 9, 2011, 09:49
Post: #2
|
|||
|
|||
|
RE: Auto Threshold
I suppose this value could be easily recomputed (likely something like setting the threshold to the median as returned by the histogram), but this would need to know its actual definition, and I would have to dig in the source code for that, unless you find it documented somewhere.
![]() |
|||
|
Dec 10, 2011, 10:57
Post: #3
|
|||
|
|||
|
RE: Auto Threshold
I searched the GIMP source code and came across this function gimp_histogram_get_threshold in gimphistogram.c which seems to do all that magic.
http://git.gnome.org/browse/gimp/tree/ap...1281b476d3 I'm trying to convert that algorithm into script-fu. However, unfamiliarity with Scheme is slowing me down. Will try and post a solution to this as soon as possible. Thanks, Aldrin |
|||
|
Dec 10, 2011, 12:41
Post: #4
|
|||
|
|||
|
RE: Auto Threshold
Personally I find python a lot more useful. Scheme is limited to the Gimp built-ins. Python can use all the modules that comes with it (I have a script to dump/restore paths to CSV files, I didn't have to write the CVS parser). Object programming also make a lot of things easier to code, not speaking of the very nice Gimp interface that provides you with image/layers with native methods so you can avoid the PDB for many things and write more "natural" code.
![]() |
|||
|
Dec 11, 2011, 08:34
Post: #5
|
|||
|
|||
|
RE: Auto Threshold
Here's the solution I finally used. Works only for grayscale images. Its the same algorithm as in the gimp_histogram_get_threshold function in gimphistogram.c
http://git.gnome.org/browse/gimp/tree/ap...istogram.c Code: (define (auto-threshold imagePath) |
|||
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads... | |||||
| Thread: | Author | Replies: | Views: | Last Post | |
| auto-cropping all layers and exporting or saving all layers as separate images? | Pesquit | 3 | 211 |
Mar 27, 2012 00:51 Last Post: ofnuts |
|

Search
Member List
Help
GIMP Tutorials



![[Image: 2Tvo0.png]](http://i.imgur.com/2Tvo0.png)
