Ask Your Question

how to recognize a zebra crossing from top view using opencv ??

asked 2012-12-26 07:47:40 -0600

vijay gravatar image

updated 2012-12-26 10:33:25 -0600

ou can get all the details about the problem from this pdf document:

how to recognize a zebra crossing from top view using opencv ?? it is not a straight zebra crossing it has some twists and turns i have some ideas, 1. parallel line detection but the available techniques only works to find straight parallel not the ones that has curve in it. 2. template matching to match a template of back to back white and black stripes but it becomes tedious since i cant find any pattern matching techniques with scaling and rotation.

in fact a idea on any single part of the problem will be so helpful! it is driving me crazy someone please help!!!! any help is appreciated thanks in advance ....

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2012-12-27 00:53:40 -0600

Michael Burdinov gravatar image

updated 2012-12-27 00:56:21 -0600

Detection of white strips on zebra crossing is much easier than detection of general object. It has no internal edges. And It clearly distinguished from its surrounding. I think simplest way for detection will be application of Canny for detection of edges. Then you can use findContours on result of edge detection in order to find all contours in image. As a last step filter all contour that do not resemble rectangular white strips.

edit flag offensive delete link more


if you want use the canny algorithm in the outdoor condition you will need to estimate the threshold1 & threshold2 for canny algorithm in different lighting condition by neural network(train process).

Mostafa Sataki gravatar imageMostafa Sataki ( 2012-12-27 04:18:22 -0600 )edit

There really huge amount of approaches for automatic threshold detection. I once saw a survey that mentioned ~300 different methods. Personally I don't really like neural networks because they are complicate, relativelly slow and require learning. My favorite method is: 1 - calculate gradients in X and Y directions (Sobel), 2 - calculate gradient magnitude in each pixel, 3 - set lower threshold to be average gradient, and higher threshold to be average + standard deviation.

Michael Burdinov gravatar imageMichael Burdinov ( 2012-12-27 05:43:14 -0600 )edit

thank you @michael i have already done that but the problem is the stripes are not exactly rectangle it will be like oval white stripes on black background path any idea on that ie. how to find shapes that are slightly oval ?? see that pdf document for image of the crossing!!

vijay gravatar imagevijay ( 2012-12-27 07:33:53 -0600 )edit

Extracting contours will never give you exact rectangle even for rectangular stripes. This is the world of natural images. So you should collect objects whose features are "acceptable". For example their average color is "acceptably" close to white. Or their area is "acceptably" close to expected area. Or the object covexity is "acceptable". Or proportions of minimum bounding rectangle are "acceptable". And so on. You would have to define what is "acceptable" according to real images that you may get in your application.

Michael Burdinov gravatar imageMichael Burdinov ( 2012-12-27 08:19:12 -0600 )edit

answered 2012-12-26 11:11:36 -0600

updated 2012-12-26 11:19:34 -0600

There are 3 common methods for compute of zebra orientation in blockwise mode.

1-It is possible to determine the frequency and the zebra orientation using FFT transform. Considering this characteristics, an image is divided in blocks of small size (e.g., 32x32).

2-The most simple and very common method used for zebra orientation extraction is based on gradient computation. Initially, the horizontal and vertical gradient are computed at each pixel using for example the sobel operator, then the image are divided in small blocks of size WxW (e.g., size 32x32) and computed the angle by analyzing the block.You can average the zebra orientation by this method.

3-The other method for zebra orientation extraction is based on eigen values & eigen vectors .It is given by the eigenvector having the highest eigenvalue.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2012-12-26 07:47:40 -0600

Seen: 3,458 times

Last updated: Dec 27 '12