Giter Site home page Giter Site logo

Comments (18)

dongtamlx18 avatar dongtamlx18 commented on July 21, 2024 2

i can use function pcl.visualize() for
pcl = Cloud(file='models/test_cloud_4.txt'). Maybe i will try with your open3D version

from pykinect2-mapper-functions.

KonstantinosAng avatar KonstantinosAng commented on July 21, 2024 1

I have used this open3d version:

0.10.0.1

try:

pip uninstall open3d

and then:

pip install open3d==0.10.0.1

from pykinect2-mapper-functions.

KonstantinosAng avatar KonstantinosAng commented on July 21, 2024 1

I did this because the z coordinate for Kinect is the distance from Kinect to the object and the Y coordinate is the distance of the object from the ground to the Kinect. I always had the Z coordinate as the distance from the floor so I swapped the values to suit me better.

from pykinect2-mapper-functions.

akash02ita avatar akash02ita commented on July 21, 2024

if i use
img = color_2_depth_space(kinect, _ColorSpacePoint, kinect._depth_frame_data, show=False, return_aligned_image=True)
i still see 30fps.
could the issue be due to resolution?

from pykinect2-mapper-functions.

KonstantinosAng avatar KonstantinosAng commented on July 21, 2024

Unfortunately, I do not have a Kinect Device anymore to test it, but I do believe that the reason the function is slow is that I perform some operations that are only needed when you pass the show = True flag. The only reason I have put that flag is to test how the aligned image shows, but it slows down the performance by a lot. I suggest no to use the show = True, and only call this function to get the points and then decide on how you want to display them.

I will push some changes in a moment that make some computations happen only when show is True.

from pykinect2-mapper-functions.

KonstantinosAng avatar KonstantinosAng commented on July 21, 2024

Can you pull the changes and try again to see if you can see a drop in fps, but do not pass the show flag?

from pykinect2-mapper-functions.

dongtamlx18 avatar dongtamlx18 commented on July 21, 2024

hello i use this code below but terminal has a problem " "depth_2_color_space" is not defined" although i did import mapper library.

import mapper
from pykinect2 import PyKinectV2
from pykinect2.PyKinectV2 import *
from pykinect2 import PyKinectRuntime
import cv2
import numpy as np

if name == 'main':
kinect = PyKinectRuntime.PyKinectRuntime(PyKinectV2.FrameSourceTypes_Depth | PyKinectV2.FrameSourceTypes_Color)

while True:
    if kinect.has_new_depth_frame():
        color_frame = kinect.get_last_color_frame()
        colorImage = color_frame.reshape((kinect.color_frame_desc.Height, kinect.color_frame_desc.Width, 4)).astype(np.uint8)
        colorImage = cv2.flip(colorImage, 1)
        cv2.imshow('Test Color View', cv2.resize(colorImage, (int(1920 / 2.5), int(1080 / 2.5))))
        depth_frame = kinect.get_last_depth_frame()
        depth_img = depth_frame.reshape((kinect.depth_frame_desc.Height, kinect.depth_frame_desc.Width)).astype(np.uint8)
        depth_img = cv2.flip(depth_img, 1)
        cv2.imshow('Test Depth View', depth_img)
        # print(color_point_2_depth_point(kinect, _DepthSpacePoint, kinect._depth_frame_data, [100, 100]))
        # print(depth_points_2_world_points(kinect, _DepthSpacePoint, [[100, 150], [200, 250]]))
        # print(intrinsics(kinect).FocalLengthX, intrinsics(kinect).FocalLengthY, intrinsics(kinect).PrincipalPointX, intrinsics(kinect).PrincipalPointY)
        # print(intrinsics(kinect).RadialDistortionFourthOrder, intrinsics(kinect).RadialDistortionSecondOrder, intrinsics(kinect).RadialDistortionSixthOrder)
        # print(world_point_2_depth(kinect, _CameraSpacePoint, [0.250, 0.325, 1]))
        # img = depth_2_color_space(kinect, _DepthSpacePoint, kinect._depth_frame_data, show=False, return_aligned_image=True)
        depth_2_color_space(kinect, _DepthSpacePoint, kinect._depth_frame_data, show=True)
        # img = color_2_depth_space(kinect, _ColorSpacePoint, kinect._depth_frame_data, show=True, return_aligned_image=True)

    # Quit using q
    if cv2.waitKey(1) & 0xff == ord('q'):
        break

cv2.destroyAllWindows()

from pykinect2-mapper-functions.

KonstantinosAng avatar KonstantinosAng commented on July 21, 2024

try importing like this:

from mapper import *

from pykinect2-mapper-functions.

dongtamlx18 avatar dongtamlx18 commented on July 21, 2024

oh i have a problem with my code and i fixed it, thank you so much your source code is very useful.
I wonder that if there is any source code about processing pointcloud by usung KinectV2, or something related about pointcloud using KinectV2. If you have this please share me, please.
By the way, thank you so much!

from pykinect2-mapper-functions.

KonstantinosAng avatar KonstantinosAng commented on July 21, 2024

@dongtamlx18 I have another repo that I use mapper to draw real time (30fps) point clouds with color and depth simultaneously:

https://github.com/KonstantinosAng/PyKinect2-PyQtGraph-PointClouds

from pykinect2-mapper-functions.

dongtamlx18 avatar dongtamlx18 commented on July 21, 2024

You are amazing but i have a problem when i test your code. I don't know why is this happen?

from PointCloud import Cloud

pcl = Cloud(file='models/model.pcd')
(I did download model.pcd and placed it into right folder)

and information about the error:
File "e:/2022 - Nam4 - HKII/ĐATN/PythonDA-newVS/RunTest.py", line 3, in
pcl = Cloud(file='models/model.pcd')
File "e:\2022 - Nam4 - HKII\ĐATN\PythonDA-newVS\PointCloud.py", line 116, in init
self.visualize_file()
File "e:\2022 - Nam4 - HKII\ĐATN\PythonDA-newVS\PointCloud.py", line 647, in visualize_file
vis = o3d.Visualizer() # start visualizer
AttributeError: module 'open3d' has no attribute 'Visualizer'

from pykinect2-mapper-functions.

dongtamlx18 avatar dongtamlx18 commented on July 21, 2024

Helllo sir, i scroll on Youtube and people said that Open3D lib does not support create pointcloud data, i do not know does it right or not so im here to ask you about that question. And could you help me to introduce me some technique that using KinectV2 to create pointcloud? Thank you so much!
Btw, I did read your code Pointcloud repository but i did not know too much, so I ask you here. Thank you!

from pykinect2-mapper-functions.

dongtamlx18 avatar dongtamlx18 commented on July 21, 2024

from pykinect2-mapper-functions.

KonstantinosAng avatar KonstantinosAng commented on July 21, 2024

First of all, about the Open3d:

I do not know if you can create a Pointcloud with open3d, I only use it to visualize Pointcloud files (.ply, .pcd) that I create manually in my Repository. If you see my code you will see that I get the world point from Kinect and I manually create the file using the basic structure of the (.ply, .pcd) file format.

Second, about the x, y, z coordinates:

Where exactly do I swap the values because I cannot find the function ?

from pykinect2-mapper-functions.

dongtamlx18 avatar dongtamlx18 commented on July 21, 2024

from pykinect2-mapper-functions.

dongtamlx18 avatar dongtamlx18 commented on July 21, 2024

from pykinect2-mapper-functions.

KonstantinosAng avatar KonstantinosAng commented on July 21, 2024

I think for image processing it is better to use OpenCV.
To compute the normal vector you have to find 3 points in the plane that you are looking for and to find the plane in the image can be difficult if the colors mix. Start looking for a way to first identify the tilted object in the image accurately.

from pykinect2-mapper-functions.

dongtamlx18 avatar dongtamlx18 commented on July 21, 2024

from pykinect2-mapper-functions.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.