如何在图像来识别钞票? [英] How to recognizing money bills in Images?

查看:221
本文介绍了如何在图像来识别钞票?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些图片欧洲货币法案。的纸币是完全的图像内
和大多持平(如变形小)和角度偏斜较小(例如图像相当从上述法案获得)。

I'm having some images, of euro money bills. The bills are completely within the image and are mostly flat (e.g. little deformation) and perspective skew is small (e.g. image quite taken from above the bill).

现在我在图像识别方面的专家。我想实现如下:

Now I'm no expert in image recognition. I'd like to achieve the following:


  • 找到的钱法案(这样我就可以在图像
  • 的其余部分从噪声切出,该法案boundingBox的
  • 图了方向。

  • Find the boundingbox for the money bill (so I can "cut out" the bill from the noise in the rest of the image
  • Figure out the orientation.

我觉得这两个步骤为pre-处理,但也许我们可以做以下工作上面的两个。因此,与我想读:

I think of these two steps as pre-processing, but maybe one can do the following steps without the above two. So with that I want to read:


  • 的议案序列号。

  • 的议案面值。

我想这应该是很可能的OpenCV的做。我只是不知道如何处理是正确的。我会选喜欢的方法,或houghs或轮廓检测一个FaceDetector边缘探测器上?

I assume this should be quite possible to do with OpenCV. I'm just not sure how to approach it right. Would I pick a FaceDetector like approach or houghs or a contour detector on an edge detector?

我很感谢阅读材料以及任何进一步的提示。

I'd be thankful for any further hints for reading material as well.

推荐答案

霍夫是伟大的,但它可以是一个有点贵

Hough is great but it can be a little expensive

这可能工作:

- 使用阈值或Canny算子找到图像的边缘。

-Use Threshold or Canny to find the edges of the image.

- 然后cvFindContours辨认的轮廓,然后尝试检测矩形。
检查OpenCV的分配squares.c例子。它基本上检查该轮廓的多边形近似有4个点和betweeen这些点的平均角接近90度。
下面是从squares.py例如code片段
(是相同的,但在python:P)。

-Then cvFindContours to identify the contours, then try to detect rectangles. Check the squares.c example in opencv distribution. It basically checks that the polygon approximation of a contour has 4 points and the average angle betweeen those points is close to 90 degrees. Here is a code snippet from the squares.py example (is the same but in python :P ).

  ..some pre-processing
  cvThreshold( tgray, gray, (l+1)*255/N, 255, CV_THRESH_BINARY );

        # find contours and store them all as a list
        count, contours = cvFindContours(gray, storage)

        if not contours:
            continue

        # test each contour
        for contour in contours.hrange():
            # approximate contour with accuracy proportional
            # to the contour perimeter
            result = cvApproxPoly( contour, sizeof(CvContour), storage,
                CV_POLY_APPROX_DP, cvContourPerimeter(contour)*0.02, 0 );
            res_arr = result.asarray(CvPoint)
            # square contours should have 4 vertices after approximation
            # relatively large area (to filter out noisy contours)
            # and be convex.
            # Note: absolute value of an area is used because
            # area may be positive or negative - in accordance with the
            # contour orientation
            if( result.total == 4 and 
                abs(cvContourArea(result)) > 1000 and 
                cvCheckContourConvexity(result) ):
                s = 0;
                for i in range(4):
                    # find minimum angle between joint
                    # edges (maximum of cosine)
                    t = abs(angle( res_arr[i], res_arr[i-2], res_arr[i-1]))
                    if s<t:
                        s=t
                # if cosines of all angles are small
                # (all angles are ~90 degree) then write quandrange
                # vertices to resultant sequence
                if( s < 0.3 ):
                    for i in range(4):
                        squares.append( res_arr[i] )

- 使用MinAreaRect2(查找对于给定的2D点集最小面积外接矩形),得到了矩形的边框。使用边界框点,你可以很容易地计算角度。

-Using MinAreaRect2 (Finds circumscribed rectangle of minimal area for given 2D point set), get the bounding box of the rectangles. Using the bounding box points you can easily calculate the angle.

您还可以找到样本下的C版本squares.c / C /在你的OpenCV的目录。

you can also find the C version squares.c under samples/c/ in your opencv dir.

这篇关于如何在图像来识别钞票?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆