def find(self, img): self.img = img coreimg, cladimg = self._difcore(img) # cv2.imshow("clad edge", cladimg[::4,::4]) # cv2.waitKey() sets = SETTING() if 'thresholdSize' in sets.keys(): hight = sets['thresholdSize'].get("core") coreimg = ExtractEdge().directThr(coreimg, hight) else: coreimg = ExtractEdge().directThr(coreimg) # coreimg = ExtractEdge().run(coreimg) # cladimg = ExtractEdge().run(cladimg) if 'thresholdSize' in sets.keys(): hight = sets['thresholdSize'].get("clad", 40) cladimg = ExtractEdge().directThr(cladimg, hight) else: cladimg = ExtractEdge().directThr(cladimg) # cladimg = cv2.bilateralFilter(cladimg, 20, 80, 75) # cv2.imshow("cladimg edge", cladimg[::4,::4]) # cv2.waitKey() coreResult = PickHullCircle().run(coreimg) cladResult = PickHullCircle().run(cladimg) print 'amp', self.SET['ampPixSize'], self.SET['fiberType'] self.result['core'] = coreResult['ellipese'] self.result['coreResult'] = coreResult self.result['clad'] = cladResult['ellipese'] self.result['cladResult'] = cladResult self.result['showResult'] = self.getResult() return self.result
def test_updateSets_args(): s = SETTING("Default") s.updates() assert "set" not in s.keys() assert "testsetdict" not in s.keys() s.updates("set", {"testsetdict": "dict"}) assert s.get("testset") == ".json" assert s.get("testsetdict") == "dict"
def find(self, img): self.img = img coreimg, cladimg = self._difcore(img) sets = SETTING() if 'thresholdSize' in sets.keys(): hight = sets['thresholdSize'].get("core") coreimg = ExtractEdge().directThr(coreimg, hight) else: coreimg = ExtractEdge().directThr(coreimg) # coreimg = ExtractEdge().run(coreimg) cladimg = ExtractEdge().run(cladimg) # cv2.imshow('core', coreimg[::4, ::4]) # cv2.waitKey() # cv2.imshow('clad', cladimg[::4, ::4]) # cv2.waitKey() coreResult = PickCircle().run(coreimg) cladResult = PickOctagon().run(cladimg) print 'start octagon test', cladResult.keys(), cladResult['ellipese'] self.result['core'] = coreResult['ellipese'] self.result['coreResult'] = coreResult self.result['clad'] = cladResult['ellipese'] self.result['cladResult'] = cladResult self.result['showResult'] = self.getResult() return self.result
def test_updateSets_kwargs(): s = SETTING("Default") assert 'testkwargs' not in s.keys() s.updates(testkwargs='get') assert s.get('testkwargs') == 'get'