Changeset 1111
- Timestamp:
- Jan 26, 2022, 9:31:42 AM (3 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/geometry_calib.m
r1107 r1111 255 255 ['Error max (along x,y)=' num2str(GeometryCalib.ErrorMax) ' pixels']; 256 256 [num2str(numel(ind_removed)) ' points removed']}); 257 SliceCoord_ref=[0 0 0]; %default reference plane257 % SliceCoord_ref=[0 0 0]; %default reference plane 258 258 if strcmp(answer,'Yes') %store the calibration data 259 if strcmp(calib_cell{val}(1:2),'3D')%set the plane position for 3D (projection) calibration 260 answer=msgbox_uvmat('INPUT_Y-N',{['Assume that the current image is in the plane of the calib points z=' num2str(Z_plane) ] ; 'can be later modified by MenuSetSlice in the upper bar menu of uvmat'}); 261 SliceCoord_ref=Z_plane'*[0 0 1]; 259 Z=Coord(:,3); 260 if strcmp(calib_cell{val}(1:2),'3D') && isequal(max(Z),min(Z))%set the plane position for 3D (projection) calibration 261 %set the Z position of the reference plane used for calibration 262 answer=msgbox_uvmat('INPUT_Y-N',{['Assume that the illuminated plane is at z=' num2str(Z(1)) ] ; 'can be later modified by MenuSetSlice in the upper bar menu of uvmat'}); 263 if strcmp(answer,'Yes') 264 GeometryCalib.NbSlice=1; 265 GeometryCalib.SliceCoord=[0 0 Z(1)]; 266 end 262 267 end 263 268 else … … 390 395 ind_max=[];ind_removed=[];Z_plane=[]; 391 396 % apply the calibration, whose type is selected in handles.calib_type 397 CoordFlip=Coord; 398 CoordFlip(:,3)=-Coord(:,3); 392 399 if ~isempty(Coord) 393 GeometryCalib=feval(CalibFcn,Coord ,Intrinsic);400 GeometryCalib=feval(CalibFcn,CoordFlip,Intrinsic); 394 401 else 395 402 msgbox_uvmat('ERROR','No calibration points, abort') … … 401 408 402 409 % estimate calibration error rms and max 403 X=Coord(:,1);404 Y=Coord(:,2);410 % X=Coord(:,1); 411 % Y=Coord(:,2); 405 412 Z=Coord(:,3); 406 413 x_ima=Coord(:,4); 407 414 y_ima=Coord(:,5); 408 [Xpoints,Ypoints]=px_XYZ(GeometryCalib, X,Y,Z);415 [Xpoints,Ypoints]=px_XYZ(GeometryCalib,Coord(:,1),Coord(:,2),Coord(:,3));% convention of downward z coordinate (facing the camera) 409 416 GeometryCalib.ErrorRms(1)=sqrt(mean((Xpoints-x_ima).*(Xpoints-x_ima))); 410 417 GeometryCalib.ErrorRms(2)=sqrt(mean((Ypoints-y_ima).*(Ypoints-y_ima))); … … 434 441 end 435 442 GeometryCalib.ErrorMax=ErrorMax; 436 % set the Z position of the reference plane used for calibration437 if isequal(max(Z),min(Z))%Z constant438 Z_plane=Z(1);439 GeometryCalib.NbSlice=1;440 GeometryCalib.SliceCoord=[0 0 Z_plane];441 end443 % %set the Z position of the reference plane used for calibration 444 % if isequal(max(Z),min(Z))%Z constant 445 % Z_plane=Z(1); 446 % GeometryCalib.NbSlice=1; 447 % GeometryCalib.SliceCoord=[0 0 Z_plane]; 448 % end 442 449 443 450 -
trunk/src/phys_XYZ.m
r1110 r1111 76 76 if isfield(Calib,'R') 77 77 R=(Calib.R)'; 78 R(3)=-R(3); 79 R(6)=-R(6); 80 R(9)=-R(9); 78 81 c=Z0virt; 79 82 cvirt=Z0virt; … … 91 94 cvirt=Z0virt-avirt*Calib.SliceCoord(Zindex,1)-bvirt*Calib.SliceCoord(Zindex,2);% Z0 = (virtual) z coordinate on the rotation axis (assumed horizontal) 92 95 % c=z coordinate at (x,y)=(0,0) 93 c=Z0 virt-a*Calib.SliceCoord(Zindex,1)-b*Calib.SliceCoord(Zindex,2);96 c=Z0-a*Calib.SliceCoord(Zindex,1)-b*Calib.SliceCoord(Zindex,2); 94 97 R(1)=R(1)+avirt*R(3); 95 98 R(2)=R(2)+bvirt*R(3); -
trunk/src/px_XYZ.m
r1107 r1111 47 47 H=Calib.InterfaceCoord(3); 48 48 if H>Zphys 49 Zphys=H-(H-Zphys)/Calib.RefractionIndex; %corrected z (virtual object) 49 Zphys=H-(H-Zphys)/Calib.RefractionIndex; %corrected z (virtual object)Calib 50 50 51 % test_refraction=1; 51 52 end … … 53 54 54 55 %camera coordinates 56 Zphys=-Zphys;%flip z coordinates 55 57 xc=R(1)*Xphys+R(2)*Yphys+R(3)*Zphys+Calib.Tx_Ty_Tz(1); 56 58 yc=R(4)*Xphys+R(5)*Yphys+R(6)*Zphys+Calib.Tx_Ty_Tz(2);
Note: See TracChangeset
for help on using the changeset viewer.