def grab_images(): im = DS.getColourMap() cv2.imwrite("%s/rgb.png"%(imdir), im) im = DS.getDepthMap() cv2.imwrite("%s/depth.png"%(imdir), im) im = DS.getConfidenceMap() cv2.imwrite("%s/confidence.png"%(imdir), im) im = DS.getDepthColouredMap() cv2.imwrite("%s/rgbd.png"%(imdir), im) im = DS.getGreyScaleMap() cv2.imwrite("%s/gscale.png"%(imdir), im) im = DS.getSyncMap() np.save("%s/sync"%(imdir), im) im = DS.getUVMap() np.save("%s/uv"%(imdir), im) im = DS.getVertices() np.save("%s/vert"%(imdir), im) return
def getDepth(self): ''' Return a simple cv compatiable 8bit depth image ''' depth = ds.getDepthMap() np.clip(depth, 0, 2**10 - 1, depth) depth >>=2 depth = depth.astype(np.uint8) iD = Image(depth.transpose()) return iD.invert()
def getDepth(self): ''' Return a simple cv compatiable 8bit depth image ''' depth = ds.getDepthMap() np.clip(depth, 0, 2**10 - 1, depth) depth >>= 2 depth = depth.astype(np.uint8) iD = Image(depth.transpose()) return iD.invert()
def get_depthMap(): depth_mat = dsc.getDepthMap() depth_mat[depth_mat > 30000] = 0 depth_gray = depth_mat.copy() np.clip(depth_gray, 0, 2**10 - 1, depth_gray) depth_gray >>= 2 depth_gray = depth_gray.astype(np.uint8) cmap = plt.get_cmap('jet_r') depth_col = cmap(depth_gray) depth_col = np.delete(depth_col, 3, 2) depth_col = cv2.resize(depth_col, (640, 480)) depth_gray = cv2.resize(depth_gray, (640, 480)) return depth_mat, depth_gray, depth_col
def getframe(imdir, sfx): im = DS.getColourMap() cv2.imwrite("%s/rgb%s.png" % (imdir, sfx), im) #im=DS.getConfidenceMap() #cv2.imwrite("%s/confidence%s.png"%(imdir,sfx), im) #im=DS.getDepthColouredMap() #cv2.imwrite("%s/DepthColored%s.png"%(imdir,sfx), im) im = DS.getDepthMap() cv2.imwrite("%s/depth%s.png" % (imdir, sfx), im) #im=DS.getGreyScaleMap() #cv2.imwrite("%s/gscale%s.png"%(imdir,sfx), im) im = DS.getSyncMap() np.save("%s/sync%s" % (imdir, sfx), im) im = DS.getUVMap() np.save("%s/uv%s" % (imdir, sfx), im) im = DS.getVertices() np.save("%s/vert%s" % (imdir, sfx), im) return "OK"
def grab_images(imdir, i): im = DS.getColourMap() cv2.imwrite("%s/rgb-%03d.png"%(imdir,i), im) im = DS.getDepthMap() cv2.imwrite("%s/depth-%03d.png"%(imdir,i), im) im = DS.getConfidenceMap() cv2.imwrite("%s/confidence-%03d.png"%(imdir,i), im) im = DS.getDepthColouredMap() cv2.imwrite("%s/rgbd-%03d.png"%(imdir,i), im) im = DS.getGreyScaleMap() cv2.imwrite("%s/gscale-%03d.png"%(imdir,i), im) im = DS.getSyncMap() print im.shape np.save("%s/sync-%03d"%(imdir,i), im) im = DS.getUVMap() np.save("%s/uv-%03d"%(imdir,i), im) im = DS.getVertices() np.save("%s/vert-%03d"%(imdir,i), im) #subprocess.call(['python', dir_path + '/dsgrab.py']) """ {"href": "static/img/confidence.png", "name": "Confidence levels (image)"}, {"href": "static/img/rgbd.png", "name": "Coloured depth image"}, {"href": "static/img/gscale.png", "name": "Grey-scale image"} """ return [{"href": imdir+"/rgb-%03d.png"%i, "name": "RGB image"}, {"href": imdir+"/depth-%03d.png"%i, "name": "Depth image"}, {"href": imdir+"/confidence-%03d.png"%i, "name": "Confidence levels (image)"}, {"href": imdir+"/rgbd-%03d.png"%i, "name": "Coloured depth image"}, {"href": imdir+"/gscale-%03d.png"%i, "name": "Grey-scale image"}]
ds.initDepthSense() #disp = Display(flags = pg.FULLSCREEN) disp = Display() points = [] squares = [] # Main loop closes only on keyboard kill signal while True: # Get depth and colour images from the kinect image = ds.getColourMap() image = image[:,:,::-1] img = Image(image.transpose([1,0,2])) depth = ds.getDepthMap() np.clip(depth, 0, 2**10 - 1, depth) depth >>=2 depth = depth.astype(np.uint8).transpose() depth = Image(depth) depth = depth.invert() #vertex = ds.getVertices() #vertex = vertex.transpose([1,0,2]) #dblobs = depth.findBlobs(minsize=2000, maxsize=14000) dblobs = depth.findBlobs(minsize=2000) box_center = None box = None box_point = None
ds.initDepthSense() #disp = Display(flags = pg.FULLSCREEN) #disp = Display() points = [] squares = [] # Main loop closes only on keyboard kill signal while True: # Get depth and colour images from the kinect #image = ds.getColourMap() #image = image[:,:,::-1] #img = Image(image.transpose([1,0,2])) depth = ds.getDepthMap() deepDepth = depth.transpose() # later proccessing np.clip(depth, 0, 2**10 - 1, depth) depth >>= 2 depth = depth.astype(np.uint8).transpose() depth = Image(depth) depth = depth.invert() vertex = ds.getVertices() vertex = vertex.transpose([1, 0, 2]) #dblobs = depth.findBlobs(minsize=2000, maxsize=14000) dblobs = depth.findBlobs(minsize=2000, maxsize=((320 * 240) - (320 * 240 / 4))) box_center = None
def getDepthFull(self): ''' Return the pure 16bit depth map as a numpy array ''' iD = ds.getDepthMap() return iD
def getDepthFull(self): ''' Return the pure 16bit depth map as a numpy array ''' return ds.getDepthMap()
def getDepthFull(self): """ Return the pure 16bit depth map as a numpy array """ return ds.getDepthMap()