简体   繁体   中英

Filter for noisy image with low contrast

I try to implement OCR in a really noisy image. There is also a low contrast between the number and background. I have tried to use some median filter to smooth background noise and edge enhancement method but without sensible effect. Does anyone have something similar task to do? What filter should I use?

Number with background's noise and low contrast:

带有背景噪音和低对比度的数字

EDIT (ADDED OVEREXPOSED PICTURES)

在此处输入图片说明在此处输入图片说明

If you are able to do the image acquisition again there are few options:

  1. Try to overexpose the image, which might have a positive effect on the segmentation of number from the background. I just wrote a post about it: https://www.linkedin.com/pulse/making-overexposure-work-you-part-i-vladimir-perkovic

  2. Since you have the Halcon tag, I assume you have access to Halcon. Take a look at example ocr_embossed_photometric_stereo.hdev which shows how to read embossed letter using lights from multiple directions.

In case that you have to work with only existing images the best I've got is using the Maximally Stable Extremal Regions (MSER) in Halcon:

rgb1_to_gray (Image, GrayImage)
segment_image_mser (GrayImage, MSERDark, MSERLight, 'dark', 600, 60000, 1, 'may_touch_border', 'false')

在此处输入图片说明

Actually this shared images' resolutions are very low (nearly 190x160). If real images' resolutions are higher than this images, you can get better results. I tried some codes on images. I found digits as "6" and "&".

Screenshot is here: https://drive.google.com/open?id=1I1s79hwcon8IdxC6peRxMbaB4I2taNFr

Code is here:

dev_get_window (WindowHandle)
set_display_font (WindowHandle, 18, 'mono', 'true', 'false')

**reading image
read_image (Pnk9h, '/home/emin/Desktop/pNk9h.png')
get_image_size (Pnk9h, Width, Height)

**bluring image but preserve the edges
bilateral_filter (Pnk9h, Pnk9h, ImageBilateral, 9, 10, [], [])

**sharpening image
emphasize (ImageBilateral, ImageEmphasize, 7, 7, 5)

**processes about finding digits
var_threshold (ImageEmphasize, Region, 150, 150, 0.2, 2, 'dark')
var_threshold (ImageEmphasize, Region2, 150, 150, 0.2,5, 'light')
fill_up (Region, RegionFillUp)
difference (RegionFillUp, Region, RegionDifference)
opening_circle (RegionFillUp, RegionOpening, 3.5)
connection (RegionOpening, ConnectedRegions)
sort_region (ConnectedRegions, SortedRegions, 'first_point', 'true', 'column')
select_shape (SortedRegions, SelectedRegions, ['area','row','row1','row2'], 'and', [150,Height/2-20,10,0], [99999,Height/2+20,Height,Height-10])

smallest_rectangle1 (SelectedRegions, Row1, Column1, Row2, Column2)
gen_rectangle1 (Rectangle, Row1, Column1, Row2, Column2)
intersection (Rectangle, Region, RegionIntersection)
opening_circle (RegionIntersection, RegionOpening1, 2)
area_center (RegionOpening1, Area, Row, Column)
union1 (RegionOpening1, RegionUnion)

**painting image for reading robustly
paint_region (RegionUnion, ImageEmphasize, ImageResult, [0,0,0], 'fill')
complement (RegionUnion, RegionComplement)
paint_region (RegionComplement, ImageResult, ImageResult, [255,255,255], 'fill')

**reading digits
read_ocr_class_cnn ('Universal_0-9+_NoRej.occ', OCRHandle3)
do_ocr_multi_class_cnn (SelectedRegions, ImageResult, OCRHandle3, Class3, Confidence3)
dev_disp_text (Class3, 'image', Row2+10, Column2-50, 'blue', [], [])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM