day2 # # 提取图像透视转换 # img=cv2.imread("F:/google/fktest.jpg") # cv2.imshow("Init",img) # width,height=250,250 # waitdots=np.float32([[308,319],[366,300],[381,345],[437,321]]) # resultd=np.float32([[0,0],[width,0],[0,height],[width,height]]) # martix=cv2.getPerspectiveTransform(waitdots,resultd) # imgout=cv2.warpPerspective(img,martix,(width,height)) # cv2.imshow("out2",imgout) # cv2.waitKey(0) # # 图像堆叠 # imgHor=np.hstack((img,img)) # imgVer=np.vstack((img,img)) # cv2.imshow("1",imgHor) # cv2.imshow("2",imgVer) # cv2.waitKey(0) # # 色彩提取 # def emptyFun(): # pass # cv2.namedWindow("TrackBars") # cv2.resizeWindow("TrackBars",640,240) # cv2.createTrackbar("Hue Min","TrackBars",0,179,emptyFun) # cv2.createTrackbar("Hue Max","TrackBars",179,179,emptyFun) # cv2.createTrackbar("Sat Min","TrackBars",0,255,emptyFun) # cv2.createTrackbar("Sat Max","TrackBars",255,255,emptyFun) # cv2.createTrackbar("Val Min","TrackBars",0,255,emptyFun) # cv2.createTrackbar("Val Max","TrackBars",255,255,emptyFun) # while True: # img = cv2.imread("F:/google/qc.jpg") # imgHSV=cv2.cvtColor(img,cv2.COLOR_BGR2HSV) # h_min=cv2.getTrackbarPos("Hue Min","TrackBars") # h_max=cv2.getTrackbarPos("Hue Max","TrackBars") # s_min=cv2.getTrackbarPos("Sat Min","TrackBars") # s_max=cv2.getTrackbarPos("Sat Max","TrackBars") # v_min=cv2.getTrackbarPos("Val Min","TrackBars") # v_max=cv2.getTrackbarPos("Val Max","TrackBars") # # print(h_min,h_max,s_min,s_max,v_min,v_max) # low=np.array([h_min,s_min,v_min]) # high = np.array([h_max, s_max, v_max]) # mask=cv2.inRange(imgHSV,low,high) # imgRes=cv2.bitwise_and(img,img,mask=mask) # cv2.imshow("0",img) # cv2.imshow("1",imgHSV) # cv2.imshow("2", mask) # cv2.imshow("3", imgRes) # cv2.waitKey(1) # # until 7522