Monday, April 27, 2009

Blur, sharpen, repeat

I added standard blur and sharpen functions to ImageProcessing today. The blur function uses standard Gaussian kernel convolution with the image. The sharp function employs an unsharp mask technique which uses the Gaussian blur function.

I'm not a big fan of Sourceforge, and I'm not entirely sure how they calculate project rankings, but mine has apparently climbed the ladder about 35000 steps to somewhere in the mid-2000s. Just in case this means people are interested in using/trying the library, I have re-prioritized project documentation as most important. You (meaning the 0 people who read this blog) should see at least javadocs in the next day or two.

Sunday, April 26, 2009

OpenJCV release 0.1

Seriously, this is an early release. For cereal. All the features work, documentation exists but is not uploaded to sourceforge, isn't there a better alternative to sourceforge (?), I'm working on a small user manual with howtos for some of the unavoidable complicated processes, I'm going to upload my GUI 'test' program which is chock full of examples, I need feedback to gauge the importance of upcoming features, I'm going to write in run-on sentences until the day I die.

Features list:
* geometry library
* matrix library
* some image processing
* managed GUI/windowing system
* video (webcam) streaming
* some computer vision techniques (edge detection, hough lines, etc.)

Cut the fat?

By trying to provide a int/float/double form of everything in the geometry package, it's become bloated. Everything can be a double, right? I may cut the fat, cut all the integer and float variants out of the package...

Tuesday, April 7, 2009

Geometry package

I started a geometry library in OpenJCV (the open java computer vision library, don't forget), to aid primarily in drawing shapes over images and streaming video. Initially, I created each class (point, line, ellipse, rectangle, etc) from scratch, using Java generics to allow for int, float, or double primitives.

However, the Java SDK provides implementations of some shape classes in the java.awt.geom.* package. For example, java.awt.geom.Line2D is an abstract class with implementations Line2D.Double and Line2D.Float. Are these worth extending? For now, I'm going to bet on 'yes'. It's a tough choice because I have no design reason for one way over the other. Also, I found no strong opinions about the subject anywhere Google can take me.

Saturday, April 4, 2009

Video capability complete

JcvVideo streams video from network locations. JcvWindowManager now manages windows which display both JcvImage and JcvVideo. To circumvent the JVM-hardware interface issues with video still not addressed in the latest Sun gem, JavaFX, I decided to accept only video available on the OpenJCV host computer's LAN. This way, I'm not going through the pain of addressing different pieces of hardware, and I'm not placing that hardship on the user.

However, users must stream their video to the network. Fortunately, programs of this nature are readily available for every platform. For Linux, I have been using 'webcam-server'. I will post options for Windows and Mac soon.

Tuesday, March 31, 2009

Image to BufferedImage conversion

For some reason, this seems to be a largely unsolved problem on the internet. Here's the short:

1) Image im = whatever...
2) BufferedImage bi = new BufferedImage(im.getWidth(null), im.getHeight(null), type);
3) Graphics g = bi.getGraphics();
4) g.drawImage(im, 0, 0, null);

There are plenty of optional details, of course, which check for transparent pixels, create a BufferedImage that is compliant with the target platform's graphics options, etc. These steps provide you with the critical path, and leave the details to exploratory choice.

Monday, March 30, 2009

webcam-server for linux

Building on my need to get webcam frames to OpenJCV in a faster than file IO manner, I apt-getted webcam-server. This program streams video from your webcam to http://localhost:8888 by default, with a few options for change.

There are some problems with initial startup:
1) webcam-server is not v4l2 compatible. So, type this into your terminal:
export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so

2) The supplied applet (/usr/share/doc/webcam-server/applet/) works from outside your LAN only if you change the URL in webcam.html to relfect your ip address.

References:
https://bugs.launchpad.net/ubuntu/+source/webcam-server/+bug/179932
http://www.eroticpenguin.com/content/streamin-video-sure-why-not

Now, the idea is to have Java capture images from the stream on my localhost...

Sunday, March 29, 2009

Hough Lines

I implemented a version of Hough Lines outlined in Trucco & Verri's Introductory Techniques for 3-D Computer Vision. The implementation looks cleaner than all of the popular Google searches on the topic. I also commented it heavily so the algorithm appears extremely transparent. I have not compared it to other algorithms in terms of Big-O complexity or sheer speed.

Saturday, March 28, 2009

Video woes in a JVM world

To aid in the development of OpenJCV's streaming video display capability, I am using a few low-cost webcams. Initially, I planned to use Java's JMF library, but it turns out many webcams do nut work with the library. Next, I turned to a JMF third-party, open-source spin-off called FMJ (surpassed on Google only by Wikipedia's definition for "Full metal jacket"). Admittedly, I only spent a night trying the library with my two webcams, but it didn't work.

What's the solution? Here are the two with which I'm OK:
1) Require the user to add, as an argument, the command for capturing an image from the desired camera. This assumes the user has a program to grab individual frames, store them somewhere on their computer, and manage access between the frame grabber and OpenJCV.
2) Create my own C++ frame grabber to do all of the above. This takes the pressure off the user, but makes things a little less platform independent-- I'll have to find out which platform the user has and do different things for each...

For now, I'm going to implement option 1. Later (6 months to a year), I'll implement option 2.

Tuesday, March 24, 2009

OpenJCV blag

OpenJCV, short for Open Java Computer Vision, is the Java-variant of the popular computer vision library OpenCV. This is the project blog.

The project, as of today, is in an alpha-ish state. Many planned features have not been implemented, though a few base features have been completely implemented and tested. Of course, there may be a few bugs I missed. Here's a brief list of some currently implemented features:
-2D matrices
-ND matrices
-image IO
-window management and image display
-sobel, laplace and canny edge detection

OpenJCV will eventually contain all the functionality of OpenCV and more, but that may take another year or two. Here are a few things to come in the very near future:
-documentation
-a downloadable library (jar)
-video display
-hough transform (lines only)
-histograms
-links to my sourceforge stuff from this blog

Furthermore, I am in need of feedback. What do you want now? What do you want later? Please alpha test and play around with the display functions and computer vision algorithms on different platforms. Send any questions/comments/hate/love to openjcv at hotmail.