# 这里用的python2 在ubuntu 18.04 ros-melodic 上运行
import cv2
import numpy as np
img = cv2.imread('1.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# 120 指的是超过这个灰度的值都转为255
ret, thresh = cv2.threshold(gray, 120, 255, cv2.THRESH_BINARY)
# RETR_TREE 指全部边框
image,contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
contours = contours[1:]
cv2.drawContours(img,contours,-1,(255,0,255),1)
cv2.imshow('img',img)
cv2.waitKey(0)
傅里叶变换
https://www.bilibili.com/video/BV1Nb411T7Fu/?spm_id_from=333.788.videocard.2
https://www.bilibili.com/video/BV1y4411S7um/?spm_id_from=333.788.videocard.9