What will be the best to parse x264 bitstream for extracting motion vectors information? - video-encoding

What will be the best way to parse x264 bitstream for extracting motion vectors information?

get a JM, find the place where the MV are being read from the bitstream, add the predictors and there you go.

I'm look for this too. Someone wrote an example.
http://victor.csie.org/blog/archives/362
Probably not the best, at least it works.

Related

Is there a more efficient compression algorithm than gzip?

I'd like to compress my files as much as possible. For this I've been compressing all my files to .tgz format, which yeilds really promising results. However is there something even better than this?
Gzip is a program, not algorithm. Algorithm is Deflate (based on LZ77).
You may want to look at LZMA algorithm (or, if you're seeking software to use, xz).
You can try PPM for text. Lzma is also good. For example Freearc its a very good and fast and free frontend and backend compressor.

Correlation audio opencv

I guess use of opencv correlation, I need to know if a piece of an audio file is inside another audio file, can anyone tell me how I could proceed?
Or another solution?
Thanks Guys
Correlation might be the right tool for the job if the problem you are trying to solve is checking for the occurrence of an exact section of one file in another. However, if the following are true you will need another solution:
You intend searching a corpus (e.g. a database of files) for occurrences [Scales badly]
The audio has been processed (e.g. stretched, compressed) [correlation not particularly robust]
The usual way of solving this problem is with Feature Extraction and feature matching algorithms. Whilst OpenCV provides examples of both of these types of algorithms for image processing, it is probably not the weapon of choice for audio.

Haarcascades in opencv

I have seen multiple haarcascade xmls in opencv for face detection, eye detection , ear detection, Human body detection etc., But couldnt see proper documentation or explanation for these xmls.
For example in a application if I need to detect side faces which xml should I use and what are the parameters to be passed for detectMultiScale?
In some cases if I vary the parameters to detectMultiScale the false detections get reduced, but I did all the tests with trial and error method. I couldnt find any definite articles on explaining the use of each xml and parameters.
Can some one provide the documents on this if any, else some explanation on this would be grateful.
OpenCV has a built-in profile face classifier xml under "..\data\haarcascades". If you want to create your own cascade classifier, you should follow this procedure. Here is another link regarding that.
To learn about the detectMultiScale method, check out the documentation. To understand the how the classifier and its parameters work, check out the viola-jones (2001) article or its explanation.
Here is a paper by Vadim Pisarevsky, one of the OpenCV developers, which may be helpful, in understanding some of the parameters.
On the other hand, if using OpenCV is not a hard requirement, please take a look at vision.CascadeObjectDetector in the Computer Vision System Toolbox for Matlab, which provides the same functionality. It also saves you the trouble of figuring out which xml file to use for profile faces.

how modify haarcascade_frontalface_alt.xml?

I am new in opencv and I want to work on face detection methods. I have understand that one of the best methods is by haar features. I know some functions in opencv library for detection faces and training.
can any one help me to understand how haarcascade_frontalface_alt.xml is made?
and how can I modify this file?
thanks a lot for your help.
First read this:
http://docs.opencv.org/doc/user_guide/ug_traincascade.html
followed by:
http://note.sonots.com/SciSoftware/haartraining.html
http://opencvuser.blogspot.in/2011/08/creating-haar-cascade-classifier-aka.html
http://achuwilson.wordpress.com/2011/07/01/create-your-own-haar-classifier-for-detecting-objects-in-opencv/
Start with good training data.
Cheers.

OpenCV detect numbers

I'm using OpenCV on the iPhone and need to detect numbers in an image. I split the image into smaller images so each image has only one number (1-9). All numbers are printed, NOT handwritten.
What would be the best approach to figure out the numbers with OpenCV?
UPDATE:
I have successfully found the numbers and extracted them. They look like this:
http://img198.imageshack.us/img198/5671/101ht.jpg
http://img824.imageshack.us/img824/539/606yu.jpg
When they are extracted they are in the same size and so on. I have saved a bunch of images and put them in a OCR dir where they are categorized into numbers. Like: ocr/1/100.jpg 101.jpg.... and ocr/2/200.jpg 201.jpg....
Then I was going to use the same approach as in the Basic OCR tutorial:http://blog.damiles.com/?p=93
However, I'm programming for iPhone and can't use C++ code (error on compiling and so on) and I don't have access to highgui.
I tried using cvMatchTemplate() and match a bunch of images but it seems to work pretty bad...
Any other ideas I can try?
You could start by reading about Principal Component Analysis (PCA), Fisher's Linear Discriminant Analysis (LDA), and Support Vector Machines (SVMs). These are classification methods that are extremely useful for OCR, and there are libraries in any language including C++, Python, C# etc.
It turns out that OpenCV already includes excellent implementations on PCAs and SVMs[dead link]. I haven't seen any OpenCV code examples for OCR, but you can use some modified version of face classification to perform character classification. An excellent resource for face recognition code for OpenCV is this website[dead link].
If the numbers are printed, the job is quite simple, you just need to figure out a nice set of features to match. If the numbers are one font, you can get away with this approach:
Extract the number
Find the bounding box
Scale the image down to something like 10x8, try to match the aspect ratio
Do this for a small training set, take the 'average' image for each number
For new images, follow the steps above, but the last is just a absolute image difference with each of the number-templates. Then take the sum of the differences (pixels in the difference image). The one with the minimum is your number.
All above are basic OpenCV operations.
Basically your problem is just to classify a feature vector, which is the set of pixel intensities after some preprocessing steps. You can use any classifier for this task, like eg. neural networks, which should have a C implementation inside OpenCV. You might also try a C libsvm library for Support Vector Machines.
There is a good site related to this problem with a lot of papers and a training database.
Maybe the most simple and convinient way is to use svm as ml algorithm
http://opencv.willowgarage.com/documentation/cpp/support_vector_machines.html
and gray images as feature vectors.
Objective C++?
Try renaming your .m files to .mm and you can then use c++ in your iPhone project.
Convolution Neural Networks are by far the best algorithms for hand written digits. The are implemented in most systems like USPS etc. Here are few papers explaining the algorithms.
http://yann.lecun.com/exdb/lenet/
This is a nice open source ,It is a ORCDemo on iPhone.Hope it is useful to you
Simple Digit Recognition OCR in OpenCV-Python
This might help you out. Converting the code from Python to C++ is not a difficult task, since OpenCV API's are same for the both.
Tesseract is also a nice free OCR engine that is readily available for iPhone and allows you to use your own sets of training images:
http://tinsuke.wordpress.com/2011/11/01/how-to-compile-and-use-tesseract-3-01-on-ios-sdk-5/
HOG + SVM (Try to play with kernels)

Resources