ialprBBoxStat Statistics of bounding boxes of the characters

Use of the function lrpGetChars

 1 import iaLPR
 2 
 3 def draw_roi(image, roi, color='red'):
 4      draw = adDraw(image, rgb=1)
 5      draw. rectangle(roi, outline=color)
 6      return draw.get_image()
 7 
 8 phID = 1000
 9 image, grID = iaLPR.lprGetPhoto(phID)
10 
11 labels, images, bboxes = iaLPR.lprGetChars(phID)
12 for label, bbimage, bbox in zip(labels, images, bboxes):
13    #print 'bbox=', bbox
14    xx1, yy1 = bbox.min(0)
15    xx2, yy2 = bbox.max(0)
16    roi = [xx1,yy1,xx2+1,yy2+1]
17    image = draw_roi(image, roi, 'blue')
18 adshow(image, title='Image G%d #%d' % (grID, phID))

Image G3 #1000

Computing the minimum and maximum Bounding Box of all characters in the images in the database

 1 ng = iaLPR.lprGetCounts()
 2 n = sum(ng)
 3 phID = range(1,n+1)
 4 #phID = range(1,100)
 5 
 6 Hmin = 100
 7 Wmin = 100
 8 Hmax = 0
 9 Wmax = 0
10 for i in phID:
11   labels, images, bboxes = iaLPR.lprGetChars(i)
12   for label, bbimage, bbox in zip(labels, images, bboxes):
13     xx1, yy1 = bbox.min(0)
14     xx2, yy2 = bbox.max(0)
15     h = yy2+1-yy1
16     w = xx2+1-xx1
17     Hmin = min(Hmin,h)
18     Wmin = min(Wmin,w)
19     Hmax = max(Hmax,h)
20     Wmax = max(Wmax,w)
21 print 'Processed %d images' % (n,)
22 print 'Maximum and minimum bounding box'
23 print 'Wmin=%d, Wmax=%d'% (Wmin,Wmax)
24 print 'Hmin=%d, Hmax=%d'% (Hmin,Hmax)
Processed 6944 images
Maximum and minimum bounding box
Wmin=2, Wmax=37
Hmin=11, Hmax=43