You are here

Adaptive Threshold Edge Detect

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!

An alternative edge detector based on the implementation in the OpenIllusionist project.

The original algorithm requires scaling down of the entire image area to be processed and it would have to be completely re-written to work with GIMP tiles. Since this plugin is a simple adaptation of the original algorithm it does not make use of tiles and therefore it needs to allocate a lot of memory to work. So please be aware that it may have problems if you attempt to use it on an extremely large image!

The algorithm is based on research at the University of York and was developed primarily for use with fiducial detection in live video. It was designed to improve detection of connected edges and reduce the effects of ringing edges that often occur in video streams and compressed still images.

The source and Linux binaries can be downloaded from my github plugins repository.

A more detailed description along with some example images can be found on my blog.

GIMP Version: 
Code License: 


Thanks for making the windows version of this. The edge detection works great! I'll probably get blasted for asking this, but if you could provide information on how you compiled it on Windows, I would appreciate it. I've spent about 2 hours now, with no luck. I've done help searches, tried gimptool, and CL in visual studio, but I get errors. I'm on Windows 7, but I think I would have a problem on XP too.


'x86_64-pc-mingw32-gcc' is not recognized as an internal or external command, operable program or batch file.


adaptive-edge.c(112) : error C2275: 'GimpRunMode' : illegal use of this type as an expression

Update: I fixed the CL errors by modifying my copy of the c source file. But I get unresolved externals, I think because I don't have all of the GIMP .lib files. I found some at, but not all.

unresolved external symbol _gimp_main referenced in function _WinMain@16
unresolved external symbol _gimp_plugin_menu_register referenced in function _query


I use MinGW/MSys (MinGW 32). You compile Gimp and you can use gimptool-2.0.exe.

There is also gimp dev, but I've never used :


I successfully created all of the GIMP .lib files by getting the GIMP 2.6.11 source code and using Microsoft Visual Studio 6.0 to generate them. I was then able to compile and link the adaptive-edge.c file.


I modified my copy of the adaptive-edge.c file as follows:

* "C requires all local variables to be declared at the top of the function"
* so I modified the code to do that, to get it to compile on Windows using
* Visual Studio 6.0.
* Otherwise it got this error:
* error C2275: '' : illegal use of this type as an expression

I didn't have an lrint function so I wrote my own. (Trivial.)

When I started GIMP, I got an error that libintl.dll was missing so I copied gtk.2.16\bin\intl.dll to my plugins directory as name libintl.dll

All of the above sounds trivial, but it took me several hours to get all of the right pieces together and get an end result that worked. But now I'll be able to write my own plugins. :-)

Thanks Sam; look forward to testing it but have to do some errands now. :)

No Windows compile? Also, do you have a before/after picture set to see how effect the result is? Always interested in edge detection schemes. :)

I am not a Windows user and have not yet had the chance to figure out how to cross-compile it, however thank you to samj for providing an initial build.

The above description has been updated with a link to a blog post containing example images as per your suggestion.


What about 32 bit for Linux?

I've added a 32-bit version to the github downloads. It is untested though since I tricked the gimptool into building it on my 64-bit system!

Hope it works,

Works great with trees, which really impressed me, getting the limb/leaf detail. No other line detection has been able to do this, AFAIK.

Thanks for the links; just got back and now I have to leave again soon, but do plan on playing with it when I get back. These samples look quite good by the way. A few years ago I tried a program (forgot the name but believed it began with a "K" or "N") which was cool too. :)

Edit: sort of half right; lol

The program is an open source program called darknock (kn in the middle; lol). :)


Subscribe to Comments for "Adaptive Threshold Edge Detect"