Answers.Body: <p>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.</p>
  
  <p>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 </p>
  
  <hr>
  
  <p>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. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-26T09:44:18.090Z
Answers.Text: 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?
Answers.UserDisplayName: nikki2
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-27T02:10:02.767Z
Answers.Text: 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
Answers.UserDisplayName: SaiVinay007
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-27T14:17:14.640Z
Answers.Text: where can I find more readings about how to calculate distance? I really need to read about them
Answers.UserDisplayName: nikki2
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-27T14:44:27.760Z
Answers.Text: 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
Answers.UserDisplayName: SaiVinay007
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-27T15:45:02.650Z
Answers.Text: 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?
Answers.UserDisplayName: nikki2
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-28T01:11:55.430Z
Answers.Text: Python will be good. Image processing will be used if you want to find distance that to after you get the the lanes and the boundaries of truck. You can use deep learning algorithms to detect the lanes and truck boundaries
Answers.UserDisplayName: SaiVinay007
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-24T08:43:05.330Z
Answers.LastActivityDate: 2019-06-24T08:43:05.330Z
Answers.UserDisplayName: SaiVinay007
Answers.Body: <p>If you know the latitude-longitude of the trucks and the center, you can do the following,</p>
  <p>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 : <a href="http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates" rel="nofollow noreferrer">Link1</a></p>
  <p>You can find python implementation here:<a href="https://github.com/saivarshittha/latitude_longitude_bounds/blob/master/latitude_longitude_bounds.ipynb" rel="nofollow noreferrer">Link2</a></p>
  <p>Once you know the bounds, you can simply check if the truck's location falls within the latitude-longitude bounds.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-11T15:14:23.527Z
Answers.LastActivityDate: 2020-12-11T15:14:23.527Z
Answers.UserDisplayName: sai_varshittha
Body: <p>I have a bunch of images from different trucks passing the road. Here is an example.</p>
  <p><a href="https://i.sstatic.net/3mHXL.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3mHXL.png" alt="enter image description here" /></a></p>
  <p>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).</p>
  <p>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.</p>
  <p>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.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-11T15:19:55.883Z
Comments.Text: 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?
Comments.UserDisplayName: nbro
Tags: <machine-learning><deep-learning><applications><image-processing>
Title: How do I determine whether a truck is inside its lane?
UserDisplayName: nikki2
ThreadText: # How do I determine whether a truck is inside its lane?
  
  (Asked by: username_0 on 2019-06-23)
  
  I have a bunch of images from different trucks passing the road. Here is an example.
  
  [![enter image description here](https://i.sstatic.net/3mHXL.png)](https://i.sstatic.net/3mHXL.png)
  
  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.
  
  **Tags:** machine-learning, deep-learning, applications, image-processing
  > **Comments:**
  > **username_1**: 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?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2019-06-24. Score: 2
  
  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.
  
  > **Comments:**
  > **username_0**: 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?  
  > **username_2**: 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  
  > **username_0**: where can I find more readings about how to calculate distance? I really need to read about them  
  > **username_2**: 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  
  > **username_0**: 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?  
  > **username_2**: Python will be good. Image processing will be used if you want to find distance that to after you get the the lanes and the boundaries of truck. You can use deep learning algorithms to detect the lanes and truck boundaries  
  
  ---
  
  ### Answer by username_3 on 2020-12-11. Score: 0
  
  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](http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates)
  
  You can find python implementation here:[Link2](https://github.com/saivarshittha/latitude_longitude_bounds/blob/master/latitude_longitude_bounds.ipynb)
  
  Once you know the bounds, you can simply check if the truck's location falls within the latitude-longitude bounds.
  
  
  ---
  
  