Exemple #1
0
 def __init__(self,Pathx, B):
     path = "/media/iglu/Data/DatasetIglu"
     i = 0
     Analysis.initial()
     files = open("Output_1_L.txt", 'w')
     start_time = timeit.default_timer()
     for x in os.listdir(path):
         # if i == 0:
         #     i += 1
         #     continue
         # else:
         if Pathx != x:
             continue
         for y in os.listdir(path + "/" + x) :
             if (y != "Objects.txt") and not y.endswith(".zip"):
                 # print path+"/"+x+"/"+y+"/k1"
                 f = open(path + "/" + x + "/" + y + "/k1" + "/List.txt", 'r')
                 f2 = open(path + "/" + x + "/" + y + "/speech.txt", 'r')
                 speak = f2.readline()
                 if speak == 'This...':
                     sp = 1
                 elif speak == 'That...':
                     sp = 2
                 else:
                     sp = 0
                 mn = 0
                 for line in f:
                     Time = line
                     file1 = next(f).rstrip('\n')
                     file2 = next(f).rstrip('\n')
                     Label = next(f).rstrip('\n')
                     # files.write(RGB.__str__())
                     # files.write(Depth.__str__())
                     # files.write(Label+" "+x+" "+file1+"\n")
                     if mn == 0:
                         RGB = cv2.imread(path + "/" + x + "/" + y + "/k1" + "/RGB/" + file1)
                         Depth = cv2.imread(path + "/" + x + "/" + y + "/k1" + "/Depth/" + file2)
                         Analysis.addDepth(Depth)
                         Analysis.addRGB(RGB)
                         Analysis.addSpeech(sp)
                         Analysis.addScene(Label)
                     else:
                         if mn == 2:
                             mn = -1
                     mn += 1
             # print "Enviado " + x + " " + y
         i += 1
     elapsed = timeit.default_timer() - start_time
     print "Tiempo: " + elapsed.__str__()
     print "Starting Training"
     start_time = timeit.default_timer()
     Analysis.CompleteAnalysis(B, False, True, 0.3, files)
     files.close()
     # Analysis.Mostrar()
     # code you want to evaluate
     elapsed = timeit.default_timer() - start_time
     print "Tiempo: " + elapsed.__str__()
Exemple #2
0
    def __init__(self,B):
        path = "/media/iglu/Data/Dataset/DatasetIglu/Dataset_cleaned_v4"
        i = 0
        Analysis.initial()
        files = open("Output_1_L.txt", 'w')
        start_time = timeit.default_timer()
        for x in os.listdir(path):
            # if i == 0:
            #     i += 1
            #     continue
            # else:

            f = open(path+"/"+x+"/List.txt",'r')
            for line in f:
                Time = line
                file1 = next(f).rstrip('\n')
                file2 = next(f).rstrip('\n')
                Label = next(f).rstrip('\n')
                RGB = cv2.imread(path+"/"+x+"/RGB/"+file1)
                Depth = cv2.imread(path+"/"+x+"/Depth/"+file2)
                # files.write(RGB.__str__())
                # files.write(Depth.__str__())
                # files.write(Label+" "+x+" "+file1+"\n")
                Analysis.addDepth(Depth)
                Analysis.addRGB(RGB)
                Analysis.addScene(Label)
                i += 1
            print "Enviado "+x
            # if i > 150:
            #     break
        elapsed = timeit.default_timer() - start_time
        print "Tiempo: "+elapsed.__str__()
        print "Starting Training"
        start_time = timeit.default_timer()
        Analysis.CompleteAnalysis(B,True,0.3,files)
        files.close()
        #Analysis.Mostrar()
        # code you want to evaluate
        elapsed = timeit.default_timer() - start_time
        print "Tiempo: "+elapsed.__str__()
Exemple #3
0
    def __init__(self):
        def nothing(x):
            pass
        self.node_name = "cv_bridge_demo"
        rospy.init_node(self.node_name)
        self.BoW = BoW.BoW("/home/iglu/catkin_ws/src/RGBDHand/src/bof.pkl")
        Analysis.initial()
        # What we do during shutdown
        rospy.on_shutdown(self.cleanup)
        # Create the OpenCV display window for the RGB image
        self.cv_window_name = self.node_name
        cv.NamedWindow(self.cv_window_name, cv.CV_WINDOW_NORMAL)
        cv.MoveWindow(self.cv_window_name, 25, 75)

        # And one for the depth image
        cv.NamedWindow("Depth Image", cv.CV_WINDOW_NORMAL)
        cv.MoveWindow("Depth Image", 25, 350)

        # And one for the depth image
        cv.NamedWindow("Histogram", cv.CV_WINDOW_NORMAL)
        cv.MoveWindow("Histogram", 480, 350)

        self.bridge = CvBridge()

        self.Im_p = Image_Process.Image_Process()
        # Subscribe to the camera image and depth topics and set
        # the appropriate callbacks
        self.RGB_sub = message_filters.Subscriber('/camera/rgb/image_raw', Image)
        self.Depth_sub = message_filters.Subscriber('/camera/depth/image_raw', Image)
        # rospy.Subscriber('Scene',String,callbackS)

        self.ts = message_filters.ApproximateTimeSynchronizer([self.RGB_sub, self.Depth_sub], 1,1)
        # self.image_sub = rospy.Subscriber("/camera/rgb/image_rect_color", Image, self.image_callback)
        # self.depth_sub = rospy.Subscriber("/camera/depth/image_raw", Image, self.depth_callback)
        self.ts.registerCallback(self.image_callback)
        self.depth = np.zeros((480,680))
        rospy.loginfo("Waiting for image topics...")
Exemple #4
0
import os
import Image_Process
import cv2
import cv2.cv as cv
import numpy as np
import BoW
import SVM
import Analysis
import Descriptors
B = BoW.BoW("BoWSS.pkl")
# if B.loaded:
#     print "BoW already computed"
#     exit
path = "/media/iglu/Data/rgbd-dataset"
i = 0
Analysis.initial()
start_time = timeit.default_timer()
i = 0
for x in os.listdir(path):
    # if i == 0:
    #     i += 1
    #     continue
    # else:
    mn=0
    D=False
    R=False
    if x.startswith("Test"):
        continue
    for y in os.listdir(path + "/" + x):
        for z in os.listdir(path +"/"+x +"/"+y+"/"):
            if z.endswith("_crop.png"):