Exemplo n.º 1
0
def plateRecognize(inMat):
    PlateLocater.m_debug = False
    CharsIndentifier.m_debug = False

    Result = PlateLocater.fuzzyLocate(inMat)

    if m_debug:
        print '候选车牌数量:',len(Result)
        index_loc = 0
        for img in Result:
            index_loc += 1
            cv2.imshow("候选车牌"+str(index_loc),img)
        cv2.waitKey(0)
        cv2.destroyAllWindows()

    resultVec = PlateJudger.platesJudge(Result)
    

    if m_debug:
        print 'SVM筛选后的车牌数量:',len(resultVec)
        index_loc = 0
        for img in resultVec:
            index_loc += 1
            cv2.imshow("SVM-"+str(index_loc),img)
            cv2.imwrite("debug/SVM-"+str(index_loc)+".jpg", img)
        cv2.waitKey(0)
        cv2.destroyAllWindows()

    lisences = list()
    for img_plate in resultVec:
        segmented = CharsSegmenter.charsSegment(img_plate)

        if m_debug:
            index_char = 0
            for char in segmented:
                index_char += 1
                cv2.imshow("chars_segment"+str(index_char), char)
                cv2.imwrite("debug/segmented-"+str(index_char)+".jpg", char)

            cv2.waitKey(0)
            cv2.destroyAllWindows()

        lisence = CharsIndentifier.identifyPlate(segmented)
        # print lisence
        lisences.append(lisence)

    return lisences
Exemplo n.º 2
0
def test_plate_locate():
    PlateLocater.m_debug = False
    rootdir = "resources/easy_test"
    print 'test_plate_locate'

    for parent,dirnames,filenames in os.walk(rootdir):        
        index_file = 0
        print filenames        
        for filename in filenames:
                cv2.destroyAllWindows()
                index_file += 1

                imgPlate = cv2.imread(os.path.join(parent,filename),cv2.IMREAD_COLOR)
                print '文件名:',filename.split('.')[0]

                cv2.imshow("原图",imgPlate)
                Result = PlateLocater.fuzzyLocate(imgPlate)
                print '候选车牌数量:',len(Result)

                index_loc = 0
                for img in Result:
                    index_loc += 1
                    cv2.imshow("候选车牌"+str(index_loc),img)
                cv2.waitKey(0)

                resultVec = PlateJudger.platesJudge(Result)
                print 'SVM筛选后的车牌数量:',len(resultVec)

                index_loc = 0
                for img in resultVec:
                    index_loc += 1
                    cv2.imshow("SVM-"+str(index_loc),img)
                cv2.waitKey(0)


                if index_file >20:
                     break
Exemplo n.º 3
0
def test_plate_locate():
    PlateLocater.m_debug = False
    rootdir = "resources/easy_test"
    print 'test_plate_locate'

    for parent, dirnames, filenames in os.walk(rootdir):
        index_file = 0
        print filenames
        for filename in filenames:
            cv2.destroyAllWindows()
            index_file += 1

            imgPlate = cv2.imread(os.path.join(parent, filename),
                                  cv2.IMREAD_COLOR)
            print '文件名:', filename.split('.')[0]

            cv2.imshow("原图", imgPlate)
            Result = PlateLocater.fuzzyLocate(imgPlate)
            print '候选车牌数量:', len(Result)

            index_loc = 0
            for img in Result:
                index_loc += 1
                cv2.imshow("候选车牌" + str(index_loc), img)
            cv2.waitKey(0)

            resultVec = PlateJudger.platesJudge(Result)
            print 'SVM筛选后的车牌数量:', len(resultVec)

            index_loc = 0
            for img in resultVec:
                index_loc += 1
                cv2.imshow("SVM-" + str(index_loc), img)
            cv2.waitKey(0)

            if index_file > 20:
                break