Got an hour-long video and not really into manually creating subtitles? not plans to put it on YouTube for their automated transcription services? then – try Google Cloud Speech-to-Text! In this post I’ll share some scripts for automating the process and creating an .str
file to go along your video for displaying the subtitles.
Category: video
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.
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:
- http://stackoverflow.com/questions/33151244/implement-tap-to-focus-in-camera2-api
- http://stackoverflow.com/questions/41649691/android-camera2-api-touch-to-focus-example
- http://stackoverflow.com/questions/34681903/android-camera2-touch-to-focus-implementation-cancelling-on-new-touch
- http://stackoverflow.com/questions/39850590/android-camera2-tap-to-focus
- https://www.reddit.com/r/androiddev/comments/3mpa90/camera2_touch_focus/
Finally I was able to do it by myself this way:
Enjoy
Roy
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:
Enjoy!
Roy
Sharing a small libjpeg snippet.
Some SO questions about it have only partial snippets:
- http://stackoverflow.com/questions/16390783/how-to-save-yuyv-raw-data-to-jpeg-using-libjpeg
- http://stackoverflow.com/questions/17029136/weird-image-while-trying-to-compress-yuv-image-to-jpeg-using-libjpeg
- http://stackoverflow.com/questions/19282402/how-to-compress-a-yuyv-image-into-a-jpeg
Enjoy!
Roy
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.
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.
The major problems I recognize with getting a working AR from OpenCV’s intrinsic and extrinsic camera parameters are their translation to OpenGL. I saw a whole lot of solutions online, and I contributed from my own experience a while back, so I want to reiterate here again in the context of libQGLViewer, with a couple extra tips.
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! :).
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).
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.