Ask Your Question
0

Detecting an incoming bus in opencv?

asked 2014-10-23 05:03:39 -0600

Denson gravatar image

i want to detect an incoming bus(only specific 2 or 3 buses) and i just want to retrieve that frame if detected and use it for further processing. here as the incoming bus has to be detected(distance will matter) i am confused should i use classifiers like Haar or any other detectors based on SURF which i have come across. Will training a classifier be feasible for my purpose or using other methods for detection?

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
3

answered 2014-10-23 06:28:43 -0600

R.Saracchini gravatar image

Depending on the capture conditions and the buses which you want recognize. Some cases would be really difficult.

The simplest case would be a camera with fixed position pointing to a street, where said bus come facing the camera.

Preparing a recognition database:

  1. Obtain reference images from the buses with similar pose to the ones that you expect to see by such camera
  2. Train a classifier with its keypoints and descriptors.
  3. Separate the planar sections of each reference image (manually), and its respective sets of
    keypoints/descriptors
  4. (optional) Keep the real-world dimensions of such planar sections

A possible algorithm:

  1. Remove the background (street, trees)
  2. Segment non background objects(possible issues with occlusion)
  3. Detect keypoints and descriptors for each segmented object
  4. Use an classifier (SVM,Vocabulary Tree, etc) in order to verify if it is a bus
  5. Match the candidate object features with the features of the bus type determined by the classifier
  6. For each planar section, try to compute an homography with the matched features.
  7. If one or more homographies are consistent, you have detected the bus.

If you wish determine its distance (optional):

  1. Refine the matched features with some template matching approach
  2. If the refinement succeeds, use PnP with the matched points and their real-world dimensions, and determine its distance. (you will need a calibrated camera)

Of course, this will need a bit of tweaking, determine the best keypoint detector/feature descriptor, etc.

Note that if you have a mobile camera (smartphone, tablet, go pro, etc...), it is much more difficult, you will have to train the classifier with several poses from the buses. Things like background removal and determination of distances would be more difficult, if not impossible.

edit flag offensive delete link more
1

answered 2014-10-23 06:35:44 -0600

thdrksdfthmn gravatar image

I do not know what to say, only that you are saying that you need to detect a bus, this means you need a detector. You can start with a car detector (this may be a start, or other similar ones), see if it works, then just use the detection to create another one. I would suggest you a LBP (it is much faster than HAAR) and, maybe, a classifier (SVM). Anyway, you'll need a start and then you can create a more specialized detector.

I think this could be a good approach:

  1. Detect the bus.
  2. Search for those 2-3 buses that you want (maybe defining an area of searching the number of the bus and verify if it is the wanted bus)
  3. Use the frame (or even the detected bus), for further processing

About "incoming":

  • maybe you will need to detect the front of the bus only
  • or you will need to use the position for saying if it is arriving or leaving; but I assume that the bus will not get close (so you can detect it) and then just go backwards...
edit flag offensive delete link more
-1

answered 2014-10-23 06:41:22 -0600

Goosebumps gravatar image

How about this: 1. Find rectangles that have an aspect ratio roughly that of a licence plate. 2. Do OCR on the licence plate 3. Decide of the licence plate is one of those 3 busses

PS Flashing with IR helps a great deal with licence plates if you remove/leave out the IR filter of your camera

edit flag offensive delete link more

Comments

2

His question doesn't mention number plate detection at all, so why would you presume he needs help for that?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-23 07:40:43 -0600 )edit

Because it is possibly easier than detecting the specific vehicle itself. This is not the same as detecting a bus. He wants to detect three specific busses, I presume, not the busses that happen to look like those three. The one thing that identifies a bus is its licence plate. Think about it, it is really not such a strange suggestion.

Goosebumps gravatar imageGoosebumps ( 2014-10-28 06:52:23 -0600 )edit
1

I do not think this approach wrong. It is possible to even measure (very roughly) its distance, since it is trivial match the characters with real world coordinates. Like the others it has its own drawbacks. One that bothers me, is that the license plate can be easily occluded by a car/bike/pedestrian ... at least in my city, they are placed quite low. Without know more details, it is hard to tell a good solution.

R.Saracchini gravatar imageR.Saracchini ( 2014-11-05 10:39:36 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-10-23 05:03:39 -0600

Seen: 1,394 times

Last updated: Oct 23 '14