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

Why is there a negative value #6

Open
gokcesena opened this issue Mar 7, 2024 · 4 comments
Open

Why is there a negative value #6

gokcesena opened this issue Mar 7, 2024 · 4 comments

Comments

@gokcesena
Copy link

Hi, Thank you for your work.
When I add the following lines in the reprojection.py file
"for i in range(len(img_points)):
try:
cv2.circle(img, (np.int32(round(img_points[i][0])),np.int32(round(img_points[i][1]))), laser_point_radius, (0,255,0), 1)
print((np.int32(round(img_points[i][0]))),np.int32(round(img_points[i][1]))))"

The following values are printed to the terminal:

"
...
(-401, 462)
(-388, 462)
(-374, 463)
(-359, 463)
(-344, 463)
(-327, 464)
(-310, 465)
(-291, 465)
(-272, 466)
(-251, 466)
(-230, 467)
(-207, 468)
(-183, 468)
(-159, 469)
(-132, 470)
(-105, 470)
(-76, 471)
(-45, 472)
(-13, 473)
(20, 474)
(55, 475)
(92, 476)
(130, 477)
(170, 478)
(213, 479)
(257, 480)
(303, 481)
(351, 482)
(401, 483)
(454, 485)
(509, 486)
(567, 487)
(628, 489)
(691, 490)
(757, 492)
(826, 493)
(898, 495)
(974, 497)
(1052, 498)
(1134, 500)
(1220, 502)
(1310, 504)
(1403, 506)
(1501, 508)
(1604, 510)
(1711, 513)
(1822, 515)
(1939, 518)
(2061, 520)
(2188, 523)
(2321, 526)
(2460, 529)
(2605, 532)
(2757, 535)
(2916, 538)
..."
My question is, although the pixel width of the camera is 1280, why do I get values greater than 1280 or why are there negative values?
Thank you in advance for your reply!

@ehong-tl
Copy link
Owner

ehong-tl commented Mar 8, 2024

Hi @gokcesena

Values beyond the image boundaries (negative value or pixel value beyond image width in your current case) means that the 3D points projected outside of the image boundaries. It is normal to have this during reprojection. If you frequently encounter them, please try to refine your calibration.

@gokcesena
Copy link
Author

Thank you for your quick reply @ehong-tl, the rmse value is high when I take samples frequently. I did it with 13 samples for calibration, but I will do what you said and take more samples. thanks

@gokcesena
Copy link
Author

I'm wondering: Can I only publish point clouds that fall in front of the camera? I think this line: "objPoints = objPoints[Z > 0]" should give the pointcloud data falling in front of the camera, can you direct me?

@ehong-tl
Copy link
Owner

Yes, these 2 lines of code will remove points that are falling behind the camera.

Z = get_z(q, objPoints, K)
objPoints = objPoints[Z > 0]

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