This repository has been archived by the owner on May 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sampleAerielleVideoDemoPIX -- uses pixel toolbox to make pixel insts. Various tweaks and some new functions to deal with this.
- Loading branch information
Showing
15 changed files
with
616 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
function [ud,vd] = distortCaltech(u,v,lcp) | ||
% [ud,vd] = DJIDistort(u,v,lcp) | ||
% | ||
% converts from undistorted to distorted pixel locations for a DJI phantom. | ||
% This is based on equations from the Caltech lens distortion manuals. | ||
% lcp contains all the relevant intrinsic as well as radial and tangential | ||
% distortion coefficients. | ||
|
||
% written Dec 2015, updated from a now obsolete version that used a single | ||
% lens calibration for the largest (chip size) image while converting from | ||
% smaller image types. This was found not to work for phantom 3s. | ||
|
||
% find the range dependent correction factor, fr. | ||
x = (u(:)-lcp.c0U)/lcp.fx; % normalize to tanAlpha | ||
y = (v(:)-lcp.c0V)/lcp.fy; | ||
r2 = x.*x + y.*y; % distortion found based on Large format units | ||
fr = interp1(lcp.r,lcp.fr,sqrt(r2)); | ||
dx = interp2(lcp.x,lcp.y,lcp.dx,x,y); | ||
dy = interp2(lcp.x,lcp.y,lcp.dy,x,y); | ||
x2 = x.*fr + dx; | ||
y2 = y.*fr + dy; | ||
ud = x2*lcp.fx+lcp.c0U; % answer in chip pixel units | ||
vd = y2*lcp.fy+lcp.c0V; | ||
|
||
|
||
% | ||
% Copyright (C) 2017 Coastal Imaging Research Network | ||
% and Oregon State University | ||
|
||
% This program is free software: you can redistribute it and/or | ||
% modify it under the terms of the GNU General Public License as | ||
% published by the Free Software Foundation, version 3 of the | ||
% License. | ||
|
||
% This program is distributed in the hope that it will be useful, | ||
% but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
% GNU General Public License for more details. | ||
|
||
% You should have received a copy of the GNU General Public License | ||
% along with this program. If not, see | ||
% <http://www.gnu.org/licenses/>. | ||
|
||
% CIRN: https://coastal-imaging-research-network.github.io/ | ||
% CIL: http://cil-www.coas.oregonstate.edu | ||
% | ||
%key UAVProcessingToolbox | ||
% | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
function [geom, cam, ip] = lcpBeta2GeomCamIp( lcp, beta ) | ||
|
||
% function [cam, geom, ip] = lcpBeta2GeomCamIp( lcp, beta ) | ||
% | ||
% use the lcp and beta values to create the cam, geom, and ip structs | ||
% that the PIXEL toolbox uses to build a collect (findUV, findXYX). | ||
|
||
% step 1, make a P, then get the m from it. | ||
P = lcpBeta2P( lcp, beta ); | ||
m = P2m( P ); | ||
|
||
cam.cameraNumber = 1; | ||
cam.x = beta(1); | ||
cam.y = beta(2); | ||
cam.z = beta(3); | ||
cam.lcp = lcp; | ||
|
||
geom.m = m; | ||
geom.azimuth = beta(4); | ||
geom.fov = -1; | ||
|
||
ip.width = lcp.NU; | ||
ip.height = lcp.NV; | ||
|
||
|
||
% | ||
% Copyright (C) 2017 Coastal Imaging Research Network | ||
% and Oregon State University | ||
|
||
% This program is free software: you can redistribute it and/or | ||
% modify it under the terms of the GNU General Public License as | ||
% published by the Free Software Foundation, version 3 of the | ||
% License. | ||
|
||
% This program is distributed in the hope that it will be useful, | ||
% but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
% GNU General Public License for more details. | ||
|
||
% You should have received a copy of the GNU General Public License | ||
% along with this program. If not, see | ||
% <http://www.gnu.org/licenses/>. | ||
|
||
% CIRN: https://coastal-imaging-research-network.github.io/ | ||
% CIL: http://cil-www.coas.oregonstate.edu | ||
% | ||
%key UAVProcessingToolbox | ||
% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
function P = lcpBeta2P( lcp, beta ) | ||
|
||
% function P = lcpBeta2P( lcp, beta ) | ||
% | ||
% create a P matrix from the lcp and beta | ||
% | ||
% used by findUV6DOF and findXYZnDOF and to make things | ||
% for pixel toolbox geometry. | ||
|
||
K = [lcp.fx 0 lcp.c0U; | ||
0 -lcp.fy lcp.c0V; | ||
0 0 1]; | ||
|
||
R = angles2R(beta(4), beta(5), beta(6)); | ||
IC = [eye(3) -beta(1:3)']; | ||
P = K*R*IC; | ||
P = P/P(3,4); % unnecessary since we will also normalize UVs | ||
|
||
return; | ||
|
||
|
||
% | ||
% Copyright (C) 2017 Coastal Imaging Research Network | ||
% and Oregon State University | ||
|
||
% This program is free software: you can redistribute it and/or | ||
% modify it under the terms of the GNU General Public License as | ||
% published by the Free Software Foundation, version 3 of the | ||
% License. | ||
|
||
% This program is distributed in the hope that it will be useful, | ||
% but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
% GNU General Public License for more details. | ||
|
||
% You should have received a copy of the GNU General Public License | ||
% along with this program. If not, see | ||
% <http://www.gnu.org/licenses/>. | ||
|
||
% CIRN: https://coastal-imaging-research-network.github.io/ | ||
% CIL: http://cil-www.coas.oregonstate.edu | ||
% | ||
%key UAVProcessingToolbox | ||
% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
function r = makePixelInstsDemo( ) | ||
|
||
% Make pixel instruments using pixel toolbox. duplicate of demoInstsFile. | ||
|
||
PIXForget; | ||
PIXSetStation('aerielle'); | ||
|
||
zmsl = 0; | ||
|
||
instID = []; | ||
|
||
% vbar insts | ||
y = [450 700]; | ||
x = [125:25:225]; | ||
|
||
for ii=1:length(x) | ||
|
||
name = ['vbar' num2str(x(ii))]; | ||
tid = PIXMakeVBAR( x(ii), y(1), x(ii), y(2), zmsl, name); | ||
instID = [instID tid]; | ||
|
||
end | ||
|
||
% runup | ||
xshore = 125; | ||
xdune = 70; | ||
y = 60:50:650; | ||
rot = 0; | ||
|
||
for ii=1:length(y) | ||
[xr, yr, zr] = runupPIXArray( xshore, xdune, y(ii), zmsl, rot ); | ||
name = ['runup' num2str(fix(y(ii)))]; | ||
tid = PIXCreateInstrument( name, 'runup', PIXFixedZ+PIXUniqueOnly ); | ||
PIXAddPoints( tid, xr, yr, zr, name ); | ||
instID = [instID tid]; | ||
end | ||
|
||
% cBathy | ||
dx = 5; | ||
dy = 5; | ||
x1 = 80; | ||
x2 = 400; | ||
y1 = 450; | ||
y2 = 900; | ||
|
||
tid = PIXCreateInstrument( 'mBW', 'matrix', PIXFixedZ+PIXDeBayerStack ); | ||
PIXAddMatrix( tid, x1, y1, x2, y2, zmsl, dx, dy ); | ||
instID = [instID tid]; | ||
|
||
% stability slices | ||
tid = PIXCreateInstrument( 'x300Slice', 'line', PIXFixedZ+PIXUniqueOnly ); | ||
PIXAddLine( tid, 300, 500, 300, 540, 7, .1, 'x300Slice' ); | ||
instID = [instID tid]; | ||
tid = PIXCreateInstrument( 'y517Slice', 'line', PIXFixedZ+PIXUniqueOnly ); | ||
PIXAddLine( tid, 100, 520, 115, 520, 7, .1, 'y517Slice' ); | ||
instID = [instID tid]; | ||
|
||
|
||
% make a package of all insts | ||
pid = PIXCreatePackage('AerielleDemo', instID); | ||
e = matlab2Epoch(now); | ||
|
||
% build the initial r | ||
r = PIXCreateR( pid, e, zmsl, 'none' ); | ||
|
||
end | ||
|
Oops, something went wrong.