

The Java Advanced Imaging API supports a number of interesting convolutions straight out of the box, and one of them is Sobel edge detection.
The Sobel edge-detection kernel comes in two varieties, corresponding to horizontal edge detection and vertical edge detection:
1 2 1You can combine them, and/or run them serially against an image, to detect all edges in an image. And that's what the following code example (in JavaScript) does. You can run the following script against an image of your choice using the ImageMunger app I wrote about a few days ago. Be sure the Java Advanced Imaging JARs are in your classpath.
0 0 0
-1 -2 -1
1 0 -1
2 0 -2
1 0 -1
If you run the Sobel operation by itself, you get a "negative" image, like so:

If you want the inverted version of this image (see example further above), you need to invert the individual pixels of the image. The super-fast way to do it is with a lookup table, but you can also do the pixel inversion manually, in a loop, which is what I've done (for illustrative purposes). In JavaScript the pixel-inversion loop adds about one second of processing time for a 600 x 400 image. The Sobel filter by itself takes around a half a second.
Sobel tends to be very sensitive to noise (it will feature-enhance specks and JPEG artifacts), so it often helps to smooth an image, first, with a blurring operation, prior to applying Sobel.
Future projects:
- Write a "tunable" version of Sobel that can detect soft or hard edges, according to a tuning parameter.
- Write a version of Sobel that's tunable by color (viz., detecting just blue edges, or just black edges, or just medium-grey edges).
Good information about sobel edge detection using java advanced imaging. Such a useful and very informative article. Keep blogging and thanks for sharing.
ReplyDeleteRegards,
clipping path
waw,. great article,.. I think it's very usefull for programmer,..especially for java programmer,. :)
ReplyDeletescrub m65 kamagra attorney lawyer body scrub field jacket lovegra marijuana attorney injury lawyer
ReplyDeleteReally trustworthy blog, please keep updating with great posts like this one.
ReplyDeleteNow it will be very cold in winter, in order to keep warm yourself, Moncler company has provide jackets for you, so it is better to own Moncler Jackets as soon as possible.
Nice information, many thanks to the author. It is incomprehensible to me now, but in general, the usefulness and significance is overwhelming. Thanks again and good luck! Web Design Company
ReplyDeletehttp://www.fishingcostaricaexperts.com/
ReplyDeleteCosta rica Fishing
Thank you for another essential article. Where else could anyone get that kind of information in such a complete way of writing? I have a presentation incoming week, and I am on the lookout for such information.
ReplyDeleteArsenal vs Huddersfield Town live streaming | Lazio vs Fiorentina live streaming | Everton vs Chelsea live Streaming | Technology News | News Today | Live Streaming