Detect Examples

[1]:
from easycv import Image
from easycv.transforms import Scan, Lines, Circles

For this example we will load an example image from the images folder.

[2]:
img = Image("images/qr.png")
img
[2]:
../../_images/examples_transforms_detect_3_0.png

Scan

We can obtain all qrcodes and barcodes in the image by calling the Scan transform. The transform returns the number of detections, the data encoded on each one and the bounding boxes. For more information check the reference.

[3]:
img.apply(Scan())
[3]:
{'detections': 2,
 'data': ['https://github.com/easycv/easycv', '12345670'],
 'rectangles': [[(122, 166), (228, 259)], [(304, 225), (413, 249)]]}

Lines

To get the lines in an image, call the Lines Transform, for more information check the reference.

[4]:
img.apply(Lines(threshold=100))
[4]:
{'lines': [[[-817, 720], [1084, 102]],
  [[-803, 736], [1087, 85]],
  [[-214, -976], [235, 971]],
  [[-212, -1025], [756, 723]],
  [[-818, 717], [1083, 99]],
  [[-929, 403], [1010, -79]],
  [[-235, -1018], [764, 713]],
  [[-260, -1010], [769, 704]]]}

Circles

To find the circles in the image, call the Circles transform, for more information check the reference.

[5]:
img = Image("images/circles.png")
img
[5]:
../../_images/examples_transforms_detect_12_0.png
[6]:
img.apply(Circles(threshold=50))
[6]:
{'circles': array([[149.5,  83.5,  34.3],
        [ 74.5,  83.5,  23.4],
        [262.5,  83.5,  16.6],
        [ 37.5,  83.5,  15.4],
        [224.5,  83.5,  14. ]], dtype=float32)}