I have a bunch of images from different trucks passing the road. Here is an example.

enter image description here

The truck needs to be at a certain distance from the border of the lane. Some of the trucks are way close to the border (that you can see on the shoulder of the road).

I want to find a way to measure the distance between the truck and the border of the lane and, more importantly, to detect whether a truck is inside its lane.

I would like to solve this problem by training a deep learning-based classifier or image processing techniques. Painting the ground is also possible if I can train a classification algorithm with painted images.

  • $\begingroup$ Please, do not remove info from your post that is useful to answer the question. Your last version of the post was missing several details that are needed to understand the problem and provide an answer. I tried to save this question by asking what I think is the most likely question you were asking. Can you please confirm that? $\endgroup$ – nbro Dec 11 '20 at 15:19

One possible approach will be to use an algorithm which detects lines (Ex. Hough lines or any deep neural net trained to detect lanes) and use some threshold range so that we can get the lane and the edges of truck, then after extracting the lines, you can easily find the distance between them.

Then you need to experiment out on few images to get the threshold distance that you are expecting the truck to maintain as the real distance and the distance calculated using images are not same

If you want to classify using deep learning, you may need to preprocess the images and send them. As it will become very difficult to directly learn to classify based on image, you may need to first detect the lanes, then apply a mask and then send the masked image to your network to make the network to converge.

  • $\begingroup$ thanks for the reply, I tried the Hough lines and circle. HoughCircle detection, for example, it doesn't detect all the wheels and will also detect random circles in the foliage and as you see the wheels projections are ellipses and not circles, what should I do for that? could you pls elaborate on the second method as well? $\endgroup$ – nikki2 Jun 26 '19 at 9:44
  • 1
    $\begingroup$ You can possibly remove the random circles by specifying a threshold area or use contours. I was expecting that hough lines will be able to detect the edges of the truck trailer (which has straight edges) and the lanes, and calculating gap from those. So, to use deep learning for classification we need lot of data or data which already has some good amount of information that network needs to learn for the task, here the information that network would probably learn is first identifying the lanes and truck, so if we preprocess the image and send those as input the learning process gets easier $\endgroup$ – SaiVinay007 Jun 27 '19 at 2:10
  • $\begingroup$ where can I find more readings about how to calculate distance? I really need to read about them $\endgroup$ – nikki2 Jun 27 '19 at 14:17
  • $\begingroup$ I don't think there are direct articles on calculating distances in this kind of situtations. I feel this problem can be solved by applying different concepts. Mostly its about image processing that you need to know after you get the lanes and edges of truck or some boundaries of truck to calculate distances. Book by Richard Szeliski which has almost everything related to computer vision. You may also try out image segmentation and find distances on the output $\endgroup$ – SaiVinay007 Jun 27 '19 at 14:44
  • $\begingroup$ what programing language do you think would give better results? do you think using image processing would be robust enough for this project? for example, if the truck changes? $\endgroup$ – nikki2 Jun 27 '19 at 15:45

If you know the latitude-longitude of the trucks and the center, you can do the following,

Given the latitude-longitude location of the center and the radius in which you want to search the presence of a truck(say R) around center, you can find the latitude-longitude bounds of the space around center within R radius by : Link1

You can find python implementation here:Link2

Once you know the bounds, you can simply check if the truck's location falls within the latitude-longitude bounds.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.