def testChain(): sd = ScaleDetection() im = sd.openImage(FILENAME) sd.calibrate(im, IMG_DIM[0], IMG_DIM[1], UNIT) im = sd.openImage(FILENAMES[-1]) w, h, unit = sd.getSize(im, show_conts=SAVE_IMG) print "Width: {}".format(round(w,1)) print "Height: {}".format(round(h,1)) assert round(w, 1) == round(DIMS[-1][0], 1) assert round(h, 1) == round(DIMS[-1][1], 1)
def testScales(): for i in range(0, len(FILENAMES)): sd = ScaleDetection() sd.x_scale = SCALE[0] sd.y_scale = SCALE[1] sd.units = UNIT im = sd.openImage(FILENAMES[i]) w,h,unit = sd.getSize(im, show_conts=SAVE_IMG) print "Width: {}".format(round(w,1)) print "Height: {}".format(round(h,1)) assert round(w, 1) == round(DIMS[i][0], 1) assert round(h, 1) == round(DIMS[i][1], 1)