Import the file names from the list provided by Duane E.

filenamesRaw=(* Import["/Users/mcgill/Documents/My\ Projects/Pelagic-Benthic\ Coupling/Laser\ Measure/Jun2021\ Test/Image\ File\ Names\ Jun2021.txt","Table"][[All,2]]; *)
Import["/Volumes/ProjectLibrary/900622.PelagicBenthic/Laser\ Measure/Laser_calibration_images/2021_06_21/Image\ File\ Names\ Jun2021.txt","Table"][[All,2]];

First@filenamesRaw

Throw away extraneous characters at the beginning and end of the file paths.

filenames=StringDrop[#,-5]&/@(StringDrop[#,4]&/@filenamesRaw);

First@filenames

Import the translation vectors from a file that’s part of the MATLAB output that Duane E. provided.

transDatRaw=(* Import["/Users/mcgill/Documents/My\ Projects/Pelagic-Benthic\ Coupling/Laser\ Measure/Jun2021\ Test/Translation\ Vectors\ Jun2021.txt","Table"]; *)
Import["/Volumes/ProjectLibrary/900622.PelagicBenthic/Laser\ Measure/Laser_calibration_images/2021_06_21/Translation\ Vectors\ Jun2021.txt","Table"];

First@transDatRaw

Strip away all the extraneous entries.

transDat=transDatRaw[[All,{2,4,5,7,8,10}]];

First@transDat

Import the rotation vectors from a file that’s part of the MATLAB output that Duane E. provided.

rotDatRaw=(* Import["/Users/mcgill/Documents/My\ Projects/Pelagic-Benthic\ Coupling/Laser\ Measure/Jun2021\ Test/Rotation\ Vectors\ Jun2021.txt","Table"]; *)
Import["/Volumes/ProjectLibrary/900622.PelagicBenthic/Laser\ Measure/Laser_calibration_images/2021_06_21/Rotation\ Vectors\ Jun2021.txt","Table"];

First@rotDatRaw

Strip away all the extraneous entries.

rotDat=rotDatRaw[[All,{2,4,5,7,8,10}]];

First@rotDat

Convert the rotation data from radians to degrees.

rotDatDeg=rotDat/Degree;

First@rotDatDeg

Verify that all the data tables are the same length.

Length@filenames

Length@transDat

Length@rotDatDeg

Format the data so that the translation and rotation data are paired with the correct file name.

tableDat=Partition[Flatten[Riffle[Partition[Riffle[filenames,transDat[[All,{1,3,5}]]],2],rotDatDeg[[All,{1,3,5}]]]],7];

First@tableDat

Format the data into a nice table.

TextGrid[Prepend[tableDat,{"File Name","X trn (mm)","Y trn (mm)","Z trn (mm)","X rot (deg)","Y rot (deg)","Z rot (deg)"}],Frame->All]

Format the data into a second table with only the last 27 images, which were used to measure the laser offset and direction vectors.

TextGrid[Prepend[Take[tableDat,-27],{"File Name","X trn (mm)","Y trn (mm)","Z trn (mm)","X rot (deg)","Y rot (deg)","Z rot (deg)"}],Frame->All]

Export the data in csv format.

Export["LMCalJun2021.csv",Prepend[Take[tableDat,-27],{"File Name","X trn (mm)","Y trn (mm)","Z trn (mm)","X rot (deg)","Y rot (deg)","Z rot (deg)"}]]

Enter the image size in pixels and imaging cell size in cm for the ROV’s Ikegami HDL-57 camera.

imageSize={1920,1080}
cellSizeCm={0.9587,0.5393}

Verify that the image cell pixels are 5 µm square.

pixelSize=cellSizeCm/imageSize

Calculate the focal length and field of view based on the Zhang calibration. Because the pixels are nominally square, the h and v focal lengths should be the same but there is some noise in the calculation. Use the average of the two values from this line in the calibration file:

Focal length (pixels):   [ 1589.4668 +/- 1.8917     1591.4754 +/- 1.9061  ]

focalLengthPixels=1590

focalLengthCm=focalLengthPixels 0.0005

fieldOfView=((ArcTan[((0.5 cellSizeCm)/focalLengthCm)])/Degree) 2