Пример #1
0
 def _enf_conn_c(self, k):
     width = self.labels.shape[1]
     height = self.labels.shape[0]
     labels = np.array(self.labels.flatten(), dtype=np.int32)
     labels, self.labels_cnt = enf_conn.enforce_connectivity(labels, width, height, k)
     labels.shape = (height, width)
     self.labels = np.array(labels, dtype=np.int)
Пример #2
0
 def enf_conn_c(self):
     width = int(self.lab.shape[1])
     height = int(self.lab.shape[0])       
     k = int(self.k.value)       
     labels = np.zeros(self.lab.shape, np.int32)
     labval = self.lab.value
     labels[:,:] = labval[:,:,3]
     nlabels, numLabels = enf_conn.enforce_connectivity(labels.flatten(), width, height, k)
     nlabels.shape = self.lab.shape
     labval[:,:,3] = nlabels
     self.label_map_np = nlabels
     self.lab.value = labval
     self.final_lbl_cnt = numLabels