예제 #1
0
     print foundRHand
     newx,newy,neww,newh = foundRHand
     
     # check for left in same frame and in num_attmept next frames
     for i in range(NUM_LEFT_ATTMEPTS):
         lhands = handDetect(hand_cascade, image, detectLeft = True, getNegSamples = False)
         lhValidator.feedNewHandList(lhands)
         if lhValidator.checkForDetectionAndUpdateCounter():
             
             foundLHand = np.array(lhValidator.foundHandPos)
             foundLHand = HandDetection.convertLHdet_to_imgCoords(foundLHand, origSize=(160,120))
             if HandDetection.validateLH_RelativeToRH(foundLHand, foundRHand):
                 lbeep.play()
                 fullResIm = HandDetection.getFullResImage(camera , fullResStream ,(160*RESIZE_FULL_RES_FACTOR , 120*RESIZE_FULL_RES_FACTOR))
                 foundLHandFullSize = RESIZE_FULL_RES_FACTOR*foundLHand
                 commandMenu.readCommand(fullResIm,foundLHandFullSize,foundRHandFullSize)
                 fullResStream.seek(0)
                 fullResStream.truncate()
                 camera.resolution = (160,120)
     
     
         camera.capture(stream, format='bgr' , use_video_port = True)
         image = stream.array
         cv2.imshow('image',image)
         
         
        
 
 cv2.imshow('image',image)
 if cv2.waitKey(1) & 0xFF == ord('q'):
     break
예제 #2
0
import commandMenu
import cv2

image = cv2.imread('/home/pi/Desktop/Apps/OCR_App/b.jpg')
commandMenu.readCommand(image, [0, 0, 0, 0], [87, 300, 100, 100])
예제 #3
0
                hands = handDetect(image , False)
                rhValidator.feedNewHandList(hands)
                if rhValidator.checkForDetectionAndUpdateCounter():
                    beep.play()

                    camera.resolution = (800,600)
                    camera.capture(fullResStream, format='bgr' , use_video_port = True)
                    fullresIm = fullResStream.array
                    #print rhValidator.foundHandPos
                    foundRHand = np.array(rhValidator.foundHandPos)
                    foundRHand = 5*foundRHand
                    print foundRHand
                    leftHand = [0,0,0,0]
                    
                    
                    commandMenu.readCommand(fullresIm,leftHand,foundRHand)
                    newx,newy,neww,newh = foundRHand
                    cv2.rectangle(fullresIm,(newx,newy),(newx+neww,newy+newh),(255,0,0),2)
                    cv2.imwrite('./Origimg.jpg',fullresIm)
                    fullResStream.seek(0)
                    fullResStream.truncate()
                    camera.resolution = (160,120)
                    
                       
                
                cv2.imshow('image',image)
                if cv2.waitKey(1) & 0xFF == ord('q'):
                    break
                stream.seek(0)
                stream.truncate()
           
import commandMenu
import cv2

image=cv2.imread('/home/pi/Desktop/Apps/OCR_App/b.jpg')
commandMenu.readCommand(image,[0,0,0,0],[87,300,100,100])