Loading dataset.py +5 −5 Original line number Diff line number Diff line Loading @@ -104,8 +104,8 @@ class DataSet(object): from opticalscan import loadAndPasteImage # try to load png and check for detection contours buggyimage = recreatefullimage if not buggyimage and os.path.exists(self.getLegacyImageName()): recreatefullimage = recreatefullimage or not os.path.exists(self.getLegacyImageName()) if not recreatefullimage: img = cv2imread_fix(self.getLegacyImageName()) Nc = len(self.particlecontours) if Nc>0: Loading @@ -113,12 +113,12 @@ class DataSet(object): contpixels = img[contour[:,0,1],contour[:,0,0]] if np.all(contpixels[:,1]==255) and np.all(contpixels[:,2]==0) \ and np.all(contpixels[:,0]==0): buggyimage = True if not buggyimage: recreatefullimage = True if not recreatefullimage: cv2imwrite_fix(self.getImageName(), img) del img if buggyimage: if recreatefullimage: print("recreating fullimage from grid data") imgdata = None zvalimg = None Loading segmentation.py 100755 → 100644 +8 −1 Original line number Diff line number Diff line Loading @@ -279,6 +279,10 @@ class Segmentation(object): if return_step=="contrastcurve": return gray, 0 # image blur for noise-reduction if self.blurRadius%2 != 1: self.blurRadius += 1 print('blur Radius was an even number, incremented blur Radius by 1') blur = cv2.medianBlur(gray, self.blurRadius) blur = np.uint8(blur*(255/blur.max())) if return_step=="blurRadius": return blur, 0 Loading Loading @@ -331,7 +335,10 @@ class Segmentation(object): h, w = sure_fg.shape[:2] mask = np.zeros((h+2, w+2), np.uint8) for p in np.int32(deletepoints): if p[0] >= 0 and p[1] >= 0: cv2.floodFill(sure_fg, mask, tuple(p), 0) else: print('skipped del point at {}'.format(p)) for p in np.int32(deletepoints): cv2.circle(sure_fg, tuple(p), int(seedradius), 0, -1) Loading Loading
dataset.py +5 −5 Original line number Diff line number Diff line Loading @@ -104,8 +104,8 @@ class DataSet(object): from opticalscan import loadAndPasteImage # try to load png and check for detection contours buggyimage = recreatefullimage if not buggyimage and os.path.exists(self.getLegacyImageName()): recreatefullimage = recreatefullimage or not os.path.exists(self.getLegacyImageName()) if not recreatefullimage: img = cv2imread_fix(self.getLegacyImageName()) Nc = len(self.particlecontours) if Nc>0: Loading @@ -113,12 +113,12 @@ class DataSet(object): contpixels = img[contour[:,0,1],contour[:,0,0]] if np.all(contpixels[:,1]==255) and np.all(contpixels[:,2]==0) \ and np.all(contpixels[:,0]==0): buggyimage = True if not buggyimage: recreatefullimage = True if not recreatefullimage: cv2imwrite_fix(self.getImageName(), img) del img if buggyimage: if recreatefullimage: print("recreating fullimage from grid data") imgdata = None zvalimg = None Loading
segmentation.py 100755 → 100644 +8 −1 Original line number Diff line number Diff line Loading @@ -279,6 +279,10 @@ class Segmentation(object): if return_step=="contrastcurve": return gray, 0 # image blur for noise-reduction if self.blurRadius%2 != 1: self.blurRadius += 1 print('blur Radius was an even number, incremented blur Radius by 1') blur = cv2.medianBlur(gray, self.blurRadius) blur = np.uint8(blur*(255/blur.max())) if return_step=="blurRadius": return blur, 0 Loading Loading @@ -331,7 +335,10 @@ class Segmentation(object): h, w = sure_fg.shape[:2] mask = np.zeros((h+2, w+2), np.uint8) for p in np.int32(deletepoints): if p[0] >= 0 and p[1] >= 0: cv2.floodFill(sure_fg, mask, tuple(p), 0) else: print('skipped del point at {}'.format(p)) for p in np.int32(deletepoints): cv2.circle(sure_fg, tuple(p), int(seedradius), 0, -1) Loading