Files
2026-09-16 18:06:28 -05:00

101 lines
3.4 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
**ENGR4350 Computer Vision**
**Project 1. Linear Approach to Camera Calibration**
**Due Data: September 20, 2026**
**Objective:** To use a linear approach to calibrate a camera and to use
the camera parameters to predict the 2D image-domain location of a set
of 3D points or a 3D moving object.
Procedure:
1. Study the lecture note by showing the use of projection matrix that
maps objects from 3-D to 2-D, the definition of intrinsic and
extrinsic parameters of a camera, and the linear approach to
geometric camera calibration.
2. Given an image *test_image.bmp* captured by a camera which is posed
toward a 3D chess board, we manually selected 27 points whose 2-D
image coordinates are saved in the file *observe.dat*, and whose 3-D
coordinates in a world coordinate are stored in the file
*model.dat*. Please use the linear approach to calibrate the camera
system by computing the projection matrix (M) from which you are
required to compute the intrinsic and extrinsic parameters,
including , u0, v0, α, β, and the rotation matrix (R), and the
shift vector (t).
3. In order to verify the correctness of the camera calibration, please
use the projection matrix to map the three set of 3D points, whose
3-D coordinates are {x,y,0\|x,y=0,...,10}, {x,10,z\|x,z=0,...,10},
{10,y,z\|y,z=0,...,10}, respectively, into the 2-D image space.
Discuss your results.
4. Create a video file that shows a 3D object moving in the 3D scene
along a specific pre-defined path. For example, a 3D cube (1x1x1)
can be displayed by nine lines connecting seven vertexes (see the
example below). Each line can be drawn with around 100 samples. (You
can see a video example from Slide 13 of the Lecture 8 handout in
the slideshow mode.)
**Report Requirements:**
1. Briefly discuss the basics of geometric camera modeling.
2. Briefly discuss the linear approach to camera calibration.
3. Show the simulation results by figures (Part 3).
4. Include some sample frames of the video (Part 4) in the report.
5. The Python source code should be included as the appendix of the
report with detailed comments. A separate Python file should also be
provided for testing.
6. Zip all files (DOC, AVI, M-file) into one package and upload it to
Blackboard by the due date.
**Useful Python functions:**
You need to import the required libraries:
> import torch\
> import numpy as np\
> import matplotlib.pyplot as plt\
> from PIL import Image\
> import time
> import cv2\
> import os
- Inner product: torch.dot(t1,t2), Cross product : torch.cross(t1,t2).
> v0 = (s \*\* 2) \* torch.dot(a2, a3)\
> \
> cross_a1_a3 = torch.cross(a1, a3)
>
- Singular value decomposition (SVD) :
> \# \-\-- Solve for the projection matrix M \-\--\
> \# The solution to Qm=0 is the last column of V from the SVD of Q\
> \# In PyTorch, torch.linalg.svd returns U, S, Vh (V transpose)\
> U, S, Vh = torch.linalg.svd(Q)\
> \
> \# The solution is the last row of Vh, which corresponds to the
> smallest singular value\
> m = Vh\[-1, :\]\
> \
> \# Reshape the 12x1 vector m into the 3x4 projection matrix M\
> M = m.reshape(3, 4)
- Norm of a vector: torch.linalg.norm(vector).
> torch.linalg.norm(cross_a1_a3)
>
- Inverse of a matrix: torch.linalg.inv(M)
> torch.linalg.inv(M)
>
- Reshape of a vector to a matrix:
> \# Reshape the 12x1 vector m into the 3x4 projection matrix M\
> M = m.reshape(3, 4)