-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
The X Y coordinates in the camera coordinate system calculated by the rs2_deproject_pixel_to_point function are not accurate enough, and Z is the same, no matter whether you use the aligned depth internal reference or the unaligned depth internal reference #12067
Comments
In my code, results is a container composed of multiple rectangular boxes. I take the center point of the rectangular box as the parameter value of the get_distance function, that is, the pixel value that needs to be measured. |
Hi @5204338 It is a known issue that when using get_distance with align_to for depth-color alignment, XY can be accurate at the center of the image and become increasingly inaccurate when moving away from the center, with very large inaccuracies at the outer edges of the image. The issue does not occur when not using alignment. Do you get improved results if you align depth to color instead of the much rarer color to depth alignment that your script uses, and therefore use color intrinsics instead of depth intrinsics? When performing alignment, the intrinsics that are used shoud be those of the stream that is being aligned to. So when using depth to color alignment, the color intrinsics should be used because the depth origin changes from the centerpoint of the left IR sensor to the centerpoint of the RGB sensor. If your preference is color to depth alignment then the RealSense SDK C++ program rs-measure demonstrates it. It is the only official SDK example that uses color to depth alignment instead of depth to color. If you have installed the SDK tools and examples then your librealsense build should have a pre-made executable version of rs-measure that you can run. It should be located in the usr/local/bin folder of Ubuntu. https://github.com/IntelRealSense/librealsense/blob/master/examples/measure/rs-measure.cpp |
Regarding the stream alignment in my code, the depth stream is aligned with the color stream. Are you mistaken? However, the internal parameters converted to the camera coordinate system use the depth internal parameters. According to your explanation, when aligning the depth stream to the color stream, you should experiment with the color stream internal parameters to convert X Y. Wait for me to actually test the effect, and then come to communicate with you |
Thank you very much, but I have a problem, in your explanation, when the stream is not aligned, use get_distance to find the Z of the pixel point, and then find the X Y coordinates, whether the pixel point is in the center of the image, the X Y coordinates are accurate , I'm confused about this? Isn’t stream alignment just to get more accurate X and Y coordinates in the camera coordinate system? If you don't do stream alignment, wouldn't the X and Y coordinates in the camera coordinate system be inaccurate? Is my understanding correct? Because I need to get the more accurate X Y coordinates of the target in the camera coordinate system. |
I confirm you are aligning depth to color with
Aligning depth and color can improve depth measuring accuracy by making it easier to distinguish between coordinates in the foreground and the background of the image. It is not compulsory to use alignment to find the depth value of a coordinate though. This is demonstrated by the RealSense SDK's rs-hello-realsense example program, which prints as plain text the depth distance in real-world meters of the coordinate at the center of the camera's view. |
Thank you very much .Ok, I understand you said ,my is not problem, and I want yo ensure something, In my case, my detect targets is not the center of camera image frame, in this case, I need the most accuracy X Y coordinate of camera coordinate system,I should use that method to determine the coordinate values of X Y. |
My project is to measure the coordinates of 2 targets in the horizontal plane through the camera facing vertically downward (so the Z axis is roughly equal, that is, this coordinate is useless, what I need is the coordinates of X and Y), and then based on the coordinates of the 2 targets Calculate the angle with the origin of the camera coordinate system. Take the X and Y axes of the camera coordinate system as the coordinate axes (the XY axes form a two-dimensional coordinate system), and then calculate the angle between the two target points in the two-dimensional coordinate system. Simplified understanding is to form a triangle with the origin of the camera coordinate system and two target points, and find the included angle of the triangle. From your professional point of view, can you use the camera to achieve the above functions and get an accurate angle |
It sounds as though #9297 might fit your description. |
that case not same with me, I give your image to exlaine my scenes. I calculate angle1 and angle2 according to the X Y of node 1 and node 2, but the X Y coordinates of node 1 and 2 deviate greatly, and the calculated angle is even bigger, what should I do, please help me, thank you for your guidance |
#9749 is also worth looking at. |
ok, let me see carefully |
Do you require further assistance with this case, please? Thanks! |
yes, I also have some problems. I get some information from 11031, I have question about method1, you explained before: ''' rs2::align align_to(RS2_STREAM_COLOR);
''' |
I also want to know get_distance function,auto dist = depth.get_distance(static_cast(pixel[0]), static_cast(pixel[1])); |
An example use is merging together individual point clouds into a single combined point cloud by giving the individual clouds the same position and rotation in 3D space. In regards to the auto dist code, it was given to me by one of my Intel RealSense colleagues so I unfortunately do not know why this line is written as it is. |
I understand that I shared the code but I did not write it as it was provided by one of my Intel colleagues and so I cannot interpret the meaning of this particular 'auto dist' section of the script as I am not a program developer. I do apologize. |
OK, I know, why did your colleagues write such a piece of code . Can you discuss it with your colleague, whether he wrote it wrong, what should be the correct way of writing, I really feel that you need to improve your reference documents, it is too brief, and the reference value is very low. I believe that many users have the same feeling as me. |
You could try changing |
Ok, I know, my problem is solved,I made a mistake in the coordinate system before, and used the coordinate system after the pixed function, because your reference documents are too few, and it really wasted a lot of my time |
I understand your frustration and sincerely apologize. I'm very pleased though to hear that you achieved a solution. |
Thanks your help , also you can close this issue. |
You are very welcome. Thanks again! |
Issue Description
The X Y coordinates in the camera coordinate system calculated by the rs2_deproject_pixel_to_point function are not accurate enough, and Z is the same, no matter whether you use the aligned depth internal reference or the unaligned depth internal reference, can you help me.
I have tried all the methods, but my method is wrong, or I can’t get Z through the get_distance function to ensure the high precision of X Y in the camera coordinate system.
below is my code ,please hele me.
'''
int main()
{
rs2::pipeline pipe;
rs2::config cfg;
}
'''
The text was updated successfully, but these errors were encountered: