CalcOpticalFlowLK camera motion c++ - c++

this time i would know how can i calculate for each frame the camera motion in term of x and y pixel coordinates, i've googled and i've found that CalcOpticalFlowLK can do this.
I'm not expert in opencv and i'm asking your help!
Thank you all!

Yes OpenCV can do this. You should follow the tutorials on the site below to start and then attempt the CalcOpticalFlowLK implementation yourself. If you get stuck post your specific problem here (with a code sample) and I'd be glad to help.
http://opencv-srf.blogspot.ie/2010/09/opencv-basics.html
Then Look at
OpenCV tracking using optical flow

Related

Hand rectangle detection with OpenPose

I'm using openpose, and I have no clue of how to start this task.
I need to draw a rectangle over the people's hand (not the pose of the fingers, just the rectangle), using the skeleton estimation that open pose provides, but I don't really have experience with this framework, and I'm having a hard time understanding the openpose code, so I don't know if somebody could give any advice or clue about how to achieve this task, might be with the right direction I could get it done.
Any comment is welcome, thanks in advance for any help.
It is not easy to start at first, you should read more from the dlib home page before starting. After that you could follow my below suggestion to achieve your desire.
Download the source code from github Dlib on github
Implement by the function void work(TDatums& tDatums) in the file /include/openpose/pose/wPoseExtractor.hpp
Get the keypoints and image as below code
auto &ProceedData = (*tDatums)[0];
Array keypoints = ProceedData.poseKeypoints;
Mat proceedImage = ProceedData.cvOutputData;
You can draw your own image.

Kalman Filter Tracking using given X,Y of the object in Opencv C++

I'm new to Kalman tracking so I've got no idea how to start. I have program to detect faces, after a face has been detected, i want to send the center x.y of the face to the Kalman filter to draw a line showing the direction of movement. How do i start? Thanks in advance.
You will need to understand the math for formulating the problem, the link offered by William is good place to experiment with the code. If you want to follow the math there are a few good places to check:
http://home.hit.no/~hansha/documents/control/theory/kalmanfilter.pdf
http://www.cl.cam.ac.uk/~rmf25/papers/Understanding%20the%20Basis%20of%20the%20Kalman%20Filter.pdf
http://old.shahed.ac.ir/references/kalman_filter_notes.pdf
and ofcourse
http://en.wikipedia.org/wiki/Kalman_filter
has some excellent references to go through. Also...
Check out the Udacity course:
https://www.udacity.com/course/cs373
This has a section on Kalman filters programming using python.

Real time Object detection: where to learn?

I am working with opencv these days and I am capable of doing 99% of stuff explained in opencv official tutorials. And I managed to do motion tracking manually with background substraction, where some users claimed as impossible.
However, right now I am working with object detection, where I need to track the hand and want to find whether the hand is moved to left or right. Can this be done by following steps? (used in motion detection)
Get camera 2 instances of camera video (real time)
blur it to reduce noise
theresold it to find hand (or leave it if blur is enough)
find the absolute deference between 2 images
Get PSR
find pixel position of motion
However, it seems like it is not 100% same as motion detection, because I read some stuff about Kalman Filter, Block-matching, etc which I did not use in motion detection. However, I found this tutorial
http://homepages.cae.wisc.edu/~ece734/project/s06/lintangwuReport.pdf
But, I really need your advice. Is there any tutorial which teach me how to do this? I am interested in learning core theory with opencv explanation (c++).
Since I am not good at maths( I am working on it - I didnt go to the university , they found me and invited me to join the final year for free because of my programming skills, so I missed math) , full of math stuff will not work.
Please help. Thank you.

Which algorithm can I use for quadrilater/cube detection?

For a project, I have to detect a cube with a webcam. I think that OpenCV could be a good solution to find out where is it (real-time).
I'm new in the computer vision domain, and I wonder which algo can I use ? Hough ?
I've seen this video (quite impressive!): http://www.youtube.com/watch?v=ytvO2dijZ7A
Do you know how he was able to do it ?
Thank you a lot for your help
To get the result as in the video, you have given, you can use squares.cpp that comes with OpenCV samples. (It is for images. Hope you can do it for videos.)
Other useful SO on this topic are:
1) OpenCV C++/Obj-C: Detecting a sheet of paper / Square Detection
2) Square detection doesn't find squares

Rotating an image in C/C++

I need code for rotating an image in C++ which functions like imrotate function of matlab.
Please suggest a good link. Or if someone can provide the code for imrotate.
Or at least please explain the algorithm.
Its not a homework. I need this code for my project. And we can use any external library or code.
OpenCV2.0 has several computer vision and image processing tools. Specifically warpAffine (by defining the rotation matrix) will solve your problem with rotating an image.
The 2x3 transformation matrix mentioned in the documentation is as follows:
where θ is the angle of rotation and tx and ty is the translation along the x and y axes respectively.
You can get the source code here.
Also, OpenCV2.0 has many MATLAB-esque functions like imread, etc.
Magick can help you. Read this PDF and search for rotate.
Check this hope it helps .
Other questions on stack overflow on the same topic experts opinion on it.
libgd has image rotation functions.
There is no built-in way of accomplishing this in C++, short of writing your own function for manipulating binary data, which yields other problems like "How do I decompress a jpg/png in C++?"
Your best bet is a 3rd party graphics library such as libSDL