# White lines detection

**URL:** <https://forums.openmv.io/t/white-lines-detection/8135>\
**Category:** OpenMV Boards\
**Created:** [March 26, 2023, 1:52pm UTC](https://forums.openmv.io/t/white-lines-detection/8135 "2023-03-26T13:52:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcmag](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/jcmag/32/2767_2.png) [@jcmag](https://forums.openmv.io/u/jcmag)\
**Post date:** [March 26, 2023, 1:52pm UTC](https://forums.openmv.io/t/white-lines-detection/8135/1 "2023-03-26T13:52:12Z")

</div>

Hi,

I want to detect white lines in my camera’s images, using this code:

```auto
img = sensor.snapshot()

blackImage = img.to_grayscale(copy = True).binary([(190, 255)])

segments = blackImage.find_line_segments(merge_distance = 10, max_theta_diff = 5)
    
for segment in segments:
    img.draw_line(segment.line(), color = (255, 0, 0))

```

I’m calling to\_grayscale() and binary() to detect the lines in a black and white image, to be more accurate.  
But the last call (img.draw\_line) doesn’t draw the lines in the displayed image (in the IDE), why?

(If I put to\_grayscale(copy = False), I see grey lines in the displayed image)

---

<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 26, 2023, 10:09pm UTC](https://forums.openmv.io/t/white-lines-detection/8135/2 "2023-03-26T22:09:51Z")

</div>

Mmm… things can get confusing when using copy and the dot operation.

```auto
img = sensor.snapshot()
black_img = img.to_grayscale(copy = True)
black_img.binary([(190, 255)])
segments = black_img.find_line_segments(merge_distance = 10, max_theta_diff = 5)
    
for segment in segments:
    img.draw_line(segment.line(), color = (255, 0, 0))

```

Does the above work? Otherwise it’s a bug in the library breaking pointers.

---

<div class="post-metadata">

**Author:** ![jcmag](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/jcmag/32/2767_2.png) [@jcmag](https://forums.openmv.io/u/jcmag)\
**Post date:** [March 28, 2023, 10:29pm UTC](https://forums.openmv.io/t/white-lines-detection/8135/3 "2023-03-28T22:29:53Z")

</div>

no, same issue…

---

<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 28, 2023, 11:03pm UTC](https://forums.openmv.io/t/white-lines-detection/8135/4 "2023-03-28T23:03:17Z")

</div>

Please file a bug ticket here. I’ll get this fixed over the weekend and have a new firmware for you: [Issues · openmv/openmv · GitHub](https://github.com/openmv/openmv/issues)

---

<div class="post-metadata">

**Author:** ![jcmag](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/jcmag/32/2767_2.png) [@jcmag](https://forums.openmv.io/u/jcmag)\
**Post date:** [March 28, 2023, 11:24pm UTC](https://forums.openmv.io/t/white-lines-detection/8135/5 "2023-03-28T23:24:43Z")

</div>

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:** [April 2, 2023, 1:05am UTC](https://forums.openmv.io/t/white-lines-detection/8135/6 "2023-04-02T01:05:26Z")

</div>

Found the issue: [bug with to\_grayscale(copy = True) · Issue #1811 · openmv/openmv · GitHub](https://github.com/openmv/openmv/issues/1811)
