In this activity, we will try to extract handwritten text from an imaged document with lines. In handwriting recognition, individual examples of letters must be extracted.
Procedure.
1. Download one of the images DSC00469.JPG or Untitled_0001.jpg.
2. Crop a portion of the image with handwritten text within lines in the form.
image 1
I cropped image 1 to
image 2 - cropped image3. Remove the lines using image processing techniques.
To remove the horizontal lines we will use the filter below.
image 3 - filterTo remove the horizontal lines we will use the filter below.
This filter is based on the fft of the cropped image which is shown in figure 4.
image 4 - fft of cropped image
Then we will filter the image by convolution,
4.Binarize the handwriting, clean the image and process such that each handwritten letter is one pixel thick.
code used:
im=imread('image.jpg');
img=imread('filter.jpg');
im = im2gray(im);
imf = im2gray(img);
ff1=fft2(im);
ff2=fftshift(imf);
imft=ff1.*ff2;
imshow(ff1);
//filtering the image
a=real(fft2(imft));
scf(1)
imshow(a,[]);
//binarize the image
b=im2bw(a, 127/255);//threshold from GIMP
c=1-b;
scf(2);
imshow(c,[]);
// structuring element
SE = ones(2,2)
//opening operation
d=erode(c,SE);
e=dilate(d,SE)
scf(3);
imshow(e,[]);
//label the image
f=bwlabel(e);
scf(4);
imshow(f,[]);
From the labeled image, the processed image is not that clear. :(
Acknowledgements:
Ed
- for the help
Grade:
10/10
- because I did my best and I was able to use what I learned in the activities before.
im=imread('image.jpg');
img=imread('filter.jpg');
im = im2gray(im);
imf = im2gray(img);
ff1=fft2(im);
ff2=fftshift(imf);
imft=ff1.*ff2;
imshow(ff1);
//filtering the image
a=real(fft2(imft));
scf(1)
imshow(a,[]);
//binarize the image
b=im2bw(a, 127/255);//threshold from GIMP
c=1-b;
scf(2);
imshow(c,[]);
// structuring element
SE = ones(2,2)
//opening operation
d=erode(c,SE);
e=dilate(d,SE)
scf(3);
imshow(e,[]);
//label the image
f=bwlabel(e);
scf(4);
imshow(f,[]);
From the labeled image, the processed image is not that clear. :(
Acknowledgements:
Ed
- for the help
Grade:
10/10
- because I did my best and I was able to use what I learned in the activities before.
0 comments:
Post a Comment