Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any sample scripts of applications #10

Open
shimoshida opened this issue Oct 23, 2024 · 3 comments
Open

Is there any sample scripts of applications #10

shimoshida opened this issue Oct 23, 2024 · 3 comments

Comments

@shimoshida
Copy link

I am simply asking a question in an issue.
The current sample code only shows how to set up the camera and takes samples of intensity and depth.

I am currently working on a project to build a camera-based robotic system with your cameras, and would appreciate some more practical examples of how to use them.

For example...

  • How to measure the distance from the camera in mm
  • how to align the coordinate system with the robot
@shimoshida
Copy link
Author

As the comment of the function convertToPointCloudOptimized in base/python/PointCloud/PointCloud.py says

        offset the entire cordinate system so that the middle pixel is at (0,0,z) ->
        i want to define the system so that the technical drawing, point 7 in here:
        https://www.sick.com/il/en/catalog/products/machine-vision-and-identification/machine-vision/visionary-t-mini/v3s105-1aaaaaa/p/p665983?tab=detail
        is at (0,0,z) in the world cordinate system.
        that point is defined in pixel coordinates as: (myCamParams.width // 2, myCamParams.height // 2). 
        so range_data[myCamParams.height // 2, myCamParams.width // 2] is the distance from sensor of that point.
        and cloud_data[myCamParams.height // 2, myCamParams.width // 2,:] is the 3D coordinates of that point.

However,

  • I have tried the following scripts, but the last value cloud_data[myCamParams.height // 2, myCamParams.width // 2,:] is not (0, 0, z)
cloud = convertToPointCloud(distData, cnfiData, myCamParams, isStereo)
cloud[myCamParams.height // 2, myCamParams.width // 2,:]
  • there is no range_data in PointCloud.py

@shimoshida
Copy link
Author

After deciphering the library, I was able to get the depth in mm from the camera by simply doing the following

sensor_data.read(frame, convertToMM=True)

I was able to convert it to mm and did some research.
Does the origin of the world coordinate system default to the camera position? Am I right in understanding that the reason why it does not become (0,0,z) is due to an error in converting to mm?

@zimmefaSICKAG
Copy link

zimmefaSICKAG commented Oct 25, 2024

Hello shimoshida,
great to see you working with our 3D cameras. We are happy to support you.
However, please note that github issues are specifically meant for issues with our programming samples and the underlying code.
We will answer your code related questions here (and only briefly touch the others) and I want to kindly ask you to seek support on your remaining questions by requesting support on the SICK Support Portal. This portal is our commitment to provide you comprehensive support for all kinds of questions related to our products. Thank you for your cooperation.

Which exact product are you working with?

How to measure the distance from the camera in mm

--> Depends on the product. The radial distance map (ToF only) needs to be undistorted by using the intrinsic camera parameters (k1,k2,fx,fy) and then transformed into the camera coordinate by shifting it to the front screen (f2rc). The cartesian distance map (stereo) directly yields the z value.

How to align the coordinate system with the robot

--> Per default the all data (after point cloud calculation) is in the camera coordinate system. Any adaptions are made by using the camera-to-world-matrix (m_c2w). The matrix is again part of the myCamParams. It is defined by the mounting position of the camera which can be set via API or SOPAS ET.

range_data is just used as a mock-up for explanatory purposes.

I have tried the following scripts, but the last value cloud_data[myCamParams.height // 2, myCamParams.width // 2,:] is not (0, 0, z)

--> What is the output? The triplet should yield (x==0, y==0, z==measured_z_for_center_pixel)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants