Exemple #1
0
    def getdepthraw(self, request, context):
        """
        get raw ddsaasaepth image

        :return: a raw depth image
        author: weiwei
        date: 20181121
        """

        dframe = self.__kinect.getDepthFrame()
        return fkmsg.ReturnValue(data=yaml.dump(dframe))
Exemple #2
0
    def mapColorPointToCameraSpace(self, request, context):
        """
        convert color space  , to depth space point

        :param pt:
        :return:
        author: weiwei
        date: 20181121
        """

        return fkmsg.ReturnValue(data = self.__kinect.mapColorPointToCameraSpace([request.data0, request.data1]))
Exemple #3
0
    def getdeptharray(self, request, context):
        """
        get depth image as an array

        :return: a depthHeight*depthWidth*3 np array, the second and third channels are repeated
        author: weiwei
        date: 20180207
        """

        dframe = self.__kinect.getDepthFrame()
        df8 = np.uint8(dframe.clip(1, 4000) / 16.)
        dframe8bit = np.dstack((df8, df8, df8)).reshape((self.__kinect.depthHeight, self.__kinect.depthWidth, 3))
        return fkmsg.ReturnValue(data=yaml.dump(dframe8bit))
Exemple #4
0
    def getrgbarray(self, request, context):
        """
        get color image as an array

        :return: a colorHeight*colorWidth*4 np array, the second and third channels are repeated
        author: weiwei
        date: 20180207
        """

        clframe = self.__kinect.getColorFrame()
        clb = np.flip(np.array(clframe[0::4]).reshape((self.__kinect.colorHeight, self.__kinect.colorWidth)),1)
        clg = np.flip(np.array(clframe[1::4]).reshape((self.__kinect.colorHeight, self.__kinect.colorWidth)),1)
        clr = np.flip(np.array(clframe[2::4]).reshape((self.__kinect.colorHeight, self.__kinect.colorWidth)),1)
        clframe8bit = np.dstack((clb, clg, clr)).reshape((self.__kinect.colorHeight, self.__kinect.colorWidth, 3))
        return fkmsg.ReturnValue(data=yaml.dump(clframe8bit))
Exemple #5
0
    def getpcdarray(self, request, context):
        """
        get the full poind cloud of a new frame as an array

        :param mat_tw yaml string storing mat_tw
        :return: np.array point cloud n-by-3
        author: weiwei
        date: 20181121
        """

        dframe = self.__kinect.getDepthFrame()
        if self.__oldyaml:
            mat_kw = yaml.load(request.data)
        else:
            mat_kw = yaml.load(request.data, Loader=yaml.UnsafeLoader)
        pcdarray = self.__kinect.getPointCloud(dframe, mat_tw=mat_kw)
        return fkmsg.ReturnValue(data=yaml.dump(pcdarray))
Exemple #6
0
    def getpartialpcdarray(self, request, context):
        """
        get partial poind cloud using the given picklerawdframe, width, height in a depth img

        :param rawdframe yaml string storing raw dframe
        :param width, height
        :param picklemat_tw pickle string storing mat_tw
``````````````        author: weiwei
        date: 20181121
        """

        if self.__oldyaml:
            dframe = yaml.load(request.data)
        else:
            dframe = yaml.load(request.data, Loader=yaml.UnsafeLoader)
        width = [request.width.data0, request.width.data1]
        height = [request.height.data0, request.width.data1]
        if self.__oldyaml:
            mat_kw = yaml.load(request.matkw.data)
        else:
            mat_kw = yaml.load(request.matkw.data, Loader=yaml.UnsafeLoader)
        pcdarray = self.__kinect.getPointCloud(dframe, width, height, mat_kw=mat_kw)
        return fkmsg.ReturnValue(data=yaml.dump(pcdarray))