Exemple #1
0
    def triggerframe(self, request, context):
        self.__pcins.captureframe()
        self.__width = self.__pcins.getframewidth()
        self.__height = self.__pcins.getframeheight()
        self.__hasframe = True

        return pxmsg.Empty()
Exemple #2
0
    def getnormals(self):
        """
        get the the normals of the pointcloudas an array

        :return: np.array n-by-3
        author: weiwei
        date: 20191208
        """

        nrmls = self.stub.getnormals(pxmsg.Empty())
        return np.frombuffer(nrmls.points).reshape((-1, 3))
Exemple #3
0
    def getpcd(self):
        """
        get the full poind cloud of a new frame as an array

        :return: np.array point cloud n-by-3
        author: weiwei
        date: 20191202
        """

        pcd = self.stub.getpcd(pxmsg.Empty())
        return np.frombuffer(pcd.points).reshape((-1, 3))
Exemple #4
0
    def gettextureimg(self):
        """
        get gray image as an array

        :return: a textureHeight*textureWidth*1 np array
        author: weiwei
        date: 20191202
        """

        txtreimg = self.stub.gettextureimg(pxmsg.Empty())
        txtrenparray = self.__unpackarraydata(txtreimg)
        maxvalue = np.amax(txtrenparray)
        txtrenparray = txtrenparray / maxvalue * 255
        return txtrenparray.astype(np.uint8)
Exemple #5
0
    def getdepthimg(self):
        """
        get depth image as an array

        :return: a depth array array (float32)

        author: weiwei
        date: 20191202
        """

        depthimg = self.stub.getdepthimg(pxmsg.Empty())
        depthnparray = self.__unpackarraydata(depthimg)
        depthnparray_float32 = copy.deepcopy(depthnparray)
        # depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(depthnparray, alpha=0.08), cv2.COLORMAP_JET)
        # convert float32 deptharray to unit8
        # maxdepth = np.max(depthnparray)
        # mindepth = np.min(depthnparray[depthnparray != 0])
        # depthnparray[depthnparray!=0] = (depthnparray[depthnparray!=0]-mindepth)/maxdepth*200+55
        # depthnparray = depthnparray.astype(dtype= np.uint8)
        # depthnparray_scaled = copy.deepcopy(depthnparray)
        return depthnparray_float32
Exemple #6
0
 def triggerframe(self):
     self.stub.triggerframe(pxmsg.Empty())
Exemple #7
0
    def getrgbtextureimg(self):
        rgbtxtimg = self.stub.getrgbtextureimg(pxmsg.Empty())
        rgbtxtnparray = self._unpackarraydata(rgbtxtimg)

        return rgbtxtnparray.astype(np.uint8)[:, :, ::-1]