1 Star 0 Fork 0

celoran/ParticleTracking

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
detection_gradient.py 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
celoran 提交于 2019-05-04 11:11 . init commit
import numpy as np # Arrays
import cv2 # OpenCV
############ SPECIFIC FUNCTIONS ###############
class GradientClass(object):
def __init__(self):
pass
def get_sobel(self, img, dirx, diry):
# Return thresholded sobel in specified direction
sobel = cv2.Sobel(img, cv2.CV_64F, dirx, diry, ksize=self.Vars['sobel_ksize'])
sobel = np.absolute(sobel)
sobel = sobel - sobel.min() # Rescale to 0-255 values
thresh = np.zeros(sobel.shape, np.uint8)
thresh[sobel > self.Vars['sobel_thresh']] = 255
sobel = thresh.copy()
sobel = self.morphology(sobel)
return sobel
def binarization(self, frame_gray, *args):
# Treat image and return binary
sobelx = self.get_sobel(frame_gray, self.Vars['sobel_order'], 0)
sobely = self.get_sobel(frame_gray, 0, self.Vars['sobel_order'])
sobelBoth = cv2.bitwise_or(sobelx, sobely)
return sobelBoth
if __name__ == '__main__':
import detection_main
detection_main.start_program(trackMethod='auto', mode='gradient', GUI=False)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/celoran/ParticleTracking.git
git@gitee.com:celoran/ParticleTracking.git
celoran
ParticleTracking
ParticleTracking
master

搜索帮助