Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

(Python)

Implement using PnP methods from OpenCV to compute the camera pose. In this example, we have a flat plate on a table. We can use Harris corner detection to detect the four corners of the plate on the image. Then we can apply PnP methods to compute the camera pose with respect to the plate. Here, the 3D coordinates of the four corners are (-0.05, -0.05, 0), (0.05, -0.05, 0), (0.05, 0.05, 0) and (-0.05, 0.05, 0). 

******#################################
# Programming homework
.. .. ..#################################..
# Programming homework: use PnP methods from opency to compute the camera pose
# so far, we have found the four corners on the image
# the 3D locations of the four corners are (-0.05, -0.05, 0), (0.05, -0.05, 0), (0.05, 0.05, 0), (-0.05, 0.05, 0)
# i.e., we define the world origin in the center of the plate, and the z plane is the plate plane
# intrinsic matrix of the camera
intrinsic_matrix = self.projection_to_intrinsics(self._proj_matrix,
#Step 1, figure out an assignment of the 3D locations to the detected corners on the image
# corners is with shape (4, 2)
# The output of step 1 should be a numpy array with shape (4, 3), let's say x3d
# Note, there can be multiple possible assignments, find one of them
print('3D locations')
# dummy: replace with your solution
x3d
print(x3d)
# Step 2: solve the pnp problem using opencv
# Refer to this link for the cv2.solve PnP https://www.pythonpool.com/opencv-solvepnp/
# The output of step 2 should be a rotation matrix R (3x3) and a translation vector tvec (3x1) of the camera pose
# useful functions: cv2.solvePnP, cv2.Rodrigues
np.zeros((4, 3), dtype=np.float32)
self._window_width, self._window_height)
print('3D rotation')
# dummy: replace with your solution
R = np.zeros((3, 3), dtype=np.float32)
print(R, R.shape)
print('3D translation')
# dummy: replace with your solution
tvec
print (tvec, tvec.shape)
np.zeros((3, 1), dtype=np. float32)
# Step 3: project the 3D points x3d using the estimated camera pose R, tvec (extrinsics) and the camera intrinsics to verify the solution
# the output of step 3 should be a numpy array with shape (4, 2), let's say x2d
print('projected 2D locations according to the estimated camera pose')
# dummy: replace with your solution
x2d
np.zeros((4, 2), dtype=np. float32)
print(x2d, x2d.shape)
Transcribed Image Text:******################################# # Programming homework .. .. ..#################################.. # Programming homework: use PnP methods from opency to compute the camera pose # so far, we have found the four corners on the image # the 3D locations of the four corners are (-0.05, -0.05, 0), (0.05, -0.05, 0), (0.05, 0.05, 0), (-0.05, 0.05, 0) # i.e., we define the world origin in the center of the plate, and the z plane is the plate plane # intrinsic matrix of the camera intrinsic_matrix = self.projection_to_intrinsics(self._proj_matrix, #Step 1, figure out an assignment of the 3D locations to the detected corners on the image # corners is with shape (4, 2) # The output of step 1 should be a numpy array with shape (4, 3), let's say x3d # Note, there can be multiple possible assignments, find one of them print('3D locations') # dummy: replace with your solution x3d print(x3d) # Step 2: solve the pnp problem using opencv # Refer to this link for the cv2.solve PnP https://www.pythonpool.com/opencv-solvepnp/ # The output of step 2 should be a rotation matrix R (3x3) and a translation vector tvec (3x1) of the camera pose # useful functions: cv2.solvePnP, cv2.Rodrigues np.zeros((4, 3), dtype=np.float32) self._window_width, self._window_height) print('3D rotation') # dummy: replace with your solution R = np.zeros((3, 3), dtype=np.float32) print(R, R.shape) print('3D translation') # dummy: replace with your solution tvec print (tvec, tvec.shape) np.zeros((3, 1), dtype=np. float32) # Step 3: project the 3D points x3d using the estimated camera pose R, tvec (extrinsics) and the camera intrinsics to verify the solution # the output of step 3 should be a numpy array with shape (4, 2), let's say x2d print('projected 2D locations according to the estimated camera pose') # dummy: replace with your solution x2d np.zeros((4, 2), dtype=np. float32) print(x2d, x2d.shape)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY