The forum is to discuss topics related to different areas of image processing and computer vision.
by Cocco17 » Thu Feb 23, 2012 12:55 pm
Hello guys!
Im working on a project to find codes like 1D barcodes and 2D codes like qr, datamatrix etc.. Actually I wanted to start with the detection and decoding of a datamatrix code.
Therefore I am using the Aforge.net libary to get the picture of my webcam and already tried so filters etc.. Nevertheless I do not have a clue, how I could extract only the code.. I thought about blobs, but a datamatrix-code has many small squares, but I need the whole code.
Thanks for your help!
See attachment: im getting so far
- Attachments
-

- So far with thresholddifference filter.. but how can i extract only the code?
- So_Far.JPG (11.7 KiB) Viewed 953 times
-
Cocco17
-
- Posts: 11
- Joined: Thu Feb 23, 2012 12:49 pm
by Cocco17 » Fri Mar 09, 2012 10:21 am
Nobody, who could help ? So far Ive tried some other filters, like: - "Fill Holes" to fill the empty squares in the code, the find the hole code as one blob, extracting this area from the original, but the fill hole filter does not work because there are clear lines between the single Squares of the code. --> Fails - "Shrink" to Shrink to the area, the code is located. But the code will be read from any object, for example a metal card like in my test cases, so it only shrinks to the border of the object. Furthermore the information, which area of the original remains, got lost. - "DIlatation" to create one Big Square. Unfortunately the dilatation works only very smooth, so no big chances are happening. are there any other ideas guys ? Here my Status: Link: http://s1.directupload.net/images/120309/mqeqqg4n.jpg
-
Cocco17
-
- Posts: 11
- Joined: Thu Feb 23, 2012 12:49 pm
by andrew.kirillov » Fri Mar 09, 2012 10:49 am
Here is something to have a look at. It is not about data matrix, qr-code, etc. But some ideas may be in common. Here is the main thing you need to solve - find bounding quadrilateral for the matrix code. Essentially you need to find 4 corners of the quadrilateral, which contains only the matrix. Once this is done, the rest will be much easier.
-

andrew.kirillov
- Site Admin, AForge.NET Developer
-
- Posts: 2567
- Joined: Fri Jan 23, 2009 9:12 am
- Location: UK
by Cocco17 » Fri Mar 09, 2012 12:12 pm
Thanks for the reply!
Yeah, thats my idea too. At the moment i was thinking about searching the typical "Finding Pattern" of the DataMatrix Code in this picture. So I made a Picture only with this Pattern, and now i wanted to search for it in my new picture from the webcam. Would that be possible too?
I already know the link you told me... unfortunately my problem is, that die squares are not linked, but seperated by a little space (see above). Like I wrote above, my idea was to link them by using a filter which would wide up the squares..
any other ideas?
-
Cocco17
-
- Posts: 11
- Joined: Thu Feb 23, 2012 12:49 pm
by Cocco17 » Fri Mar 09, 2012 1:37 pm
- Code: Select all
For Each blob In extractor.GetObjectsInformation() Try ' Get Edge points of square edgepoints = extractor.GetBlobsEdgePoints(blob) corners = PointsCloud.FindQuadrilateralCorners(edgepoints) 'Prüfe ob Realcorners noch leer If corners.Count = 4 Then
If Realcorners Is Nothing Then Realcorners = corners
Else 'Sonst Prüfen, ob Punkte nun am weitesten Außen liegen If (corners(0).X < Realcorners(0).X) And (corners(0).Y < Realcorners(0).Y) Then Realcorners(0) = corners(0) If (corners(1).X > Realcorners(1).X) And (corners(1).Y < Realcorners(1).Y) Then Realcorners(1) = corners(1) If (corners(2).X < Realcorners(2).X) And (corners(2).Y > Realcorners(2).Y) Then Realcorners(2) = corners(2) If (corners(3).X > Realcorners(3).X) And (corners(3).Y > Realcorners(3).Y) Then Realcorners(3) = corners(3)
End If
End If
New Idea: going through every blob, and checking, if its the farest cornerpoint, if yes, it get saved in Realcorners.. and the Blob Realcorners gets extracted at the end. But this doent work either. Is it possible, that there is no order in the given back List of IntPoints after this command? " corners = PointsCloud.FindQuadrilateralCorners(edgepoints) " ?
-
Cocco17
-
- Posts: 11
- Joined: Thu Feb 23, 2012 12:49 pm
by andrew.kirillov » Fri Mar 09, 2012 1:40 pm
Cocco17 wrote:Is it possible, that there is no order in the given back List of IntPoints after this command? " corners = PointsCloud.FindQuadrilateralCorners(edgepoints) " ?
No, as documentation says, poits are always ordered. See here.
-

andrew.kirillov
- Site Admin, AForge.NET Developer
-
- Posts: 2567
- Joined: Fri Jan 23, 2009 9:12 am
- Location: UK
by Cocco17 » Thu Mar 15, 2012 7:31 am
Unforunately this idea doesnt work either. Is there any other chance to find the significant "L-Pattern" ? There are many softwares, which can find this Datamatrixcode in nanoseconds, but I cannot guess for what they are searching..
-
Cocco17
-
- Posts: 11
- Joined: Thu Feb 23, 2012 12:49 pm
by andrew.kirillov » Thu Mar 15, 2012 9:48 am
Cocco17 wrote:Unforunately this idea doesnt work either.
Which idea? If you were trying to use FindQuadrilateralCorners() without any extra code, then of course it would not work. In your data matrix you don't have a small "brick" in one of the corners. So FindQuadrilateralCorners() will not be able to find you proper bounding quadrilateral. It can be used as a starting point. But then one of the corners (maybe several) will need to be shifted in such a way that all small squares of the code are inside of the quadrilateral. When you get to this, then you can extract quadrilateral as a rectangular image and analyse it.
-

andrew.kirillov
- Site Admin, AForge.NET Developer
-
- Posts: 2567
- Joined: Fri Jan 23, 2009 9:12 am
- Location: UK
by Cocco17 » Thu Mar 15, 2012 10:20 am
Idea, I refered to: New Idea: going through every blob, and checking, if its the farest cornerpoint, if yes, it get saved in Realcorners.. and the Blob Realcorners gets extracted at the end. But this doent work either. Is it possible, that there is no order in the given back List of IntPoints after this command? " corners = PointsCloud.FindQuadrilateralCorners(edgepoints) " ?
The Problem is to find a way, to recognize the "L-Pattern". Every Datamatrix Code got a full line in x- and y-directory, this is called "L-pattern". After recognizing this part, it would be easy to create a rectangle by calculating the missing 4th corner and then extracting it. But I got no clue, how this step could be done... 
-
Cocco17
-
- Posts: 11
- Joined: Thu Feb 23, 2012 12:49 pm
by Cocco17 » Thu Mar 15, 2012 10:29 am
Is there any way to find the row and column of the binarized picture, which got the highest value for white? maybe this would work..
or easier: finding rows and columns with very characteristic black-white changes
-
Cocco17
-
- Posts: 11
- Joined: Thu Feb 23, 2012 12:49 pm
Return to Image Processing and Computer Vision
|

|