<commit_before>#!/usr/bin/python2
import sys, getopt
sys.path.append('lib')
import cv2 
from cv2 import cv
import numpy as np
from freenect import sync_get_depth as get_depth, sync_get_video as get_video
from math import tan
from imgproc import *

def update_lowerH(value):
    imgproc.GREEN_MIN[0] = value

def update_lowerS(value):
    imgproc.GREEN_MIN[1] = value
    
def update_lowerV(value):
    imgproc.GREEN_MIN[2] = value
    
def update_upperH(value):
    imgproc.GREEN_MAX[0] = value
    
def update_upperS(value):
    imgproc.GREEN_MAX[1] = value
    
def update_upperV(value):
    imgproc.GREEN_MAX[2] = value
    
# 0 - Kinect
# 1 - Webcam
# 2 - File
action = 0





imgproc = imgproc(-1)

cv2.namedWindow('Display Window')
cv2.namedWindow('Thresh View')
cv2.namedWindow('Tuning Window')
cv.CreateTrackbar("Lower H", 'Tuning Window', imgproc.GREEN_MIN[0], 255, update_lowerH)
cv.CreateTrackbar("Lower S", 'Tuning Window', imgproc.GREEN_MIN[1], 255, update_lowerS)
cv.CreateTrackbar("Lower V", 'Tuning Window', imgproc.GREEN_MIN[2], 255, update_lowerV)
cv.CreateTrackbar("Upper H", 'Tuning Window', imgproc.GREEN_MAX[0], 255, update_upperH)
cv.CreateTrackbar("Upper S", 'Tuning Window', imgproc.GREEN_MAX[1], 255, update_upperS)
cv.CreateTrackbar("Upper V", 'Tuning Window', imgproc.GREEN_MAX[2], 255, update_upperV)

while 1:
    
    # Load the image from the camera (or a static file for testing)
    if len(sys.argv) > 1:
        cam_img = cv2.imread(sys.argv[1], cv2.CV_LOAD_IMAGE_COLOR)
    else:
        cam_img, _ = get_video()

    #cam_img = cv2.blur(cam_img,(3,3))
    	
    rects, rects_img = imgproc.doImgProc(cam_img)
    for i in range(len(rects)):
        print rects[i].x + rects[i].width/2, rects[i].y + rects[i].height/2
    
    
    cv2.imshow('Display Window', rects_img)
    cv2.imshow('Thresh View', imgproc.thresh_img)
    if cv2.waitKey(5) == 27:
        break
            
cv2.destroyAllWindows()
<commit_msg>implementing Kinect class in tuningHelper<commit_after>#!/usr/bin/python2
import sys, getopt
sys.path.append('lib')
import cv2 
from cv2 import cv
import numpy as np
from freenect import sync_get_depth as get_depth, sync_get_video as get_video
from math import tan
from imgproc import *
from Kinect import Kinect

def update_lowerH(value):
    imgproc.GREEN_MIN[0] = value

def update_lowerS(value):
    imgproc.GREEN_MIN[1] = value
    
def update_lowerV(value):
    imgproc.GREEN_MIN[2] = value
    
def update_upperH(value):
    imgproc.GREEN_MAX[0] = value
    
def update_upperS(value):
    imgproc.GREEN_MAX[1] = value
    
def update_upperV(value):
    imgproc.GREEN_MAX[2] = value
    
# 1 - Webcam
# 2 - File
action = 1





imgproc = imgproc(0)
kinect = None
if len(sys.argv) > 1:
    kinect = Kinect()

cv2.namedWindow('Display Window')
cv2.namedWindow('Thresh View')
cv2.namedWindow('Tuning Window')
cv.CreateTrackbar("Lower H", 'Tuning Window', imgproc.GREEN_MIN[0], 255, update_lowerH)
cv.CreateTrackbar("Lower S", 'Tuning Window', imgproc.GREEN_MIN[1], 255, update_lowerS)
cv.CreateTrackbar("Lower V", 'Tuning Window', imgproc.GREEN_MIN[2], 255, update_lowerV)
cv.CreateTrackbar("Upper H", 'Tuning Window', imgproc.GREEN_MAX[0], 255, update_upperH)
cv.CreateTrackbar("Upper S", 'Tuning Window', imgproc.GREEN_MAX[1], 255, update_upperS)
cv.CreateTrackbar("Upper V", 'Tuning Window', imgproc.GREEN_MAX[2], 255, update_upperV)

while 1:
    
    # Load the image from the camera (or a static file for testing)
    if len(sys.argv) > 1:
        if action == 2:
            cam_img = cv2.imread(sys.argv[1], cv2.CV_LOAD_IMAGE_COLOR)
        elif action == 1:
            cam_img = imgproc.getCameraImage()
    else:
        cam_img = kinect.get_video()

    
    	
    rects, rects_img = imgproc.doImgProc(cam_img)
    for i in range(len(rects)):
        print rects[i].x + rects[i].width/2, rects[i].y + rects[i].height/2
    
    
    cv2.imshow('Display Window', rects_img)
    cv2.imshow('Thresh View', imgproc.thresh_img)
    if cv2.waitKey(5) == 27:
        break
            
cv2.destroyAllWindows()

{'fraction_non_alphanumeric': 0.12466191295795427, 'fraction_numerical': 0.028276370789279567, 'mean_word_length': 3.791519434628975, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '900204', 'n_tokens_mistral': 1575, 'n_tokens_neox': 1507, 'n_words': 341}