John-Boccio / Tennis3DTracker

Tennis court detection and automatic single-view camera calibration using prior scene knowledge. Tennis ball tracking during points and 3D ball position estimation.
6 stars 0 forks source link

About calibration #1

Open LiuXingyu0324 opened 1 year ago

LiuXingyu0324 commented 1 year ago

Hello, do you consider the focal length of the camera(intrinsic parameters) when you do the calibration?

John-Boccio commented 1 year ago

Hello, I do not. The camera calibration matrix essentially boils down to a matrix which can map 3D points to their 2D location in the image. For this project, I found a few key points within the image (2D points) which I knew the 3D point locations for (dimensions of a standard tennis court are well known). So using those point pairs at the tennis court key points, we can construct the camera calibration matrix without knowing the camera parameters. Do you know of a way to incorporate the intrinsic parameters into this?

If we did know all the camera calibration parameters, then we could create the calibration matrix that way. The current method is nice because we don't need to know them. However it has a downside which is that the calibration is not always accurate, which is one of the main issues faced in this project.

The 3D tracking could be improved by having a better algorithm to create the camera calibration matrix and creating a more accurate tennis ball dynamics model for the kalman filter.

LiuXingyu0324 commented 1 year ago

Hello, I do not. The camera calibration matrix essentially boils down to a matrix which can map 3D points to their 2D location in the image. For this project, I found a few key points within the image (2D points) which I knew the 3D point locations for (dimensions of a standard tennis court are well known). So using those point pairs at the tennis court key points, we can construct the camera calibration matrix without knowing the camera parameters. Do you know of a way to incorporate the intrinsic parameters into this?

If we did know all the camera calibration parameters, then we could create the calibration matrix that way. The current method is nice because we don't need to know them. However it has a downside which is that the calibration is not always accurate, which is one of the main issues faced in this project.

The 3D tracking could be improved by having a better algorithm to create the camera calibration matrix and creating a more accurate tennis ball dynamics model for the kalman filter.

Thank you for your reply. I understand what you mean,you treat the internal parameter matrix and the external parameter matrix as a whole and directly calculate the correspondence between 2D and 3D coordinates.And I noticed that if I calculate 2D coordinates using your camera matrix and the 3D coordinate, I need to normalize the third digit of the result(set it to 1) to get the correct 2D coordinates(the first two digits of the result).So, I have one more question,if I want to calculate the 3D coordinates of a flying tennis ball (I know the 2D coordinates), how do I get the correct result?

John-Boccio commented 1 year ago

Sorry for the late reply. Do you mind posting the code that you modified to get the 3D to 2D mapping correct?

Getting the 3D position from the 2D pixel position is challenging. I used a kalman filter with some basic equations about the physics of the tennis ball. We can use the estimated 3D position mapped to 2D position as our error that drives the state estimation.