Changeset 673
- Timestamp:
- 02/17/10 21:55:37 (2 years ago)
- Location:
- branches/2010-image-rec
- Files:
-
- 2 added
- 2 modified
-
docs/Makefile (modified) (2 diffs)
-
docs/presentation.ppt (added)
-
proj3d.py (modified) (5 diffs)
-
rectifyground.py (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/2010-image-rec/docs/Makefile
r645 r673 5 5 project-plan.pdf: figures/cam-000080-hsv-sobel-h.png figures/hist-test.tex figures/pygments-declarations.tex 6 6 7 all: lit-review.pdf project-plan.pdf 7 all: lit-review.pdf project-plan.pdf report 8 8 9 9 %.pdf: %.tex … … 14 14 rm -f $*.aux $*.bbl $*.blg $*.brf $*.log $*.out $*.tex~ 15 15 16 ## Figures 16 17 18 REPORT_FIGURES := \ 19 figures/ground-lab_undistorted.png \ 20 figures/ground-lab-calib_undistorted.png \ 21 figures/ground-lab_rectified.png \ 22 figures/ground-lab-calib_rectified.png 23 24 report: $(REPORT_FIGURES) 25 26 %_undistorted.png: %.jpg 27 ../undistort.py $< 28 %_rectified.png: %.jpg 29 ../rectifyground.py $< -
branches/2010-image-rec/proj3d.py
r672 r673 108 108 [ 0.0, 0.0, 1.0 ], 109 109 ]) 110 #camera_intrinsic = np.array([111 # [2200, 0, 2592 / 2],112 # [0, 2200, 1936 / 2],113 # [0, 0, 1],114 #])115 110 116 111 ## Extrinsic camera parameters … … 131 126 ground_box += camera_target 132 127 133 points= np.array([128 rectangle = np.array([ 134 129 [0, 10, 25, 1], 135 130 [0, 10, -25, 1], … … 138 133 [0, 10, 25, 1], 139 134 ]) 140 points[:,0:3] = np.dot(points[:,0:3], rot_y(1.5))141 points+= np.array([50, 0, 50 * 2.54, 0])135 rectangle[:,0:3] = np.dot(rectangle[:,0:3], rot_y(1.5)) 136 rectangle += np.array([50, 0, 50 * 2.54, 0]) 142 137 143 camera_rotation = rot_y(np.arctan2(camera_target[2], camera_location[0])) 138 up_rect = np.array([ 139 [ 20, 50, 25 + 100, 1], 140 [ 20, 50, -25 + 100, 1], 141 [-20, 50, -25 + 100, 1], 142 [-20, 50, 25 + 100, 1], 143 [ 20, 50, 25 + 100, 1], 144 ]) 145 146 camera_rotation = rot_y(np.arctan2(camera_location[0], camera_target[2])) 144 147 145 148 # External camera matrix --- transforms the camera to be at (0, 0, 0) … … 147 150 camera_external[:, :3] = camera_rotation 148 151 camera_external[:, 3] = np.dot(-camera_rotation, camera_location[0:3]) 152 P = np.dot(camera_intrinsic, camera_external) 149 153 154 ## 3D Plot 150 155 ax3d = plot_scene_3d(camera_location, camera_target, camera_rotation, camera_external) 151 156 … … 158 163 159 164 # Plot objects in the scene in original and transformed positions 160 points_max = plot_polygon_3d(ax3d, points,camera_external, 'blue', 'red')165 rectangle_max = plot_polygon_3d(ax3d, rectangle, camera_external, 'blue', 'red') 161 166 ground_box_max = plot_polygon_3d(ax3d, ground_box, camera_external, 'blue', 'red') 167 up_rect_max = plot_polygon_3d(ax3d, up_rect, camera_external, 'blue', 'red') 162 168 163 169 set_axes_3d(ax3d, max( 164 points_max, ground_box_max,170 rectangle_max, ground_box_max, 165 171 np.max(camera_location), 166 172 np.max(camera_target) 167 173 )) 168 174 169 P = np.dot(camera_intrinsic, camera_external) 170 points_2d = np.dot(P, points.T).T 171 homogenize(points_2d) 172 ground_box_2d = np.dot(P, ground_box.T).T 173 homogenize(ground_box_2d) 175 176 ## 2D Plot 177 def plot_2d(P, points): 178 points_2d = np.dot(P, points.T).T 179 homogenize(points_2d) 180 pyplot.plot(points_2d[:,1], points_2d[:,0]) 174 181 175 182 figure = pyplot.figure() 176 pyplot.plot(points_2d[:,1], points_2d[:,0]) 177 pyplot.plot(ground_box_2d[:,1], ground_box_2d[:,0]) 183 plot_2d(P, rectangle) 184 plot_2d(P, ground_box) 185 plot_2d(P, up_rect) 178 186 pyplot.axis((0, 2592, 0, 1936)) 179 187 pyplot.xlabel('x')

