Example #1
0
        pass

    compressionRatio = 0.4
    upscaled = cv2.resize(frame, (0,0), fx=1/compressionRatio, fy=1/compressionRatio)
    p1.drawCircle(frame)
    p2.drawCircle(frame)
    cv2.imshow('upscaled', upscaled)
    cv2.waitKey(1)
    #render frame to our scree


UDP_IP = "0.0.0.0"
UDP_PORT = 5005
if (len(sys.argv) > 1):
    UDP_PORT = int(sys.argv[1])
startListening(UDP_IP, UDP_PORT, example)


# hog = cv2.HOGDescriptor()
#     hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
#     gray_frame = cv2.cvtColor(frame_hsv, cv2.COLOR_RGB2GRAY)

#     rects, weights = hog.detectMultiScale(gray_frame)
        
#     # Measure elapsed time for detections
#     for i, (x, y, w, h) in enumerate(rects):
#         if weights[i] < 0.7:
#             continue
#         cv2.rectangle(frame, (scorpionx,y), (x+w,y+h),(0,255,0),2)

Example #2
0
        sorted_by_second = sorted(avg_arr, key=lambda tup: tup[0])

        #        cv2.rectangle(img,(sorted_by_second[0][1] , sorted_by_second[0][2]), (sorted_by_second[0][1] + sorted_by_second[0][3], sorted_by_second[0][2]+sorted_by_second[0][4]),(0,255,0),2)
        cv2.rectangle(img, (sorted_by_second[1][1], sorted_by_second[1][2]),
                      (sorted_by_second[1][1] + sorted_by_second[1][3],
                       sorted_by_second[1][2] + sorted_by_second[1][4]),
                      (255, 0, 0), 2)

    mask = cv2.inRange(frame, lower_blue1, upper_blue1)

    res = cv2.bitwise_and(frame, frame, mask=mask)
    res2 = cv2.cvtColor(res, cv2.COLOR_HSV2BGR)
    res2 = cv2.cvtColor(res2, cv2.COLOR_BGR2GRAY)
    th3 = cv2.GaussianBlur(res2, (11, 11), 1)
    th3 = cv2.adaptiveThreshold(th3,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,\
            cv2.THRESH_BINARY,11,4)
    kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (10, 10))
    th3 = cv2.erode(th3, kernel)

    cv2.imshow('pizda', frame)

    cv2.waitKey(1)
    return [sorted_by_second[1][1], sorted_by_second[1][2]]


UDP_IP = "0.0.0.0"
UDP_PORT = 64012
if (len(sys.argv) > 1):
    UDP_PORT = int(sys.argv[1])
startListening(UDP_IP, UDP_PORT, run_until)