Camera Calibration in less than 5 Minutes with OpenCV

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ก.พ. 2023
  • Camera Calibration Software and High Precision Calibration Boards: camera-calibrator.com/
    Inside my school and program, I teach you my system to become an AI engineer or freelancer. Life-time access, personal help by me and I will show you exactly how I went from below average student to making $250/hr. Join the High Earner AI Career Program here 👉 www.nicolai-nielsen.com/aicareer (PRICES WILL INCREASE SOON)
    You will also get access to all the technical courses inside the program, also the ones I plan to make in the future! Check out the technical courses below 👇
    Camera Calibration Software and Boards: camera-calibrator.com
    _____________________________________________________________
    In this video 📝 We'll talk about Camera Calibration and Geometry. We will first talk about the basics of camera geometry and how it can be used for calibrating cameras. We will see different types of distortion on cameras and images. At the end of the video, I'll show you in a Python script how to apply what we have learned and calibrate a camera from a practical computer vision setup.
    If you enjoyed this video, be sure to press the 👍 button so that I know what content you guys like to see.
    _____________________________________________________________
    🛠️ Freelance Work: www.nicolai-nielsen.com/nncode
    _____________________________________________________________
    💻💰🛠️ High Earner AI Career Program: www.nicolai-nielsen.com/aicareer
    ⚙️ Real-world AI Technical Courses: (www.nicos-school.com)
    📗 OpenCV GPU in Python: www.nicos-school.com/p/opencv...
    📕 YOLOv7 Object Detection: www.nicos-school.com/p/yolov7...
    📒 Transformer & Segmentation: www.nicos-school.com/p/transf...
    📙 YOLOv8 Object Tracking: www.nicos-school.com/p/yolov8...
    📘 Research Paper Implementation: www.nicos-school.com/p/resear...
    📔 CustomGPT: www.nicos-school.com/p/custom...
    _____________________________________________________________
    📷 Calibrator 📷
    My camera calibration software, CharuCo Boards, and Checker boards
    Link to webshop: camera-calibrator.com
    _____________________________________________________________
    📞 Connect with Me:
    🌳 linktr.ee/nicolainielsen
    🌍 My Website: www.nicolai-nielsen.com/
    🤖 GitHub: github.com/niconielsen32
    👉 LinkedIn: / nicolaiai
    🐦 X/Twitter: / nielsencv_ai
    🌆 Instagram: / nicolaihoeirup
    _____________________________________________________________
    🎮 My Gear (Affiliate links):
    💻 Laptop: amzn.to/49LJkTW
    🖥️ Desktop PC:
    NVIDIA RTX 4090 24GB: amzn.to/3Uc7yAM
    Intel I9-14900K: amzn.to/3W4Z5Cb
    Motherboard: amzn.to/4aR6wBC
    32GB RAM: amzn.to/3Jt2XVR
    🖥️ Monitor: amzn.to/4aLP8hh
    🖱️ Mouse: amzn.to/3W501GH
    ⌨️ Keyboard: amzn.to/3xUGz5b
    🎙️ Microphone: amzn.to/3w1F1WK
    📷 Camera: amzn.to/4b4Ryr9
    _____________________________________________________________
    Tags:
    #CameraCalibration #CameraCalibrationOpenCV #CameraDistortion #ComputerVision #OpenCV #Python
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 47

  • @NicolaiAI
    @NicolaiAI  ปีที่แล้ว +2

    Camera Calibration Software and High Precision Calibration Boards: camera-calibrator.com/

  • @maddiebender1413
    @maddiebender1413 16 วันที่ผ่านมา

    Can you show a link to the calibration image you used? Also, is the frame size in mm?

  • @JReinhoud
    @JReinhoud ปีที่แล้ว +1

    Just curious, isnt ChArUco a better pattern for calibration?

  • @lilyshytle393
    @lilyshytle393 8 หลายเดือนก่อน

    Hello! When I run the code, I am getting the error message: [ WARN:0] global D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (438) `anonymous-namespace'::SourceReaderCB::~SourceReaderCB terminating async callback
    Any advice?

  • @cyberhard
    @cyberhard ปีที่แล้ว +1

    What is the link for the longer calibration video? Does a camera need to be calibrated? What is the value in calibration?

    • @NicolaiAI
      @NicolaiAI  ปีที่แล้ว +1

      This is the link for the longer video: Camera Calibration in Python with OpenCV - Python Script with Images
      th-cam.com/video/3h7wgR5fYik/w-d-xo.html
      U don’t have to calibrate it but can be used to remove distortion and get the intrinsic parameters of the camera which can be used for many things

    • @cyberhard
      @cyberhard ปีที่แล้ว +1

      @@NicolaiAI Thanks for the response.

  • @aswinsanthanam2566
    @aswinsanthanam2566 3 หลายเดือนก่อน +1

    I took the chessboard pic from my phone which is 8x8, and the frame WxH was 480x270, hence i updated these infos in the calibration.py. I get the below error
    (-215:Assertion failed) nimages > 0 in function 'calibrateCameraRO' on the line
    ret, cameraMatrix, dist, rvecs, tvecs = cv.calibrateCamera(objpoints, imgpoints, frameSize, None, None).
    Any idea ?

    • @NicolaiAI
      @NicolaiAI  3 หลายเดือนก่อน

      Images are not loaded in correctly

  • @ArvindKumar-qh8sg
    @ArvindKumar-qh8sg ปีที่แล้ว +1

    what is the unit of the mean error given in the result? Thanks!

    • @NicolaiAI
      @NicolaiAI  ปีที่แล้ว +1

      It’s pixels from the reprojection

  • @bellomayowa6993
    @bellomayowa6993 ปีที่แล้ว +1

    Hello, How often do we need to do camera calibration. once per camera or for everytime you move the camera

    • @NicolaiAI
      @NicolaiAI  ปีที่แล้ว +1

      Just once per camera if u are only interested in the intrinsic parameters

    • @bellomayowa6993
      @bellomayowa6993 ปีที่แล้ว +1

      @@NicolaiAI thank you so much. I really appreciate it

    • @NicolaiAI
      @NicolaiAI  ปีที่แล้ว

      @@bellomayowa6993 ur welcome

    • @kevinwoodrobotics
      @kevinwoodrobotics 10 หลายเดือนก่อน +1

      It depends on your application. If your camera is under extreme environment conditions or if you want very precise accuracy, you may need to calibrate your camera more frequently since your intrinsic camera parameters could potentially change over time. Temperature changes can often cause physical changes to your camera. But if you are using it in very controlled environment and accuracy is not super important, you may get away with only calibrating once.

  • @FassiaOuanre
    @FassiaOuanre 2 หลายเดือนก่อน +1

    good evening how are you? I'm studying on a school project and I need to calibrate the camera I'm using. So I followed your tutorial then I retrieved your script from your git account, now I have a problem when I execute the code. I have an error regarding this part:
    img = cv.imread('cali5.png')
    h, w = img.shape[:2]
    newCameraMatrix, king = cv.getOptimalNewCameraMatrix(cameraMatrix, dist, (w,h), 1, (w,h))
    Here is the error that appears:
    AttributeError: 'NoneType' object has no attribute 'shape'
    I'm asking for your help.
    Good evening.

    • @alessandramenezes4813
      @alessandramenezes4813 หลายเดือนก่อน

      Did you solve this problem? how?

    • @rangowang9432
      @rangowang9432 หลายเดือนก่อน

      img = cv.imread('cali5.png')
      you should use your existing picture and make sure the path is right.
      like: "img = cv.imread('xxx/xxx.png')"

  • @user-gj5vh6ry8n
    @user-gj5vh6ry8n 7 หลายเดือนก่อน +1

    is it really required to have the chessboard? I have been trying other images, the code just not work with other images

    • @NicolaiAI
      @NicolaiAI  7 หลายเดือนก่อน

      Nope this specific code needs to be with a chessboard and is also the easiest by far. You can just print a chessboard or even just try out with one in your phone or tablet

  • @01Hesenko06
    @01Hesenko06 ปีที่แล้ว +2

    1. don't you have to take into account the pixel density on each device when creating a checkerboard pattern? Or what do you have to take into account?
    2. where can one create a suitable checkerboard pattern?

    • @NicolaiAI
      @NicolaiAI  ปีที่แล้ว +2

      No the pixel density doesn’t really matter. Just make sure u are able to detect the corners correctly and maybe use some sub pixel/corner refinement.
      U can just download checkerboards on google. There are some generators

    • @luisjomen2aS
      @luisjomen2aS 10 หลายเดือนก่อน +1

      Wouldn't it mean that you zooming in would alter the size of the checkerboard and thus biased the tangential distortion ?@@NicolaiAI

  • @rangowang9432
    @rangowang9432 หลายเดือนก่อน

    Hi, bro . I have tried your code with about 15 pictures and everything is going well. But the total error is too much high, my error is 0.236623....!
    It;s just so much high and I think the cameramtx and dist are not accurate enough in this way. Can you give me some suggestions about how can I have the same small error like you have showed in your video. Thanks.

  • @shortylikeamelody
    @shortylikeamelody ปีที่แล้ว

    Hi, thanks for the video. I'm trying to run your program on my dataset (11 photos taken from a GoPro MAX) but the 'ret' boolean always stays at false so the chessboard is never detected. The images are well read by the program, any clue why this problem occurs ?

    • @kevinwoodrobotics
      @kevinwoodrobotics 10 หลายเดือนก่อน

      You may want to play around with how close or far your chessboard is to your camera

  • @kanangurbanov8282
    @kanangurbanov8282 ปีที่แล้ว

    Could you please explain how to do it with 24 color card? I need to calibrate it with these 24 colors , not with chessboard

    • @notnotalwen4891
      @notnotalwen4891 10 หลายเดือนก่อน

      if the pattern is checkered, count the size of the board, so if your board is like 24x24 the chess size is 23x23, or if your board is 24x20 the chess size is 23x19, hope you see the pattern here

  • @saadsaad17
    @saadsaad17 ปีที่แล้ว +4

    Should not the chessboardSize be equal to (10,7)?

    • @NicolaiAI
      @NicolaiAI  ปีที่แล้ว

      Nope u should specify the number of corners in the chessboard in each row and column

    • @saadsaad17
      @saadsaad17 ปีที่แล้ว +1

      @@NicolaiAI The chessboard displayed on the tablet screen has 10 corners and 7 corners in each row and column respectively. Great work on your videos btw, they are helpful and well organized, keep it up :D

    • @rafaelsouza4575
      @rafaelsouza4575 5 หลายเดือนก่อน

      for some reason, opencv only takes into account the inner borders of the chessboard, such the final number is always one less than the original count of rows and cols.

  • @paweskrzypczak1650
    @paweskrzypczak1650 ปีที่แล้ว +1

    What is the camera?

    • @NicolaiAI
      @NicolaiAI  ปีที่แล้ว

      Just a standard cheap webcam haha

  • @cpuwolf
    @cpuwolf ปีที่แล้ว +1

    it was a headache where to get chessboard, iPad is definitely a easy way to go

    • @NicolaiAI
      @NicolaiAI  ปีที่แล้ว +1

      Yeah for sure! Or u can also just print out one

  • @0xc026
    @0xc026 ปีที่แล้ว

    what is img = cv.imread('cali5.png')?

    • @ScottFoust
      @ScottFoust ปีที่แล้ว

      I was stuck on this for a while as well. If you watch his video closely, you'll notice that is just the name of one of his calibration images. Just rename it to one of your own.

    • @gokcesenahocaoglu8631
      @gokcesenahocaoglu8631 10 หลายเดือนก่อน

      @@ScottFoust Hello, I am also having the same problem. Can you tell me how to get the calibration images?

  • @engchoontan8483
    @engchoontan8483 6 หลายเดือนก่อน

    Target = objective-purpose
    For each objective-purpose
    = Audio soft-limit(min-max) hard-limit(min-max) slope(min-max)
    = Video focus hunt-track(min-max) gradation-slope(min-max), focus(min-max) gradation-slope(min-max)
    Nowadays, digital rubbish looks really bad on TV, even professional camera and professional studio. Digital camera with old manual lens with hands-brains for those missing parameters should make the hunting-focus less zombie-jumping lousy.

    • @engchoontan8483
      @engchoontan8483 6 หลายเดือนก่อน

      There is the gimbal and record at 2k to post-process to 1080p as digital-stabilization. There is no optical stabilization in my books. I am not a zombie. For military, hunt and track and other layers should be drag drop priority-table.

    • @engchoontan8483
      @engchoontan8483 6 หลายเดือนก่อน

      Real time with - it's complicated, I don't know, anything, ... Apply to men.

    • @engchoontan8483
      @engchoontan8483 6 หลายเดือนก่อน

      Apache helmet with Lidar and artillery calculator and construction civil engineering 3D modelling and range-finder scope tech is useless to such people. Add helmet with Range(min-max), slope(min-max), if you think millennials are smarter.

    • @engchoontan8483
      @engchoontan8483 6 หลายเดือนก่อน

      2 rectangle is keystone compensation for data discard shift. Bellows in old-school terminology.

    • @engchoontan8483
      @engchoontan8483 6 หลายเดือนก่อน

      Baseline target-board
      = old cartoon for analog paper tune
      = Japanese anime for color proofing
      = China MMonline games for response-time of processor and pixels
      = Korean MMo for bandwidth and network of smart TV-monitor
      = Movies CGI titanic for the point when SGI lot to Linix-beowulf-culsters
      = American animation movies for DVD and Blu ray
      = Focusing issues not present in cartoons for kids before-after year ... Always...