コード例 #1
0
ファイル: testVision.py プロジェクト: trigrass2/bbauv
 def camCallback(self, rosimg):
     rospy.loginfo("Inside cam")
     cvImg = Utils.rosimg2cv(rosimg)
     board = Img(cvImg, b_lowThresh, b_hiThresh)
     self.drawBoard(board.maskImg,board.mask_bgr)
     peg = Img(cvImg, p_lowThresh, p_hiThresh)
     slot = Img(cvImg, s_lowThresh, s_hiThresh)
     slot.maskImg = static.morph(slot.maskImg)
     slot.mask_bgr = cv2.cvtColor(slot.maskImg, cv2.COLOR_GRAY2BGR)
     total_img = cv2.bitwise_or(slot.mask_bgr, peg.mask_bgr)
     total_img = cv2.bitwise_or(total_img, board.mask_bgr)
     self.drawSlot(slot.maskImg, total_img)
     self.drawPeg(peg.maskImg, total_img)
     self.publishImg(board, total_img)
コード例 #2
0
ファイル: testVision.py プロジェクト: trigrass2/bbauv
 def __init__(self, img, min, max):
     self.rawImg = cv2.resize(img, (640, 480))
     #self.preHsv = static.whiteBal(self.rawImg)
     self.preHsv = static.blurr(self.rawImg)
     #self.preHsv = static.removeLumi(self.preHsv)
     self.hsvImg = cv2.cvtColor(self.preHsv, cv2.COLOR_BGR2HSV)
     self.enhancedImg = self.hsvImg
     self.labImg = cv2.cvtColor(self.rawImg, cv2.COLOR_BGR2LAB)
     self.lab_bgr = cv2.cvtColor(static.labSetup(self.labImg), cv2.COLOR_GRAY2BGR)
     self.grayImg = cv2.cvtColor(self.rawImg, cv2.cv.CV_BGR2GRAY)
     self.grayImg = cv2.threshold(self.grayImg,50,255, cv2.THRESH_TRUNC)[1]
     self.gray_bgr = cv2.cvtColor(self.grayImg, cv2.COLOR_GRAY2BGR)
     self.enhanced_bgr = cv2.cvtColor(self.enhancedImg, cv2.COLOR_HSV2BGR)
     self.maskImg = static.morph(static.inRange(self.labImg, min, max))
     self.mask_bgr = cv2.cvtColor(self.maskImg, cv2.COLOR_GRAY2BGR)
     #static.circleCont(self.maskImg, self.mask_bgr)
     self.detected = False
     self.container = []