Exemplo n.º 1
0
detector = buildDetector()

# Define the codec and create VideoWriter object
out = cv2.VideoWriter('results.avi', -1, 15.0, (568, 640), True)

while (True):
    i += 1

    file_path = "frames_" + "%04d" % i + ".png"
    print file_path
    frame = cv2.imread(file_path, 1)
    if frame == None:
        break

    #Find keypoints
    keypoints, _ = findHolds(frame, detector)

    #colors = findColors(frame,keypoints)

    frameWithKeypoints = cv2.drawKeypoints(frame, keypoints, -1, [0, 0, 255])
    results = np.concatenate((frame, frameWithKeypoints), axis=0)

    print results.shape

    out.write(results)

    cv2.imshow('frame', results)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

#cap.release()
Exemplo n.º 2
0
"""Example"""

import holdDetector as hd

#Open dialog to select image
img = hd.openImage()

# Set initial detector parameters
hd.buildDetector(minArea = 500)

# Finds each hold. Returns keypoints for each hold
# and the points that define the contours of each hold
holds, contours = hd.findHolds(img)

#Finds a color associated with each keypoint
colors = hd.findColors(img,holds)

#Draws keypoints onto image and plots colors in 3D space
hd.draw(img,holds)
hd.plotColors(colors)


Exemplo n.º 3
0
shape = (x,y)

# Open VideoWriter object
#codec = cv2.cv.CV_FOURCC('Y','V','1','2')
out = cv2.VideoWriter(path[:-4] + '-out.avi',-1, 30.0, shape,True)



while(cap.isOpened()):
    # Capture frame-by-frame
    ret, frame = cap.read()
    if not ret:
        break

    # Find keypoints
    keypoints, hulls = findHolds(frame)


    frameWithKeypoints = cv2.drawKeypoints(frame,keypoints,-1,[0,0,255])
    #cv2.drawContours(frame,hulls,-1,[255,0,0])
    results = np.concatenate((frame, frameWithKeypoints), axis=axis)

    # Write image to video out
    out.write(results)  

    cv2.imshow('frame',results)
    
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
    
Exemplo n.º 4
0
cap = cv2.VideoCapture(0)
# Define the codec and create VideoWriter object
out = cv2.VideoWriter("webcam\\"+relpath,-1, 15.0, (640*2, 960/2),True)
detector = buildDetector()


while (cap.isOpened()):
    start = time.time()

    # Pull in frame from webcam
    retval, frame = cap.read()
    if retval == False:
        break

    #Find keypoints
    keypoints, _ = findHolds(frame,detector)

    #Draw Keypoints onto frame
    frameWithKeypoints = cv2.drawKeypoints(frame,keypoints,-1,[0,0,255])

    #Display frame with keypoint frame side by side.
    results = np.concatenate((frame, frameWithKeypoints), axis=1)
    
    # Write image to video out
    out.write(results)

    #Display for user.
    cv2.imshow('frame',results)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
Exemplo n.º 5
0


while(cap.isOpened()):
    mask2 = np.zeros((c,r))

    mask3 = np.zeros((c,r))


    # Capture frame-by-frame
    ret, frame = cap.read()
    if not ret:
        break

    #Find keypoints
    keypoints, _ = findHolds(frame)

    for key in keypoints:
        #mask[key.pt] =+25
        cv2.circle(mask2,(int(key.pt[1]),int(key.pt[0])),5,2,-1)
    
    mask += 
    mask[mask > 0] = mask[mask > 0] - 1

    mask3 = mask2 > 200

    """
    for r,row in enumerate(mask):
        for c,col in enumerate(row):
            if mask[r,c] > 1:
                cv2.circle(frame,(r,c),10,[0,0,255],-1)