Implementation of vanishing point algorithm using opencv - opencv

I am trying to make an ARDRONE(a quadrotor) to navigate trhough a maze.
I am using ROS-ELECTRIC and OPENCV. I have implemented hough line transfrom. I need to implement the vanishing point algortihm to make the robot navigate autonomously. I am new to opencv . Could you guys please suggest the approach to attain the vanishing point? and also will it serve the purpose of navigating the robot through a maze and find the target?
thank you

You can check this http://marcosnieto.net/#PhD in the code.
OpenCV implementation based on the author's PhD thesis.
It works for me, but up to 2 vanishing point in my test.

Related

Visual Odometry (aka. Egomotion estimation) with OpenCV

I'm planning to implement an application with augmented reality features. For one of the features I need an egomotion estimation. Only the camera is moving, in a space with fixed objects (nothing or only small parts will be moving, so that they might be ignored).
So I searched and read a lot and stumbled upon OpenCV. Wikipedia explicitly states that it could be used for egomotion. But I cannot find any documentation about it.
Do I need to implement the egomotion algorithm by myself with OpenCV's object detection methods? (I think it would be very complex, because objects will move in different speed depending on their distance to the camera. And I also need to regard rotations.)
If so, where should I start? Is there a good code example for a Kanade–Lucas–Tomasi feature tracker with support for scaling and rotation?
P.S.: I also know about marker based frameworks like vuforia, but using a marker is something I would like to prevent, as it restricts the possible view points.
Update 2013-01-08: I learned that Egomotion Estimation is better known as Visual Odometry. So I updated the title.
You can find a good implementation of monocular visual odometry based on optical flow here.
It's coded using emgucv (C# opencv wrapper) but you will find no issues on convert it back to pure opencv.
Egomotion (or visual odometry) is usually based on optical flow, and OpenCv has some motion analysis and object tracking functions for computing optical flow (in conjunction with a feature detector like cvGoodFeaturesToTrack()).
This example might be of use.
Not a complete solution, but might at least get you going in the right direction.

Logo detection using OpenCV

I'm attempting to implement an easter egg in a mobile app I'm working on. These easter egg will be triggered when a logo is detected in the camera view. The logo I'm trying to detect is this one: .
I'm not quite sure what the best way to approach this is as I'm pretty new to computer vision. I'm currently finding horizontal edges using the Canny algorithm. I then find line segments using the probabilistic Hough transform. The output of this looks as follows (blue lines represent the line segments detected by the probabilistic Hough transform):
The next step I was going to take would be to look for a group of around 24 lines (fitting within a nearly square rectangle), each line would have to be approximately the same length. I'd use these two signals to indicate the potential presence of the logo. I realise that this is probably a very naive approach and would welcome suggestions as to how to better detect this logo in a more reliable manner?
Thanks
You may want to go with SIFT using Rob Hess' SIFT Library. It's using OpenCV and also pretty fast. I guess that easier than your current way of approaching the logo detection :)
Try also looking for SURF, which claims to be faster & robuster than SIFT. This Feature Detection tutorial will help you.
You may just want to use LogoGrab's technology. It's the best out there and offers all sorts of APIs (both mobile and HTTP). http://www.logograb.com/technologyteam/
I'm not quite sure if you would find such features in the logo to go with a SIFT/SURF approach. As an alternative you can try training a Haar-like feature classifier and use it for detecting the logo, just like opencv does for face detection.
You could also try the Tensorflow's object detection API here:
https://github.com/tensorflow/models/tree/master/research/object_detection
The good thing about this API is that it contains State-of-the-art models in Object Detection & Classification. These models that tensorflow provide are free to train and some of them promise quite astonishing results. I have already trained a model for the company I am working on, that does quite amazing job in LOGO detection from Images & Video Streams. You can check more about my work here:
https://github.com/kochlisGit/LogoLens

Hand sign detection

I am trying to identify static hand signs. Confused with the libraries and algorithms I can use for the project.
What need to it identify hand signs and convert in to text. I managed to get the hand contour.
Can you please tell me what is the best method to classify hand signs.
Is it haar classifier, adaboost classifier, convex hull, orientation histograms, SVM, shift algorithm, or any thing else.
And also pls give me some examples as well.
I tried opencv and emugcv both for image processing. what is best c++ or c# for a real time system.
Any help is highly appreciated.
Thanks
I have implemented a handtracking for web applications in my master deggree. Basically, you should follow those steps:
1 - Detect features of skin color in a Region of Interest. Basically, put a frame in the screen and ask for the user put the hand.
2 - You should have a implementation of a lucas kanade tracker method. Basically, this alghorithm will ensure that your features are not lost through the frames.
3 - Try get more features for each 3 frames interval.
The people use many approaches, so I cannot give a unique. You could make some research using Google Scholar and use the keywords "hand sign", "recognition" and "detection".
Maybe you find some code with the help of Google. An example, the HandVu: http://www.movesinstitute.org/~kolsch/HandVu/HandVu.html
The haar classifier (method of Viola-Jones) help to detect hand, not to recognize them.
Good luck in your research!
I have made the following with OpenCV. Algorithm:
Skin detection made in HSV
Thinning (if pixel has zero neighbor than set zero)
Thicking (if pixel has neighbor nonzero then set it nonzero)
See this Wikipedia page for the details of these.
You can find the best trained cascade to detect hand using OpenCV from the GitHub...
https://github.com/Aravindlivewire/Opencv/blob/master/haarcascade/aGest.xml
Good luck...

Optical Flow vs. Haar Cascade

intend to programme navigating an iPad App with head motions (originally hand motions, but hands seem to difficult to detect at the moment): left, right, up and down. So I plan to use openCV and either detect the optical flow of the head area, or detect the ears and head of the user with haar cascades (openCV is delivered with quite precise head and ear xmls). Can anyone offer some advice on which solution to use? Will one of the mentioned need more power? Ear and head detection might be easier to programme? I would like to avoid to much effort in the wrong direction and don't have much expertise in my current surroundings...
thank you for any help, advice, ideas!
I would suggest to use Haar cascades because optical flow is more expensive in computing time!
Is using the native face detection in iOS 5 not an option for what you want?
I'm thinking outside the box here, but I've been with OpenCV before and it still hurts..
http://maniacdev.com/2011/11/tutorial-easy-face-detection-with-core-image-in-ios-5/
*The idea of course, being that you apply this to live input somehow
One way could be using Hidden Markov Models. There is a lot of research material(working prototypes) on how to use HMMs to recognize head gestures.
I believe ear haar classifiers are not that effective with cluttered background. Please let us know if you've got it to work!

OpenCV based Labyrinth Maze solver

I am building an automatic maze solver using the following as an inspiration:
http://www.youtube.com/watch?v=Prq78ctJ2Rk&feature=related
I have built the maze control with steppers and I am using the following stepper motor control board:
http://www.sparkfun.com/products/10025
I am using a vision system to control the maze solver. I also found a link where this problem has been solved:
http://cse.logicol.org/?p=52
They have used template matching to identify the ball. The team mentioned in the above link also uploaded a video where it looks like they have canny edge detection for finding the path and executing a PID algorithm.
http://www.youtube.com/watch?v=8b5ARjT22bg&feature=player_embedded
Now, I have also established template matching and edge detection in opencv. I have also established controls of my stepper via USB serial port. How do I implement the navigation algorithm? How do I implement the PID control? I know the concept of PID control theoretically but I just don't know to implement it using the information from the camera. I am just clueless about making the ball follow the line.
Please find an attached image of the result I have obtained so far.
Sai
I didn't quite understand your question but If you ask what commands give to the ballgiven its position here is my guess:
1. you find the location of the ball.
2. you have the line of the desired path drown on the board and detected
using canny.
3. Find the closest point to the ball which is on the path line. If
it was a straight line then the calculation is simple geometrical
formulae dist(point,line). Let us call the result D.
4. The resulting point on the line is where the ball should be.
5. Advance distance D along the path line. This would give you your
destination point.
6. Subtract ball coordinates from destination point, and then, using atan2()
method to calculate in which direction to move the ball.
7. Activate motores to tilt board in that direction.
Clarification to step 5. Why did I say to advance distance D along the path? Because thus you direct the ball in at most 45 degrees of the path line. This gives you relatively smooth motor movement.
If I didnt understand your question please tell me and I will correct my answer

Resources