| 
									
										
										
										
											2014-07-26 03:44:31 +08:00
										 |  |  | function [ measurements ] = project_landmarks( pose, landmarks, K )
 | 
					
						
							|  |  |  | %UNTITLED3 Summary of this function goes here | 
					
						
							|  |  |  | %   Detailed explanation goes here | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     import gtsam.*; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-22 08:42:55 +08:00
										 |  |  |     camera = PinholeCameraCal3_S2(pose,K);     | 
					
						
							| 
									
										
										
										
											2014-07-26 03:44:31 +08:00
										 |  |  |     measurements = Values; | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     for i=1:size(landmarks)-1 | 
					
						
							| 
									
										
										
										
											2014-12-07 13:31:48 +08:00
										 |  |  |         z = camera.project(landmarks.atPoint3(symbol('l',i))); | 
					
						
							| 
									
										
										
										
											2014-07-26 03:44:31 +08:00
										 |  |  |          | 
					
						
							|  |  |  |         % check bounding box | 
					
						
							| 
									
										
										
										
											2020-08-18 02:37:12 +08:00
										 |  |  |         if z(1) < 0 || z(1) > 1280 | 
					
						
							| 
									
										
										
										
											2014-07-26 03:44:31 +08:00
										 |  |  |             continue | 
					
						
							| 
									
										
										
										
											2020-08-18 02:37:12 +08:00
										 |  |  |         elseif z(2) < 0 || z(2) > 960 | 
					
						
							| 
									
										
										
										
											2014-07-26 03:44:31 +08:00
										 |  |  |             continue | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  |             | 
					
						
							|  |  |  |         measurements.insert(symbol('z',i),z); | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  | %     persistent h; | 
					
						
							|  |  |  | %      | 
					
						
							|  |  |  | %     if isempty(h) | 
					
						
							|  |  |  | %         h = figure(); | 
					
						
							|  |  |  | %     else | 
					
						
							|  |  |  | %         figure(h); | 
					
						
							|  |  |  | %     end | 
					
						
							|  |  |  | %     clf; | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     if measurements.size == 0 | 
					
						
							|  |  |  |         return | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     cla; | 
					
						
							|  |  |  |     plot2DPoints(measurements,'*g'); | 
					
						
							|  |  |  |      | 
					
						
							| 
									
										
										
										
											2014-07-26 05:11:13 +08:00
										 |  |  |     text(1120, 1000, sprintf('# = %d', measurements.size)); | 
					
						
							|  |  |  |      | 
					
						
							| 
									
										
										
										
											2014-07-26 03:44:31 +08:00
										 |  |  |     axis equal; | 
					
						
							|  |  |  |     axis([0 1280 0 960]); | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     set(gca, 'YDir', 'reverse'); | 
					
						
							|  |  |  |     xlabel('u (pixels)'); | 
					
						
							|  |  |  |     ylabel('v (pixels)'); | 
					
						
							|  |  |  |     set(gca, 'XAxisLocation', 'top'); | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 |