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

File not found error #1

Open
yesgvinayak opened this issue Dec 9, 2021 · 3 comments
Open

File not found error #1

yesgvinayak opened this issue Dec 9, 2021 · 3 comments

Comments

@yesgvinayak
Copy link

hi,
When I try to visualise the data , I am getting an error.
FileNotFoundError: [Errno 2] No such file or directory: './data/p00/calibration_matrix.yaml'

@yesgvinayak
Copy link
Author

Any idea why it is happening. I am using ubuntu 20.04

@pperle
Copy link
Owner

pperle commented Dec 16, 2021

In step 2 (python calibrate_camera.py) you should have calibrated your camera, resulting in a calibration_matrix.yaml file.
The intrinsic camera parameters and the distortion coefficients is different from camera to camera, so you have to adjust it to your specific camera. I implemented the camera calibration based on the example provided by OpenCV.

Without a calibrated camera, solvePnP cannot be calculated and therefore the distance from the camera to the face cannot be calculated.

To generate your own calibration_matrix.yaml please follow these steps:

  1. download and print a chessboard pattern, e.g. from OpenCV or generate your own.
  2. run camera_calibration.py which should create a mp4 file with the current date and time.
  3. runt ffmpeg -i 2021-10-15_10:30:00.mp4 -f image2 frames/video_01-%07d.png to extract each frame as a png from the video file
  4. run the calibration function from camera_calibration.py which should generate a calibration_matrix.yaml file for you. You have to adjust the chessboard_grid_size parameters according to your chessboard.
    def calibration(image_path, every_nth: int = 1, debug: bool = False, chessboard_grid_size=(7, 7)):

@Prashant-Kesharwani
Copy link

For whatever reason if you are not able to generate calibration_matrix.yaml file. PFA lines and dump these lines into a calibration_matrix.yaml file.for at least running the code:

camera_matrix:
- - 891.6279056527413
  - 0.0
  - 244.78587599613516
- - 0.0
  - 888.0080654876305
  - 151.0235913286838
- - 0.0
  - 0.0
  - 1.0
dist_coeff:
- - 0.043441366471979555
  - -0.25700965138546256
  - -0.00988329500314542
  - -0.008061643807825654
  - 0.49774485697781073
rms: 0.5923613046263171

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

3 participants