# openmv can be achieve the car lane line detection?

**URL:** <https://forums.openmv.io/t/openmv-can-be-achieve-the-car-lane-line-detection/219>\
**Category:** OpenMV Boards\
**Created:** [March 23, 2017, 1:10pm UTC](https://forums.openmv.io/t/openmv-can-be-achieve-the-car-lane-line-detection/219 "2017-03-23T13:10:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![skylin008](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@skylin008](https://forums.openmv.io/u/skylin008)\
**Post date:** [March 23, 2017, 1:10pm UTC](https://forums.openmv.io/t/openmv-can-be-achieve-the-car-lane-line-detection/219/1 "2017-03-23T13:10:11Z")

</div>

Hello,kwagyeman！  
openmv can be achieve the car lane line detection?Had some source code to be or modified the code from example!Thanks!

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [March 23, 2017, 6:31pm UTC](https://forums.openmv.io/t/openmv-can-be-achieve-the-car-lane-line-detection/219/2 "2017-03-23T18:31:38Z")

</div>

Maybe this thread?

> **[Line Following - Blob Spotting/Decoding robot](https://forums.openmv.io/viewtopic.php?t=120#p1308)**
>
> From my post on “MV Primer” in the tech discussion area of the forum - I want to start a project HERE. “I have the idea that I would like to make a line following robot for a grid. At each grid intersection could be a symbol so it would have the...

There are two ways to do this.

1: By using color tracking and following a line. I designed a lot of the stuff the OpenMV Cam in mind and optimized it for this.  
2: By using the line detection feature to find lines. The code for this right now isn’t that highly optimized however and I think I can make it go faster. However, that said, finding lines allows you to basically see lanes on either side of the robot.

---

<div class="post-metadata">

**Author:** ![skylin008](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@skylin008](https://forums.openmv.io/u/skylin008)\
**Post date:** [March 24, 2017, 1:25pm UTC](https://forums.openmv.io/t/openmv-can-be-achieve-the-car-lane-line-detection/219/3 "2017-03-24T13:25:25Z")

</div>

kwagyeman，Thanks!  
As you kindly suggestion 2: By using the line detection feature to find lines. The code for this right now isn’t that highly optimized however and I think I can make it go faster. However, that said, finding lines allows you to basically see lanes on either side of the robot.  
How to filter or mask much line and leave useful line,something algorithm to be reference,thank you very much!

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [March 24, 2017, 5:54pm UTC](https://forums.openmv.io/t/openmv-can-be-achieve-the-car-lane-line-detection/219/4 "2017-03-24T17:54:12Z")

</div>

Please see the link above. zlite did this code already.

---

<div class="post-metadata">

**Author:** ![zlite](https://avatars.discourse-cdn.com/v4/letter/z/c6cbf5/32.png) [@zlite](https://forums.openmv.io/u/zlite)\
**Post date:** [April 3, 2017, 2:41am UTC](https://forums.openmv.io/t/openmv-can-be-achieve-the-car-lane-line-detection/219/5 "2017-04-03T02:41:17Z")

</div>

This code with the new M7 OpenMV cam did great this weekend at the Thunderhill Self Racing Cars/DIY Robocars race ([Login to Meetup | Meetup](https://www.meetup.com/DIYRobocars/events/237232241/)). Came in 2nd, beating out nVidia TX2 cars and a lot of RaspberryPi 3s. Here’s a practice lap:

[![](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/2X/8/8da239c626479c6f3cc31319bfe546ba8b691b71.jpeg "OpenMV autonomous rover") ](https://www.youtube.com/watch?v=3ANMg0j5BNE)

The code is [OpenMVrover/bwlinefollowingRC.py at master · zlite/OpenMVrover · GitHub](https://github.com/zlite/OpenMVrover/blob/master/bwlinefollowingRC.py)

The secret to the good performance was weighting the top third of the frame the highest. These were the ROIs that worked best for us:

ROIS = [# [ROI, weight]  
(0, 100, 160, 20, 0.1), # You’ll need to tweak the weights for your app  
(0, 050, 160, 20, 0.3), # depending on how your robot is setup.  
(0, 000, 160, 20, 0.7)  
]
