5

I am trying to extract an object from a paper currency image. On the original image I applied sobel edge detection. Here is the image:

enter image description here

My question is in the following cropped image I want to have only the number 100 displayed with out the other noises. How can I do that please?

enter image description here

The code I used so far is:

close All;
clear All;
Note1 = imread('0001.jpg');
Note2 = imread('0007.jpg');
figure(1), imshow(Note1);
figure(2), imshow(Note2);

Note1=rgb2gray(Note1);
Note2=rgb2gray(Note2);
Edge1=edge(Note1,'sobel');
Edge2=edge(Note2,'sobel');
figure(5), imshow(Edge1),title('Edge sobel1');
figure(6), imshow(Edge2),title('Edge sobel2');

rect_Note1 = [20 425 150 70];
rect_Note2 = [20 425 150 70];
sub_Note1 = imcrop(Edge1,rect_Note1);
sub_Note2 = imcrop(Edge2,rect_Note2);
figure(7), imshow(sub_Note1);
figure(8), imshow(sub_Note2);

For completeness, the original image:

Shai
  • 111,146
  • 38
  • 238
  • 371
user3472037
  • 137
  • 1
  • 2
  • 8
  • Do you need to recognize only 100 Birr notes, or any amount of Birr? Is the search restricted to Birr, or should it apply to any kind of currency that uses Arabic numerals on its banknotes? – Rody Oldenhuis Jun 24 '14 at 07:43
  • Could you post the original image as well, please? – kkuilla Jun 24 '14 at 07:50
  • @Rody I am going to recognize all the notes of Birr. I wanted the just the 100 object in the cropped image is to count the number of white pixels in the object. As recognizing technique, I will use the number of white pixels in the respective notes, i.e, 1,5,10,50 and 100 notes. Apart from that I will crop some important features on each notes to know weather it is genuine or fake currency by applying the same technique which I mentioned earlier. I am very new in mat-lab and found this technique some how manageable. – user3472037 Jun 24 '14 at 07:53
  • @kkuilla Here is the original image link: http://imgur.com/um808ai&0EIkmP0&Pvob7Ku#1 – user3472037 Jun 24 '14 at 07:55
  • 2
    have you tired [stroke width transform (SWT)](http://stackoverflow.com/a/19971599/1714410)? – Shai Jun 24 '14 at 08:01

1 Answers1

3

Use a Gaussian filter to clean up the noise before applying the edge detector:

% Create the gaussian filter with hsize = [5 5] and sigma = 3.5
G = fspecial('gaussian',[7 7], 3.5);
Note1f = imfilter(Note1,G,'same');
Edge1f=edge(Note1f,'sobel');
sub_Note1f = imcrop(Edge1f,rect_Note1);
figure(6), imshow(sub_Note1f);

This results in a much cleaner 100 image enter image description here

You could also use a Canny edge detector instead of the Sobel transform.

Edge1c = edge(Note1,'canny', [0.2, 0.4] , 3.5);
sub_Note1c = imcrop(Edge1c,rect_Note1);
figure(7), imshow(sub_Note1c);

enter image description here

Bull
  • 11,771
  • 9
  • 42
  • 53