I hate the Java Advanced Imaging API

DIY Book Scanner Skunk Works. Share your crazy ideas and novel approaches. Home of the "3D structure of a book" thread.

Moderator: peterZ

Post Reply
User avatar
rob
Posts: 773
Joined: 03 Jun 2009, 13:50
E-book readers owned: iRex iLiad, Kindle 2
Number of books owned: 4000
Country: United States
Location: Maryland, United States
Contact:

I hate the Java Advanced Imaging API

Post by rob »

Or, an open JAI break-up letter.

If you have no idea what I'm talking about, you may as well skip this post :)

By all that is sacred and holy, I officially declare that I am finished -- finished -- with the JAI. Every time I decide to use the JAI to accomplish some image processing, because it's from Sun and because it has some filters and operations I'd like to use, it's a complete pain in the ass. Everything is opaque. You can't tell whether an operation is going to barf because it doesn't like the image you passed it, or not barf and just take hours to crunch through. The way the whole API is structured, it looks like it was written by a space alien from Mars. If you want to play nice and define a new operation for JAI, forget it. Eating glass is more fun.

Now, C has two very good and very high-quality image processing libraries: Leptonica, and OpenCV. I've used them, but only with very brief, tiny programs, because the day I move to C because Java doesn't have a good image processing library is the day I shoot myself right in the face, because that's what going to C from Java is like. Shooting yourself in the face. You C programmers, don't complain. Program in Java for ten years, then go back to C and tell me it doesn't make you feel exactly like popping a cap in your head, just to quiet that insane gibbering in the back of your skull that results from too many pointers, pointers to pointers, and templates. I'd rather learn a weird language like Erlang just to avoid having to use C for anything serious.

So fuck you, JAI, I'm through with you. Take your rendered ops and JAI registry files and go running back to your new daddy, Oracle, you filthy mutated whatever the hell you are.

Where the hell is the aspirin.
The Singularity is Near. ~ http://halfbakedmaker.org ~ Follow me as I build the world's first all-mechanical steam-powered computer.
steve1066d
Posts: 296
Joined: 27 Nov 2010, 02:26
E-book readers owned: PRS-505
Number of books owned: 1250
Location: Minneapolis, MN
Contact:

Re: I hate the Java Advanced Imaging API

Post by steve1066d »

Yep, the JAI is proof that you shouldn't code by committee.

Though its so promising.. when it works, its great (once you get past the weird syntax).

But yeah, when it doesn't work, you've got no clue why.
Steve Devore
BookScanWizard, a flexible book post-processor.
Anonymous1

Re: I hate the Java Advanced Imaging API

Post by Anonymous1 »

Soo, any alternatives?
User avatar
rob
Posts: 773
Joined: 03 Jun 2009, 13:50
E-book readers owned: iRex iLiad, Kindle 2
Number of books owned: 4000
Country: United States
Location: Maryland, United States
Contact:

Re: I hate the Java Advanced Imaging API

Post by rob »

Well, I wrote a partial port of Leptonica, bug-for-bug compatible. But I have no plans to complete the port. I haven't evaluated any of these (but I really need to):

ImageJ (but it's an app, not a library?)
im4java (Java interface to ImageMagick API)
Java OpenCV (partial Java port of OpenCV)
JavaCV (Java interface to OpenCV) <-- this may hold the most promise
The Singularity is Near. ~ http://halfbakedmaker.org ~ Follow me as I build the world's first all-mechanical steam-powered computer.
Anonymous1

Re: I hate the Java Advanced Imaging API

Post by Anonymous1 »

I hope there are Python versions of these... I've used OpenCV for a page turn-detector (it's functional ;)) webcam, and it has tons of useful stuff.

I would suggest OpenCV. I was looking at the blob detection, as I am taking a stab at content-detection algorithms myself (just to crop out the useless junk in a page). Good luck, as OpenCV has tons of documentation for C++ and C#, but barely a complete script for Python (I'm not sure about Java either).
User avatar
rob
Posts: 773
Joined: 03 Jun 2009, 13:50
E-book readers owned: iRex iLiad, Kindle 2
Number of books owned: 4000
Country: United States
Location: Maryland, United States
Contact:

Re: I hate the Java Advanced Imaging API

Post by rob »

I'm pretty sure OpenCV has python bindings. I know that the MacPorts version of OpenCV has an option where you can select python bindings. Usually the bindings are straightforward ports of the native API, so lack of documentation shouldn't be a problem...
The Singularity is Near. ~ http://halfbakedmaker.org ~ Follow me as I build the world's first all-mechanical steam-powered computer.
Anonymous1

Re: I hate the Java Advanced Imaging API

Post by Anonymous1 »

I actually used OpenCV's Python bindings for that application, and for a first-time CV user, it was like hell. There were tons of vague errors, strange new variable types that were unique to OpenCV, and other random things. In the end, though, it was worth it ;)
User avatar
rob
Posts: 773
Joined: 03 Jun 2009, 13:50
E-book readers owned: iRex iLiad, Kindle 2
Number of books owned: 4000
Country: United States
Location: Maryland, United States
Contact:

Re: I hate the Java Advanced Imaging API

Post by rob »

So I tried JavaCV and threw it out because it required OpenCV 2.1, and OpenCV is already on 2.2. Even with OpenCV 2.1, the program would run properly once, then crash a few times, then run again. So screw it -- I'll write a very small very carefully written C program.
The Singularity is Near. ~ http://halfbakedmaker.org ~ Follow me as I build the world's first all-mechanical steam-powered computer.
User avatar
daniel_reetz
Posts: 2812
Joined: 03 Jun 2009, 13:56
E-book readers owned: Used to have a PRS-500
Number of books owned: 600
Country: United States
Contact:

Re: I hate the Java Advanced Imaging API

Post by daniel_reetz »

I hate to say it, Rob, but when you're angry, you write such funny copy that I *almost* wish you weren't such a calm, collected dude...
User avatar
rob
Posts: 773
Joined: 03 Jun 2009, 13:50
E-book readers owned: iRex iLiad, Kindle 2
Number of books owned: 4000
Country: United States
Location: Maryland, United States
Contact:

Re: I hate the Java Advanced Imaging API

Post by rob »

Ha ha, that's because it's a coping mechanism. When I'm hungry, I get loopy, and when I'm angry, I get (humorously) sarcastic. I've tried to tap into my inner violent criminal at other times, but he's elusive when he's in hiding.

Perhaps I'm a cat. Hungry cats are cute, while angry cats are sometimes funny (and sharp).
The Singularity is Near. ~ http://halfbakedmaker.org ~ Follow me as I build the world's first all-mechanical steam-powered computer.
Post Reply