def processFrame(self):
# If we are enhancing the image
if self.enhance:
# Frangi vesselness to highlight tubuar structures
gray = cv2.cvtColor(self.sourceFrame, cv2.COLOR_BGR2GRAY)
tub = tubes(gray, [5, 12])
tubular = cv2.cvtColor(tub, cv2.COLOR_GRAY2BGR)
# Merge with original to ennhance tubular structures
high = 0.3
rest = 1.0 - high
colorized = cv2.addWeighted(self.sourceFrame, rest, tubular, high, 0.0)
# colorized = cv2.add(self.sourceFrame, tubular)
# Tile horizontally
self.processedFrame = np.concatenate((self.sourceFrame,
tubular,
colorized),
axis=1)
else:
self.processedFrame = self.sourceFrame;
self.workingFrame = self.processedFrame.copy()
# If we are tracking, track and show analysis
if self.tracking is True:
self.trackObjects()
self.showBehavior()
评论列表
文章目录