pperle / gaze-data-collection

collect training and calibration data for gaze tracking
18 stars 10 forks source link

File not found error #1

Open yesgvinayak opened 2 years ago

yesgvinayak commented 2 years ago

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 commented 2 years ago

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

pperle commented 2 years ago

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. https://github.com/pperle/gaze-data-collection/blob/0916354fc2d4bbbaacfdf09f92766f9f13636ae2/camera_calibration.py#L29
Prashant-Kesharwani commented 1 year ago

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