First let me open by saying projector-camera calibration is NOT EASY. But it's technically not complicated too.
It is however, an amalgamation of optimizations that accrue and accumulate error with each step, so that the end product is not far from a random guess.
So 3D reconstructions I was able to get from my calibrated pro-cam were just a distorted mess of points.
Nevertheless, here come the deets.
Continue reading "Projector-Camera Calibration - the "easy" way"
Man Camera2 APIs are hard to master...
I've scanned SO for a way to get touch-to-focus to work on Android and could not find a solution that works.
These were very partial, or provided only scaffold code which I couldn't use:
Finally I was able to do it by myself this way:
I tried to set the capture format on a webcam from OpenCV's cv2.VideoCapture and ran into a problem: it's using the wrong IOCTL command.
So I used python-v4l2capture to get images from the device, which allows more control.
Here is the gist:
Sharing a small libjpeg snippet.
Some SO questions about it have only partial snippets:
Years ago I wanted to implement PTAM. I was young and naïve 🙂
Well I got a few moments to spare on a recent sleepless night, and I set out to implement the basic bootstrapping step of initializing a map with a planar object - no known markers needed, and then tracking it for augmented reality purposes.
Continue reading "Bootstrapping planar AR and tracking without markers [w/code]"
You already know I love libQGLViewer. So here a snippet on how to do AR in a QGLViewer widget. It only requires a couple of tweaks/overloads to the plain vanilla widget setup (using the matrices properly, disable the mouse binding) and it works.
Continue reading "Augmented Reality on libQGLViewer and OpenCV-OpenGL tips [w/code]"
Just sharing a simple recipe for a video stabilizer in OpenCV based on goodFeaturesToTrack() and calcOpticalFlowPyrLK().
Well... it's a bit more than 20 lines, but it is short. And it doesn't work for every kind of video (although the results are funny anyway! :).
Continue reading "Simplest 20-lines OpenCV video stabilizer [w/ code]"
I wish to report of a number of tweaks and additions to the hand silhouette tracker I posted a while back. First is the ability for it to "snap" to the object using a simple Active Snake method, another is a more advanced resampling technique (the older tracker always resampled after every frame), and of a number of optimizations to increase the speed (tracker now runs at real-time on a single core).
Continue reading "Extending the hand tracker with snakes and optimizations [w/ code, OpenCV]"
For those of you using OpenCV that are looking to upgrade from OpenNI 1.x to the new OpenNI 2.x, here's a bit of code to make life a tiny bit easier. It simply wraps the OpenNI 2.x APIs to expose a simple frame grabber for OpenCV.
Continue reading "OpenNI 2.x and OpenCV interoperability [w/ code]"
So animated gifs are awesome if you're writing a software blog. It saves all this time working with YouTube embeddings and stuff, and your "videos" are stored locally. The simplified FFMPEG writer was before unable to output animated GIFs, but I've tweaked it and now it does. It's also a nice piece of code to learn how to FFMPEG in C.
Continue reading "FFMPEG video writer - now with animated GIF support [w/ code]"