示例#1
0
 def test_decode_symbols_valid_multiple_chars(self):
     ret = RM4SCC.decodeSymbols([c for c in 'ADASLSLSLLSADADDAADADALDSL'])
     assert_equal(ret, '97RKPW')
示例#2
0
文件: main.py 项目: cfax/rm4sccdec
#!/usr/bin/env python

import sys
from cv2 import imread

import processing, statistics
from rm4scc import RM4SCC


if __name__ == '__main__':
    if len(sys.argv) != 2:
        print 'Usage: {} image_filename.ext'.format(sys.argv[0])

    img = imread(sys.argv[1])
    processed = processing.prepareImage(img)
    contours = processing.findContours(processed)

    features = statistics.getFeatures(contours)
    initial_centroids = statistics.computeClusteringInitialPoints(features)

    symbols, centroids = statistics.classifySymbols(features, initial_centroids)

    codeword = RM4SCC.decodeSymbols(symbols)
    print codeword
示例#3
0
 def test_decode_symbols_valid_single_char(self):
     ret = RM4SCC.decodeSymbols([c for c in 'ADASLDASLL'])
     assert_equal(ret, '99')