So i managed to extract the roi for the license plate image I wanted
However, I am unable to get the boundingbox over the individual letters. I’ve tried the find_blobs but it detects the entire image instead. Any advice on how to get around it?
crop2.mean(1, threshold=True, offset=5, invert=True)
thresh = (240,255)
blob_list = crop2.find_blobs([thresh],pixels_threshold=300, area_threshold=600, merge=True)
for blob in blob_list:
crop2.draw_rectangle(blob.rect())
crop2.draw_cross(blob.cx(), blob.cy())
Thanks this helped ! I have another query, my current code saves the segmented images and it works well just that because the images are taken & saved very fast, when it overwrites some image .bmp files might end up corrupted.
Which do i use to give it a delay? would time.sleep() or machine.sleep / sensor.skip_frames() help ? It’s within a for loop
for i in range(len(blob_list)):
temp_x = blob_list[i][0]
temp_y = blob_list[i][1]
temp_w = blob_list[i][2]
temp_h = blob_list[i][3]
if temp_h > temp_w: ##only find those boxes where height > width since the number plates fit that description
img.save('pic-%d'%i,roi=(temp_x,temp_y,temp_w,temp_h))