Ask Your Question
0

digital segment

asked 2015-02-09 04:43:05 -0600

chengweige gravatar image

Hi, i have a digital recognition problem, the image is like

image description image description

at the first step, i need to segment each digital, the subimage must only have one digital. I have used the image projection method, the results show as follows

image description image description

I think it is very hard to segment each digital due to the strip on the top-right of the image, so is there any good idea for this digital segment?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-02-09 06:24:43 -0600

essamzaky gravatar image

updated 2015-02-09 06:29:49 -0600

You can do this job by using FindContours

  1. If Image is color convert Gray by using cvtColor.
  2. Convert the image to black and white , by using cv2.threshold, cv2.adaptiveThreshold.
  3. Be sure that the forground digist are white and the background is black
  4. Use findcontours to find all regions in the image
  5. Sort All regions from left to right.
  6. Loop on all regions and find the avarage width and avarage hight , you can ignore very small and very big regions.
  7. Loop again and Strart to collect the regions into line ,
  8. take region if it it's larger than Threshold1 a and less than Threshold2 add the region to line , Threshold1 and Threshold2 can be calculated from Avarage say Threshold1 > 0.7 Avarage and Threshold2 < 1.3 Avarage
  9. If the image contain more than one line , you can add new line when the traget region doe not intersect with any previouse lines , if the target region intersect with line just add the region to the line and update the line rectangle by merging the line and traget region.
  10. Now you have all lines in the image and all regions inside every line
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2015-02-09 04:43:05 -0600

Seen: 259 times

Last updated: Feb 09 '15