Skip to content
This repository was archived by the owner on May 18, 2022. It is now read-only.

AppendixB

mpalmsten edited this page Dec 29, 2016 · 4 revisions

Example Instrument Design m-file

Pixel instruments are designed in a function named makeInstsDemo.m, using xyz space. Below is an example. Instruments are currently of type line (contiguous, for example a vbar line that can be processed to estimate alongshore current speed ) or matrix (an array of non-contiguous pixels, for example like cBathy). Instruments have fields

  • type
  • xyz
  • name
  • shortName
  • x
  • y
  • z
  • xyzAll

Type is ‘line’ or ‘matrix’. Name and shortName are up to the user by we use a standard set of CIL names, for example vBar125 means an alongshore oriented vBar array located at x = 125 m. runup600 is a cross-shore line of pixels at y=600, and mBW is a cBathy array (for historical reasons, dating from the BeachWizard days). Line instruments are specified by their two xyz end points. In this case, the x, y, and z fields are unused. A matrix is specified by those x and y fields [xmin dx xmax] and [ymin dy ymax] while the z field specifies a scalar sea level to sample at. For a matrix, the xyz field is unused. The last two instruments below are simply a cross-shore and alongshore slice through a known edge (of the pier) to test the stability of a fixed object after image stabilization.

function insts = makeInstsDemo
%   insts = makeInstsDemo
%
% creates pixel instruments for DJI video.  Types can be line or matrix

cnt = 1;

% vBar instruments
y = [450 700];
x = [125: 25: 225];
z = 0;
for i = 1: length(x)
    insts(cnt).type = 'line';
    insts(cnt).xyz = [x(i) y(1) z; x(i) y(2) z];
    eval(['insts(cnt).name = ''vBar' num2str(x(i)) ''';']);
    eval(['insts(cnt).shortName = ''vBar' num2str(x(i)) ''';']);
    cnt = cnt+1;
end

% some runup lines
x = [70 125];
y = [600:50:650];
z = 0;
for i = 1: length(y)
    insts(cnt).type = 'line';
    insts(cnt).xyz = [x(1) y(i) z; x(2) y(i) z];
    eval(['insts(cnt).name = ''runup' num2str(y(i)) ''';']);
    eval(['insts(cnt).shortName = ''runup' num2str(y(i)) ''';']);
    cnt = cnt+1;
end

% cBathy array
x = [80 5 400];   % determine sample region and spacing
y = [450 5 900];    % format is [min del max]
z = 0;
insts(cnt).type = 'matrix';
insts(cnt).name = 'cBathyArray';
insts(cnt).shortName = 'mBW';
insts(cnt).x = x;
insts(cnt).y = y;
insts(cnt).z = z;
cnt = cnt+1;

% make some slices to check stability
insts(cnt).type = 'line';
insts(cnt).xyz = [300 540 7; 300 500 7];
insts(cnt).name = 'x = 300 pier transect';
insts(cnt).shortName = 'x300Slice';
cnt = cnt+1;

insts(cnt).type = 'line';
insts(cnt).xyz = [100 520 3; 115 520 3];
insts(cnt).name = 'y = 520 Piling x-transect';
insts(cnt).shortName = 'y517Slice';

Hartley, R., and A. Zisserman (2003), Multiple view geometry in computer vision, second ed., 665 pp., Cambridge University Press.

Clone this wiki locally