max grosse

2009-08-30 14:05
I started to re-implement (that is: copy) automatic panorama creation like described here. Instead of the patented SIFT however, I am using the free(?) SURF.

For now, I rely on OpenCV for almost all of the common algorithms, which appears to work very well. Nevertheless cvFindHomography showed to be as tricky as usual - at least in version 1.1.

The image below shows my first results. Obviously, there is still a lot to do but i am already quite surprised by the high speed and good quality.
2009-08-30 14:04
There is are three popular functions in Adobe® Photoshop® called Auto Contrast, Auto Tone and Auto Color. I have to admit that I haven't done any real research on how the underlying algorithms work, I rather played around a bit with them and here is an idea on how you can achieve similar results:

- Calculate histogram of input image
- Find color values where about 99% of all pixels lie above
- Find another color value where about 99% of all pixels lie below
- Normalize all color values within those two boundaries

The difference between Auto Contrast and Auto Tone are on how this algorithm is applied to multiple channels. If the boundaries are determined globally, that is over all channels, it results in an Auto Contrast behavior, while performing the same task for each color channel independently it results in an Auto Tone behavior.

You can also achieve similar results by using histogram equalization, nevertheless the algorithm described above appears to be closer to the original Photoshop behavior.

An example of my own Auto Tone is shown below.

UPDATE Just noticed that the described approach is also referred to as Min-max linear stretch gray level mapping.
2009-07-01 16:04

Using OpenCV (with python) I wrote a little AR application that uses only some basic OpenCV functionality. I did this mainly to get a slight idea on the quality of my calibrated intrinsic and, of course, for the fun of it. If I get this more clean and stable I will add the source code here. Maybe together with my great intrinsic video camera calibration tool.

Thanks to this little script, I have noted the incredible high importance of the accuracy of the camera's intrinsic for the quality and accuracy of the calculated extrinsic. While this might be somehow obvious, it is still quite impressive. Calibrating the camera's intrinsic over and over again until I have reached an acceptable level of accuracy, I have been able to reduce the square error (present in the main project I am workin on) by a factor of almost 7, together with good undistortion I even reach a total factor of 70.

As cvFindChessboardCorners does not appear to be very robust or fast, it is still quite nice to use it for this kind of fun - without needing those annoying libraries like ARTag or ARToolkit (which, nevertheless, have their moments, of course).
2009-05-13 16:34

Homographies are really useful. Often I need to take pictures of a projection onto a surface and usually this results in some perspective distortion. Using cvFindHomography, giving 'control points', a homography can be calculated and then the image can be rectified using that homography with cvWarpPerspective.

I have written two small python scripts. find_homography to interactively select four points that should result in a rectangle and then calculating and saving the homography matrix to a file. Because I usually need some batch processing, I have also written a small script warp_homography to warp a whole series of input images using the same given homography matrix.
2009-05-06 00:52
Altough gdb is not a real low-level debugger, it has some quite interesting low-level functionality.

(gdb) dump binary memory dump.raw 0x00800000 0x01000000

Dumps the memory of the currently debugged application into a file 'dump.raw' from address 0x00800000 to address 0x01000000.

Now, this file can be searched, processed or even modified using external tools. If desired, using the command restore it can be loaded back into the memory.

Interesting regions to dump and inspect can be found using tools like vmmap (on MacOS X). You will be probably most interested in MALLOC_* regions.
2009-05-05 00:12
Inverting an image in OpenCV is quite easy. No need to mess around with pointers. Actually, it can be done in a single line, with a single instruction:

1 cvXorS(input, cvScalar(255), output)

Ok, this obviously wont work for floating point images.

As some readers have pointed out, however, exactly the same can be achieved using cvNot. I do not know why I've proposed the XOR solution, possibly I've been unaware of the fact that cvNot is indeed the bit-wise complement and thus equivalent to an XOR with 255.

An anonymous reader suggested the following snipplet to get the classic color-inverted look

1 IplImage *src=cvLoadImage("img.png",1);
2 IplImage *src_yuv=cvCreateImage(cvGetSize(src),IPL_DEPTH_8U,3);
3 IplImage *dst=cvCreateImage(cvGetSize(src),IPL_DEPTH_8U,3);
4 cvCvtColor(src,src_yuv,CV_BGR2YCrCb);
5 cvNot(src_yuv,dst);
6 cvCvtColor(dst,src,CV_YCrCb2BGR);
7 cvSaveImage("negative.png",src);

<< newer posts older posts >>