def preprocess(self, mode="Blue"):
     gray = cv2.cvtColor(self.bgr, cv2.COLOR_BGR2GRAY)
     if mode == "Blue":
         self.mode = "Blue"
         self.gray = gray  #iicontrast(gray)#contrast(gray)#equalized_image = cv2.equalizeHist(self.gray)
     else:
         self.mode = "Yellow"
         self.gray = 255 - gray
     self.DoG = DoG(self.gray)  #Difference of Gaussians
     self.laplacian = Laplacian(self.gray, needcontrast=False)
     self.thr = AdaptiveThreshold(self.laplacian)
     self.thr = maskize(self.thr, self.DoG)
示例#2
0
 def preprocess(self, image):
     self.bgr = image
     gray = cv2.cvtColor(self.bgr, cv2.COLOR_BGR2GRAY)
     self.gray = icontrast(255 - gray)
     self.laplacian = Laplacian(gray)
     #self.sobel = Sobel(gray)
     #self.entropy = Entropy(gray)
     #self.garbor = Garbor(gray)
     self.DoG = DoG(gray)
     self.lthr = AdaptiveThreshold(self.laplacian)
     self.tophat = tophatmask(gray)
     #tophatblackhat(gray)
     masks = []
     #masks.append(self.tophat)
     masks.append(self.DoG)
     self.compose = maskize(self.lthr, masks)
     self.contour = np.zeros((self.compose.shape[:2]), np.uint8)