Coastal-Imaging-Research-Network / CIRN-Quantitative-Coastal-Imaging-Toolbox

The CIRN Introduction to Quantitative Coastal Imaging Toolbox is a collection of MATLAB scripts to produce geo-rectified images specifically tailored for quantitative analysis of coastal environments.
GNU General Public License v3.0
20 stars 7 forks source link

CIRN-Introduction-to-Quantitative-Coastal-Imaging-Toolbox #21

Closed SharifaKar closed 3 years ago

SharifaKar commented 4 years ago

Hi,

Just wanted to jump in and say that this toolbox is awesome! I am not familiar with MATLAB and this tutorial is very thorough, detailed, but not hard to follow.

Thanks Brittany!

burritobrittany commented 4 years ago

Thanks for the kind words! That was the goal! Always happy to answer any questions!

SharifaKar commented 4 years ago

Hey Brittany,

I was working through D_gridGenExampleRect.m and I do not have the Image Processing Toolbox, so I am unable to run this portion of the CIRN toolbox. It says in cameraSeamBlend bwdist requires Image Processing Toolbox (line 62).

burritobrittany commented 4 years ago

@SharifaKar

Yes, I apologize. We just recently found out that function needs the Image processing Toolbox.

Ultimately, what that function does is do a weighted average of the edges of each camera FOV. The pixels at the edges are not weighted as much as those in the center.

For a quick fix.... In imageRectifier.m (in the Core Functions folder), In Section 5, Line 154- comment out Ir=cameraSeamBlend(IrIndv) and enter the following Ir=uint8(sum(double(IrIndv),4)./sum(IrIndv>0,4));

Example Image: image

This code just averages all camera FOVs (no weighting). I know it looks convoluted... the extra stuff is to deal with 0 values, etc...but it is just an average. its not as pretty as the other function but gets the job done.

I will keep this issue up until we officially put this option in the code.

Thanks! Brittany

csherwood-usgs commented 4 years ago

There is a candidate replacement for bwdist in the Matlab Exchange: https://www.mathworks.com/matlabcentral/fileexchange/15455-3d-euclidean-distance-transform-for-variable-data-aspect-ratio

I did a cursory test of this and the return values have minor (round-off size) differences. I did not do extensive testing or timing, but, at first glance, it looks like you could free the code from dependence on the Image Processing Toolbox with this routine. % original code requires this function from Image Processing Toolbox Do = bwdist(binI); % replace with this code from Matlab Exchange D = bwdistsc(binI); After trapping this in the debugger and checking the difference: K>> max(D-Do,[],'all') ans = single 2.6044e-06 which is small compared to the average value of ~11.

sivaiahborra commented 4 years ago

Thanks for the kind words! That was the goal! Always happy to answer any questions!

Dear Brittany, It's really awesome and well organized for the beginners. I could run this toolbox with my own data (Fixed single camera station), but i got stuck at F_variableExtrinsicSolutions.m with an error Error using imread>parse_inputs (line 450) The file name or URL argument must be a character vector.

Error in imread (line 322) [filename, fmt_s, extraArgs, was_cached_fmt_used] = parse_inputs(cached_fmt, varargin{:});

Error in F_variableExtrinsicSolutions (line 215) In=imread(strcat(imageDirectory, '\', L(ffInd,:)));

Please let me know what could be the error. Of course for fixed station no need to run F_variableExtrinsicSolutions.m but while i was running G1_imageProducts.m after D_gridGenExampleRect.m The same error is showing while i was running the sample data given in toolbox..

Thank you.

burritobrittany commented 4 years ago

Hi @sivaiahborra, Have you pulled the latest copy from GitHub? If you are using a Mac or Linux machine, the '/' in the filenames of the demos were backwards in some instances. The latest copy fixes this. I think this may be your issue. If not, please let me know! Other than that... make sure the directory contains images, typed correctly, and is a cell. Thanks! Brittany

sivaiahborra commented 4 years ago

Dear Brittany, As l newly pulled the code from GitHub and run one by one in sequence in matlab R2017a on my windows 10 machine, but the same error is coming. But, there is chnage in '/' in recent one that is from '\' to '/'. But, still the same error is coming up.. Please advise and let me know.

On Mon, 17 Aug, 2020, 2:02 AM burritobrittany, notifications@github.com wrote:

Hi @sivaiahborra https://github.com/sivaiahborra, Have you pulled the latest copy from GitHub? If you are using a Mac or Linux machine, the '/' in the filenames of the demos were backwards in some instances. The latest copy fixes this. I think this may be your issue. If not, please let me know! Other than that... make sure the directory contains images, typed correctly, and is a cell. Thanks! Brittany

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Coastal-Imaging-Research-Network/CIRN-Quantitative-Coastal-Imaging-Toolbox/issues/21#issuecomment-674574345, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKXS4Q3SP3QHUIEXWWA3WDSBA653ANCNFSM4O4TSCYA .

sivaiahborra commented 4 years ago

Dear Brittany, As I informed you in my previous mail regarding the issue in running code (G1_imageProducts.m) by using sample data given in the toolbox, I request to fix this error and suggest to move ahead. Thank you.

*Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

On Mon, Aug 17, 2020 at 7:07 AM Sivaiah Borra siva4dad@gmail.com wrote:

Dear Brittany, As l newly pulled the code from GitHub and run one by one in sequence in matlab R2017a on my windows 10 machine, but the same error is coming. But, there is chnage in '/' in recent one that is from '\' to '/'. But, still the same error is coming up.. Please advise and let me know.

On Mon, 17 Aug, 2020, 2:02 AM burritobrittany, notifications@github.com wrote:

Hi @sivaiahborra https://github.com/sivaiahborra, Have you pulled the latest copy from GitHub? If you are using a Mac or Linux machine, the '/' in the filenames of the demos were backwards in some instances. The latest copy fixes this. I think this may be your issue. If not, please let me know! Other than that... make sure the directory contains images, typed correctly, and is a cell. Thanks! Brittany

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Coastal-Imaging-Research-Network/CIRN-Quantitative-Coastal-Imaging-Toolbox/issues/21#issuecomment-674574345, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKXS4Q3SP3QHUIEXWWA3WDSBA653ANCNFSM4O4TSCYA .

burritobrittany commented 4 years ago

@sivaiahborra Can you please copy and paste the errors you are getting for G1_ImageProducts? Also, are you trying to use the multicamera or single camera example data?

sivaiahborra commented 4 years ago

Dear Brittany, I am using single fixed camera I am getting the following error while I was running G1_imageProducts.m after D_gridGenExampleRect.m script

Error using imread>parse_inputs (line 450) The file name or URL argument must be a character vector.

Error in imread (line 322) [filename, fmt_s, extraArgs, was_cached_fmt_used] = parse_inputs(cached_fmt, varargin{:});

Error in G1_imageProducts (line 248) I{k}=imread(strcat(imageDirectory{k}, '\', L{k}(j)));

I am using Produced own calib_resluts.mat file for my camera by following example given WGS84/UTM zone 44N, GCPs in UTM mode, Extrinsics in which roll is zero since my camera position is fixed.

*Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

On Fri, Aug 21, 2020 at 4:57 PM burritobrittany notifications@github.com wrote:

@sivaiahborra https://github.com/sivaiahborra Can you please copy and paste the errors you are getting for G1_ImageProducts? Also, are you trying to use the multicamera or single camera example data?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Coastal-Imaging-Research-Network/CIRN-Quantitative-Coastal-Imaging-Toolbox/issues/21#issuecomment-678243048, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKXS4TTPTFXHLXCEGI5QE3SBZKZLANCNFSM4O4TSCYA .

burritobrittany commented 4 years ago

@sivaiahborra

Could you please copy paste what you have entered for Lines 106-189. Thanks Brittany

sivaiahborra commented 4 years ago

Dear Brittany, Here is my script of G1_imageProducts.m from 106 to 189. I have created a separate folder for my clarity, in such a way, I have created a folder named movie2imaes and stored all frames in the folder.

imageDirectory{1}='.\movie2images\';

%% Section 3: User Input: Grid Information

% Enter the filepath of the saved rectification grid created in % D1_gridGenExampleRectSingleCam Grid world coordinates need to be same coordinates % as those in the extrinsics in ieopath. Grid needs to be meshgrid format % with variables X,Y, and Z. gridPath='.\Grid\GRID_FixedSingle_UTM44N_2mResolution.mat';

% Enter if the user prefers local (localFlag==1) or world (localFlag==0) % coordinates. Not if localFlag==1, localAngle, localOrigin, and localX,Y,Z % in the ioeopath must all be non-empty. localFlag=0;

%% Section 4: User Input: Manual Entry of Time and Elevation % If a fixed station a time vector can be provided in the datenum format. % The length of the vector must match the number of images rectified and % coorectly correspond to each image. If using UAS or not desired, leave % empty. This was covered in F_variableExrtrinsicSolutions t=datenum(2020,07,18,11,23,0); % t={};

% If a Fixed station, most likely images will span times where Z is no % longer constant. We have to account for this in our Z grid. To do this, % enter a z vector below that is the same length as t. For each frame, the % entire z grid will be assigned to this value. If UAS or not desired, % leave empty. It is assumed elevation is constant during a short collect.

% Function can either have a temporally constant elevation grid with % spatially varying Z or a spatially constant elevation grid with a % temporally varying elevation value. The code needs to be modified to % have both. If zVariable is non-empty, this will take precedent and make % a spatially constant but temporally varying Z grid to rectify to zVariable={};

%% Section 5: Multi-Cam Demo input % Uncomment this section for the multi-camera demo. ImageDirectory and % ioeopath should be entered as cells, with each entry representing a % different camera. It is up to the user that entries between the two % variables correspond. Extrinsics between all cameras should be in the % same World Coordinate System. Note that no new grid is specified, the % cameras and images are all rectified to the same grid and time varying % elevation. Also it is important to note for imageDirectory, each camera % should have its own directory for images. The number of images in each % directory should be the same (T) as well as ordered by MATLAB so images % in the same order are simultaneous across cameras (i.e. the third image % in c1 is taken at t=1s, the third image in c2 is taken at t=1s, etc). % zVariable is from NOAA Tide Station at NAVD88 in meters.

% oname='fixedMultCamDemo_rect2mResolution'; % % odir= '.\X_FixedMultCamDemoData\output\fixedMultCamDemoRectified'; % % ioeopath{1}= '.\X_FixedMultCamDemoData\extrinsicsIntrinsics\C1_FixedMultiCamDemo.mat'; % ioeopath{2}= '.\X_FixedMultCamDemoData\extrinsicsIntrinsics\C2_FixedMultiCamDemo.mat'; % ioeopath{3}= '.\X_FixedMultCamDemoData\extrinsicsIntrinsics\C3_FixedMultiCamDemo.mat'; % ioeopath{4}= '.\X_FixedMultCamDemoData\extrinsicsIntrinsics\C4_FixedMultiCamDemo.mat'; % ioeopath{5}= '.\X_FixedMultCamDemoData\extrinsicsIntrinsics\C5_FixedMultiCamDemo.mat'; % ioeopath{6}= '.\X_FixedMultCamDemoData\extrinsicsIntrinsics\C6_FixedMultiCamDemo.mat';%

% % imageDirectory{1}='.\X_FixedMultCamDemoData\collectionData\c1'; % imageDirectory{2}='.\X_FixedMultCamDemoData\collectionData\c2'; % imageDirectory{3}='.\X_FixedMultCamDemoData\collectionData\c3'; % imageDirectory{4}='.\X_FixedMultCamDemoData\collectionData\c4'; % imageDirectory{5}='.\X_FixedMultCamDemoData\collectionData\c5'; % imageDirectory{6}='.\X_FixedMultCamDemoData\collectionData\c6'; % % % t=[datenum(2015,10,8,14,30,0):.5/24:datenum(2015,10,8,22,00,0)]; % % zVariable=[-.248 -.26 -.252 -.199 -.138 -.1 -.04 .112 .2 .315 .415 .506 .57 .586 .574 .519]; % *Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

On Fri, Aug 21, 2020 at 5:26 PM burritobrittany notifications@github.com wrote:

@sivaiahborra https://github.com/sivaiahborra

Could you please copy paste what you have entered for Lines 106-189. Thanks Brittany

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Coastal-Imaging-Research-Network/CIRN-Quantitative-Coastal-Imaging-Toolbox/issues/21#issuecomment-678253103, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKXS4T5Y2WX5INHFNDL2ETSBZOG3ANCNFSM4O4TSCYA .

burritobrittany commented 4 years ago

@sivaiahborra

  1. I am not sure you have the latest version of the code. On the master branch- I have at line 247 I{k}=imread(strcat(imageDirectory{k}, '/', L{k}(j)));. You have at line 248 I{k}=imread(strcat(imageDirectory{k}, '\', L{k}(j)));

  2. Your t variable at Line 132, needs to be the same length as the number of images you wish to rectify or empty.

  3. In '.\movie2images\';- you only have images in there correct? It needs to be only images, no folders, nothing else.

sivaiahborra commented 4 years ago

Initially, I did camera calibration by taking roughly 20 images of checkboards in different angles with my camera and ran toolbox_calib.zip and produced calib_resluts.mat file. Then Just for my clarity, I have created separate folders for each input and corresponding output and which are like Calib_results, Intrinsics, Extrinsics, movie2images, GCPs, Grid, ImageProducts, etc.,

######################################################################################################### 1.I ran A_formatIntrinsics.m script by changing inputs as follows from 45 to 58 and got the Calib_Results.mat in the Calib_results folder. oname='FixedSingle';

% Enter the directory where the mat file will be saved., odir= '.\Intrinsics';

%% Section 2: User Input: Intrinsics % Enter the filepath of the saved Caltech calibration results. If user is % going to enter the LCP manually, leave iopath={}; and enter in % Section 3. iopath= '.\Calib_results\Calib_Results.mat';

#########################################################################################################

  1. Then I ran A0_movie2frames.m script by changing inputs as follows from 32 to 78 and stored all the frames (eg. FixedSingle_1598610540000.tif ) in the movie2images folder.

%% Housekeeping close all clear all

% User should make sure that X_CoreFunctions and subfolders are made active % in their MATLAB path. Below is the standard location for demo, user will % need to change if X_CoreFunctions is moved and/or the current script. addpath(genpath('./X_CoreFunctions/'))

%% Section 1: User Input: Loading and Saving Information

% Enter the filepath where the movie is located. mpath='./RK beach.mp4';

% Enter the base name for the image files will be saved under. Name % should be descriptive of the camera such as 'Solo_4KVideo' or 'Duck_C1.' oname='FixedSingle';

% Enter the directory where the images will be saved. odir= './movie2images/';

%% Section 2: User Input: Timing Information and Framerate

% Enter the time of the first frame in [year,month,day,hr,min,sec] format. % If unknown leave as all zeros. Timing will just refer the the first frame % as t=0s. to= datenum(2020,08,28,10,29,0);

% Enter the Desired Frame Rate in frames/second (fps). Note, desired frame rate % should be a multiple or factor of the video orginal frame rate for equally % timed frames. Example: for a video at 30 fps one can accurately export % frames at 1,2,3,5,6,10,15 or 30 fps (multiples). Or for lower framerates % (<1 fps) the framerate would be (1./(N+n/30)) where N is the integer % number of seconds between frames and n is the fractional number of % frames (A Frame every 2.5 seconds would be 1./(2+15/30)=.4 fps).

frameRate=2; %fps

#########################################################################################################

  1. Later, I ran B_gcpSelection.m script by changing inputs as follows from 56 to 74 and stored FixedSingle_gcpUVdInitial.mat in the GCPs folder.

%% Section 1: User Input: Saving Information

% Enter the filename of the gcp .mat file that will be saved as. Name % should be descriptive of the camera/recording mode as well as GCP % deployment. oname='FixedSingle';

% Enter the directory where the mat file will be saved. odir= '.\GCPs';

%% Section 2: User Input: GCP Image % Enter the filepath of the saved image for clicking. For UAS, this should % be the first image of the collect.For fixed station, it should be any % frame where GCPs are visible. imagePath= '.\movie2images\FixedSingle_1598610540000.tif';

#########################################################################################################

  1. Then, later I ran the C_singleExtrinsicSolution.m script by changing inputs as follows from 71 to 143 and stored FixedSingle_IOEOInitial.mat in the Extrinsics folder.

%% Section 1: User Input: Saving Information

% Enter the filename of the IOEO .mat file that will be saved as. Name % should be descriptive of the camera/recording mode, GCP % deployment, and solution. oname='FixedSingle';

% Enter the directory where the IOEO file will be saved. odir= '.\Extrinsics\';

%% Section 2: User Input: Intrinsics % Filepath of the intrinsics matfile output by A_formatIntrinsics. Matfile % should contain at minimum the following variable. Note, the intrinsics % should correspond to the recording mode and camera/lens for the image % taken in B_gcpSelection, imagePath. iopath= '.\Intrinsics\FixedSingle_IO.mat';

%% Section 3: User Input: GCP Information % Enter the filepath of the GCP UVd Coordinates produced by B_gcpSelection. % The intinsics of the corresponding image from which the UVd GCP % coordinates were derived from should match that entered in Section 2. gcpUvdPath= '.\GCPs\FixedSingle_gcpUVdInitial.mat';

% Enter the filepath of the GCP World coordinates. File should be a % four column comma delimted txt file with columns representing gcp % number, x coordinate, y coordinate, and z coordinate. Rows will % correspond to each GCP. GCP numbers should match with those entered in % B_gcpSelection ((gcp().num)). gcpXyzPath='.\GCPs\FixedSingle_UTM_GCPS.txt';

% Enter a description of the GCP World coordinate system for your own % records. gcpCoord='WGS 84 / UTM zone 44N; meters'; %gcpCoord='UTM44N, WGS84; meters';

% Enter the path of the image you would like GCP reprojection checked % against (plotted in). This should be the same image used in % B_gcpSelection (imagePath) if you are doing a UAS collect or a moving % camera. imagePath='.\movie2images\FixedSingle_1598610540000.tif';

% Enter the numbers of GCPs you would like to use for the solution. % Numbers must match gcp.num values found in gpcUvPath file. You do not % have to use all of the clicked GCPS or GCPS listed in the file. gcpsUsed=[1 2 3 4 5];

%% Section 4: User Input: Solution Information % Enter the initial guess of extrinsics, for the corresponding camera % image. Extrinsics is formatted as [ x y z azimuth tilt swing] where xyz % correspond to the same world coordinate system as GCPs entered in % gcpXyzPath in Section 3. Azimuth, tilt and swing should be in radians. % For UAS, this information can be estimated from the autopilot. For fixed % camera stations it is suggested you survey in the location of the % cameras.

extrinsicsInitialGuess= [ 745888,1959765,10 deg2rad(75) deg2rad(84) deg2rad(0)]; % [ x y z azimuth tilt swing]

% Enter the number of knowns, or what you would like fixed in your EO % solution. 1 represents fixed where 0 represents floating (solvable) for % each value in beta. extrinsicsKnownsFlag= [ 0 0 0 0 0 0]; % [ x y z azimuth tilt swing]

GCPs are given in UTM as shown in below image

[image: image.png]

#########################################################################################################

Then, I ran D_gridGenExampleRect.m script by changing inputs as follows from 70 to 195 and stored FixedSingle_InitialFrame_2mdxdy_Local.png, FixedSingle_InitialFrame_2mdxdy_World.png, GRID_FixedSingle_UTM44N_2mResolution.mat in Grid folder

%% Section 1: User Input: Saving + Output Information

% Enter the filename the georectified images/figures will be saved as. % Name should be descriptive of the image timing, IOEO solution, and % camera name, and grid used.

oname='FixedSingle_InitialFrame_2mdxdy';

% Enter the filename of the of the grid .mat file. Name should be % descriptive of coordinate systems and resolution.

gname='FixedSingle_UTM44N_2mResolution';

% Enter the directory where the grid and image files will be saved. odir= '.\Grid';

% This is a flag to display intermediate steps in rectification, i.e. % showing transformation of XYZ-->Image, etc. It is implemented in the % function imageRectification. For this demo, DO NOT SET TO ZERO. teachingMode=1;

%% Section 2: User Input: Loading Information

% Filepath of the image you would like rectified. This should be the same % image used in B_gcpSelection and C_singleExtrinsicSolution (imagePath) % if you are doing a UAS collect or a moving camera. For a fixed camera, % it can be any image where intrinsics and extrinsics are valid. imagePath{1}= '.\movie2images\FixedSingle_1598610540000.tif';

% Enter the filepath of the saved IOEO calibration results produced by % C_singleExtrinsicSolution. ioeopath{1}= '.\Extrinsics\FixedSingle_IOEOInitial.mat';

% NOTE: For multiple cameras, these values are entered as cell entries for % each camera. The extrinsics for each camera should all be in the same % world coordinate system. It is up to the user to make sure the entries % for both variables correspond to the same cameras.Even for a single % camera, both imagePath and ioeopath need to be entered as cell functions % with one entry.

%% Section 3: User Input: Rectification Information

% Enter a description of the World coordinate system for your own % records. The world coordinate system of these should be the same as the % IOEO specified in C_singleExtrinsicSolution (gpsCoord, % camSolutionMeta.worldCoordSys). worldCoord='WGS 84 / UTM zone 44N; meters';

% Coordinate System Info: Enter the origin and angle if you would prefer % rectified output to be in a local rotated right hand coordinate system. % CIRN local coordinate systems typically have the new local X pointed % positive offshore, Y oriented alongshore, and the origin onshore of the % shoreline. If fields are entered, user will still be able to rectify in % both local and world coordinates. Note, if user already specified their % world coordinates as a local system, or do not desire a rotation, set % localOrigin and localAngle to [0,0] and 0.

% localOrigin = [0,0]; % [ x y] % localAngle =[0]; % Degrees +CCW from Original World X

localOrigin = [745888,1959765]; % [ x y] localAngle =[315]; % Degrees +CCW from Original World X

% Enter if you would like to INPUT your grid in rotated local % coordinates. 1=local coordinates, 0= world coordinates. % The function will still rectify both coordinate systems regardless % of localFlagInput value. LocalFlagInput only dictates % the coordinate system of the input and which direction the rotation % will occur. If localOrigin and localAngle =0; this value is irrelevant.

localFlagInput=0;

% Grid Specification. Enter the limits (ixlim, iylim) and resolution(idxdy) % of your rectified grid. Coordinate system entered will depend on % localFlagInput. Units should be consistent with world Coordinate system % (m vs ft, etc).

ixlim=[0 700]; iylim=[0 1000]; idxdy=2;

% Elevation Specification. Enter the elevation you would like your grid % rectified as. Typically, CIRN specifies an constant elevation across the % entire XY grid consistent with the corresponding tidal level the world % coordinate system. For more accurate results a spatially variable % elevation grid should be entered if available. However, this code is not % designed for that. If you would like to enter a spatially variable % elevation, say from SFM along with tidal elevation, enter your grid as iZ % It is up to the user to make sure it is same size as iX and iY.Spatially % variable Z values are more significant for run up calculations than for % surface current or bathymetric inversion calculations at a distance. % It can also affect image rectifications if concerned with topography % representation.

% What does alter bathymetric inversion, surface current, and run-up % calculations is a temporally variable z elevation. So make sure the % elevation value corresponds to the correct tidal value in time and % location. For short UAS collects, we can assume the elevation is % relatively constant during the collect. However for fixed stations we % would need a variable z in time. This function is designed for % rectification of a single frame, so z is considered constant in time. % Value should be entered in the World Coordinate system and units.

iz=0;

######## But, here i got two .png images as whole black, I think may be due to high tilt (84 deg) ##########

#########################################################################################################

After onwards, As I am running next G1_imageProducts.m script (since E_scpSelection.m and F_variableExtrinsicSolutions.m are not required to run in case of Fixed cameras) by changing inputs as follows from 74 to 148,

oname='FixedSingle_rect2mResolution';

% Enter the directory where the images will be saved. odir= '.\ImageProducts';

% Enter if you would like individual frames rectified and output. 1= yes, % output individual frames. 0= no, only output image products. outputFlag=1;

%% Section 2: User Input: Collection Information

% Enter the filepath of the saved CIRN IOEO calibration results produced by % C_singleExtrinsicSolution for fixed or F_variableExtrinsicSolutions for % UAS. ioeopath{1}= '.\Extrinsics\FixedSingle_IOEOInitial.mat';

% Enter the directory where your oblique imagery is stored. For UAS, the % names of the images must match those in imageNames output produced by % F_variableExtrinsicSolutions. For fixed cameras, the directory should % only have images in it, nothing else. imageDirectory{1}='.\movie2images\';

%% Section 3: User Input: Grid Information

% Enter the filepath of the saved rectification grid created in % D1_gridGenExampleRectSingleCam Grid world coordinates need to be same coordinates % as those in the extrinsics in ieopath. Grid needs to be meshgrid format % with variables X,Y, and Z. gridPath='.\Grid\GRID_FixedSingle_UTM44N_2mResolution.mat';

% Enter if the user prefers local (localFlag==1) or world (localFlag==0) % coordinates. Not if localFlag==1, localAngle, localOrigin, and localX,Y,Z % in the ioeopath must all be non-empty. localFlag=0;

%% Section 4: User Input: Manual Entry of Time and Elevation % If a fixed station a time vector can be provided in the datenum format. % The length of the vector must match the number of images rectified and % coorectly correspond to each image. If using UAS or not desired, leave % empty. This was covered in F_variableExrtrinsicSolutions t=datenum(2020,07,18,11,23,0); % t={};

% If a Fixed station, most likely images will span times where Z is no % longer constant. We have to account for this in our Z grid. To do this, % enter a z vector below that is the same length as t. For each frame, the % entire z grid will be assigned to this value. If UAS or not desired, % leave empty. It is assumed elevation is constant during a short collect.

% Function can either have a temporally constant elevation grid with % spatially varying Z or a spatially constant elevation grid with a % temporally varying elevation value. The code needs to be modified to % have both. If zVariable is non-empty, this will take precedent and make % a spatially constant but temporally varying Z grid to rectify to zVariable={};

########### I am getting following error ##################

Error using imread>parse_inputs (line 450) The file name or URL argument must be a character vector.

Error in imread (line 322) [filename, fmt_s, extraArgs, was_cached_fmt_used] = parse_inputs(cached_fmt, varargin{:});

Error in G1_imageProducts (line 248) I{k}=imread(strcat(imageDirectory{k}, '\', L{k}(j)));

So, I got stuck there and unable to run the rest of the code in this toolbox. Sorry for such a long message and please let me know what's the issue to go ahead.

*Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

On Fri, Aug 21, 2020 at 5:32 PM Sivaiah Borra siva4dad@gmail.com wrote:

Dear Brittany, Here is my script of G1_imageProducts.m from 106 to 189. I have created a separate folder for my clarity, in such a way, I have created a folder named movie2imaes and stored all frames in the folder.

imageDirectory{1}='.\movie2images\';

%% Section 3: User Input: Grid Information

% Enter the filepath of the saved rectification grid created in % D1_gridGenExampleRectSingleCam Grid world coordinates need to be same coordinates % as those in the extrinsics in ieopath. Grid needs to be meshgrid format % with variables X,Y, and Z. gridPath='.\Grid\GRID_FixedSingle_UTM44N_2mResolution.mat';

% Enter if the user prefers local (localFlag==1) or world (localFlag==0) % coordinates. Not if localFlag==1, localAngle, localOrigin, and localX,Y,Z % in the ioeopath must all be non-empty. localFlag=0;

%% Section 4: User Input: Manual Entry of Time and Elevation % If a fixed station a time vector can be provided in the datenum format. % The length of the vector must match the number of images rectified and % coorectly correspond to each image. If using UAS or not desired, leave % empty. This was covered in F_variableExrtrinsicSolutions t=datenum(2020,07,18,11,23,0); % t={};

% If a Fixed station, most likely images will span times where Z is no % longer constant. We have to account for this in our Z grid. To do this, % enter a z vector below that is the same length as t. For each frame, the % entire z grid will be assigned to this value. If UAS or not desired, % leave empty. It is assumed elevation is constant during a short collect.

% Function can either have a temporally constant elevation grid with % spatially varying Z or a spatially constant elevation grid with a % temporally varying elevation value. The code needs to be modified to % have both. If zVariable is non-empty, this will take precedent and make % a spatially constant but temporally varying Z grid to rectify to zVariable={};

%% Section 5: Multi-Cam Demo input % Uncomment this section for the multi-camera demo. ImageDirectory and % ioeopath should be entered as cells, with each entry representing a % different camera. It is up to the user that entries between the two % variables correspond. Extrinsics between all cameras should be in the % same World Coordinate System. Note that no new grid is specified, the % cameras and images are all rectified to the same grid and time varying % elevation. Also it is important to note for imageDirectory, each camera % should have its own directory for images. The number of images in each % directory should be the same (T) as well as ordered by MATLAB so images % in the same order are simultaneous across cameras (i.e. the third image % in c1 is taken at t=1s, the third image in c2 is taken at t=1s, etc). % zVariable is from NOAA Tide Station at NAVD88 in meters.

% oname='fixedMultCamDemo_rect2mResolution'; % % odir= '.\X_FixedMultCamDemoData\output\fixedMultCamDemoRectified'; % % ioeopath{1}= '.\X_FixedMultCamDemoData\extrinsicsIntrinsics\C1_FixedMultiCamDemo.mat'; % ioeopath{2}= '.\X_FixedMultCamDemoData\extrinsicsIntrinsics\C2_FixedMultiCamDemo.mat'; % ioeopath{3}= '.\X_FixedMultCamDemoData\extrinsicsIntrinsics\C3_FixedMultiCamDemo.mat'; % ioeopath{4}= '.\X_FixedMultCamDemoData\extrinsicsIntrinsics\C4_FixedMultiCamDemo.mat'; % ioeopath{5}= '.\X_FixedMultCamDemoData\extrinsicsIntrinsics\C5_FixedMultiCamDemo.mat'; % ioeopath{6}= '.\X_FixedMultCamDemoData\extrinsicsIntrinsics\C6_FixedMultiCamDemo.mat';%

% % imageDirectory{1}='.\X_FixedMultCamDemoData\collectionData\c1'; % imageDirectory{2}='.\X_FixedMultCamDemoData\collectionData\c2'; % imageDirectory{3}='.\X_FixedMultCamDemoData\collectionData\c3'; % imageDirectory{4}='.\X_FixedMultCamDemoData\collectionData\c4'; % imageDirectory{5}='.\X_FixedMultCamDemoData\collectionData\c5'; % imageDirectory{6}='.\X_FixedMultCamDemoData\collectionData\c6'; % % % t=[datenum(2015,10,8,14,30,0):.5/24:datenum(2015,10,8,22,00,0)]; % % zVariable=[-.248 -.26 -.252 -.199 -.138 -.1 -.04 .112 .2 .315 .415 .506 .57 .586 .574 .519]; % *Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

On Fri, Aug 21, 2020 at 5:26 PM burritobrittany notifications@github.com wrote:

@sivaiahborra https://github.com/sivaiahborra

Could you please copy paste what you have entered for Lines 106-189. Thanks Brittany

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Coastal-Imaging-Research-Network/CIRN-Quantitative-Coastal-Imaging-Toolbox/issues/21#issuecomment-678253103, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKXS4T5Y2WX5INHFNDL2ETSBZOG3ANCNFSM4O4TSCYA .

burritobrittany commented 4 years ago

@sivaiahborra In G1 please replace line 248 with I{k}=imread(char(strcat(imageDirectory{k}, '/', L{k}(j))));

I think it is a 2017 Matlab issue.

sivaiahborra commented 4 years ago

Yah, Woww , it's working Great thanks to you for your kind response and time. It resolved that issue but I couldn't understand properly how to give t and z values for a fixed camera in line 133 and 148 respectively shown below.

t={};

% If a Fixed station, most likely images will span times where Z is no % longer constant. We have to account for this in our Z grid. To do this, % enter a z vector below that is the same length as t. For each frame, the % entire z grid will be assigned to this value. If UAS or not desired, % leave empty. It is assumed elevation is constant during a short collect.

% Function can either have a temporally constant elevation grid with % spatially varying Z or a spatially constant elevation grid with a % temporally varying elevation value. The code needs to be modified to % have both. If zVariable is non-empty, this will take precedent and make % a spatially constant but temporally varying Z grid to rectify to zVariable={};

zVariable={};

############## it is saying that, If a fixed station a time vector can be provided in the datenum format, The length of the vector must match the number of images rectified and coorectly correspond to each image. Can you let me know how to give these values?

Thank you..

*Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

On Fri, Aug 21, 2020 at 8:44 PM burritobrittany notifications@github.com wrote:

@sivaiahborra https://github.com/sivaiahborra In G1 please replace line 248 with I{k}=imread(char(strcat(imageDirectory{k}, '/', L{k}(j))));

I think it is a 2017 Matlab issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Coastal-Imaging-Research-Network/CIRN-Quantitative-Coastal-Imaging-Toolbox/issues/21#issuecomment-678344272, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKXS4WJ3UYRJTQYET4Y6RTSB2FMVANCNFSM4O4TSCYA .

burritobrittany commented 4 years ago

@sivaiahborra Glad it worked!

First find the number of images you have- Lets call that N. Get the first time of your first image.- call that to- should be in datenum format --- datenum(2018,10,etc) get the framerate of your images -- dt in seconds

t=to+(0:(N-1))*(dt/24/3600);

Z needs to be a vector that is 1xN with tidal elevations in your datum. You will have to find that from a website etc.

sivaiahborra commented 4 years ago

Thanks to your great response and time once again. The same error is there in the next script G2_pixelInstruments.m in line 319 and 370. it's also resolved by applying the same. I have 624 frames withme .i.e N=624, framerate is 2 .i.e dt = 0.5 sec, time of my first frame is t0 =datenum(2020,07,28,10,29,0). Here is my code if i am not mistaken

to= datenum(2020,07,28,10,29,0); dt = 0.5; N = 624; t=to+(0:(N-1))*(dt/24/3600);

If my tidal level was 0.6 m at my study site during corresponding time of video acquisition from my datum WGS84, Then can i give z value as follows zVariable=repmat(0.6,[1,624]);

Now, I will be able to run code successfully but, still I have few queries regarding issuing inputs such as how to assign local and world coordinates while I was giving my GCPs in UTM mode. Once I will be back and go through the entire document. If I am unable then, I Hope I can clear my queries with your support.

Thank you.

*Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

On Fri, Aug 21, 2020 at 10:42 PM burritobrittany notifications@github.com wrote:

@sivaiahborra https://github.com/sivaiahborra Glad it worked!

First find the number of images you have- Lets call that N. Get the first time of your first image.- call that to- should be in datenum format --- datenum(2018,10,etc) get the framerate of your images -- dt in seconds

t=to+(0:(N-1))*(dt/24/3600);

Z needs to be a vector that is 1xN with tidal elevations in your datum. You will have to find that from a website etc.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Coastal-Imaging-Research-Network/CIRN-Quantitative-Coastal-Imaging-Toolbox/issues/21#issuecomment-678397291, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKXS4RJHSKQLXZQBE4TQODSB2TIPANCNFSM4O4TSCYA .

sivaiahborra commented 4 years ago

Dear Brittany, Can you let me know what could be the reason for getting my rectified outputs as whole black instead of a little portion of image? I mean if you once let me know which of the following will be the cause for the above said issue so that I can revise that accordingly and run the toolbox again. Inaccuracy of GCPs, Increasing camera tilt angle, Less accurate camera calibration results. Or anything else which raises the same issue.

Thank you.

*Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

On Sat, Aug 22, 2020 at 3:18 AM Sivaiah Borra siva4dad@gmail.com wrote:

Thanks to your great response and time once again. The same error is there in the next script G2_pixelInstruments.m in line 319 and 370. it's also resolved by applying the same. I have 624 frames withme .i.e N=624, framerate is 2 .i.e dt = 0.5 sec, time of my first frame is t0 =datenum(2020,07,28,10,29,0). Here is my code if i am not mistaken

to= datenum(2020,07,28,10,29,0); dt = 0.5; N = 624; t=to+(0:(N-1))*(dt/24/3600);

If my tidal level was 0.6 m at my study site during corresponding time of video acquisition from my datum WGS84, Then can i give z value as follows zVariable=repmat(0.6,[1,624]);

Now, I will be able to run code successfully but, still I have few queries regarding issuing inputs such as how to assign local and world coordinates while I was giving my GCPs in UTM mode. Once I will be back and go through the entire document. If I am unable then, I Hope I can clear my queries with your support.

Thank you.

*Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

On Fri, Aug 21, 2020 at 10:42 PM burritobrittany notifications@github.com wrote:

@sivaiahborra https://github.com/sivaiahborra Glad it worked!

First find the number of images you have- Lets call that N. Get the first time of your first image.- call that to- should be in datenum format --- datenum(2018,10,etc) get the framerate of your images -- dt in seconds

t=to+(0:(N-1))*(dt/24/3600);

Z needs to be a vector that is 1xN with tidal elevations in your datum. You will have to find that from a website etc.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Coastal-Imaging-Research-Network/CIRN-Quantitative-Coastal-Imaging-Toolbox/issues/21#issuecomment-678397291, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKXS4RJHSKQLXZQBE4TQODSB2TIPANCNFSM4O4TSCYA .

burritobrittany commented 4 years ago

Are you getting a correct image in D_gridGenExampleRect?

I would make sure you are entering your local or global coordinate system parameters correctly. Remember, they need to be in the same units and coordinates as your extrinsics in C.

sivaiahborra commented 4 years ago

No, I am not getting. I am getting output is as follows [image: image.png]

Here are my changes in inputs of D_gridGenExampleRect.m as follows from the 70 to 195 line. %% Section 1: User Input: Saving + Output Information

% Enter the filename the georectified images/figures will be saved as. % Name should be descriptive of the image timing, IOEO solution, and % camera name, and grid used.

oname='FixedSingle_InitialFrame_2mdxdy';

% Enter the filename of the of the grid .mat file. Name should be % descriptive of coordinate systems and resolution.

gname='FixedSingle_UTM44N_2mResolution';

% Enter the directory where the grid and image files will be saved. odir= '.\Grid';

% This is a flag to display intermediate steps in rectification, i.e. % showing transformation of XYZ-->Image, etc. It is implemented in the % function imageRectification. For this demo, DO NOT SET TO ZERO. teachingMode=1;

%% Section 2: User Input: Loading Information

% Filepath of the image you would like rectified. This should be the same % image used in B_gcpSelection and C_singleExtrinsicSolution (imagePath) % if you are doing a UAS collect or a moving camera. For a fixed camera, % it can be any image where intrinsics and extrinsics are valid. imagePath{1}= '.\movie2images\FixedSingle_1598610540000.tif';

% Enter the filepath of the saved IOEO calibration results produced by % C_singleExtrinsicSolution. ioeopath{1}= '.\Extrinsics\FixedSingle_IOEOInitial.mat';

% NOTE: For multiple cameras, these values are entered as cell entries for % each camera. The extrinsics for each camera should all be in the same % world coordinate system. It is up to the user to make sure the entries % for both variables correspond to the same cameras.Even for a single % camera, both imagePath and ioeopath need to be entered as cell functions % with one entry.

%% Section 3: User Input: Rectification Information

% Enter a description of the World coordinate system for your own % records. The world coordinate system of these should be the same as the % IOEO specified in C_singleExtrinsicSolution (gpsCoord, % camSolutionMeta.worldCoordSys). worldCoord='WGS 84 / UTM zone 44N; meters';

% Coordinate System Info: Enter the origin and angle if you would prefer % rectified output to be in a local rotated right hand coordinate system. % CIRN local coordinate systems typically have the new local X pointed % positive offshore, Y oriented alongshore, and the origin onshore of the % shoreline. If fields are entered, user will still be able to rectify in % both local and world coordinates. Note, if user already specified their % world coordinates as a local system, or do not desire a rotation, set % localOrigin and localAngle to [0,0] and 0.

localOrigin = [0,0]; % [ x y] localAngle =[0]; % Degrees +CCW from Original World X

% localOrigin = [745888,1959765]; % [ x y] % localAngle =[315]; % Degrees +CCW from Original World X

% Enter if you would like to INPUT your grid in rotated local % coordinates. 1=local coordinates, 0= world coordinates. % The function will still rectify both coordinate systems regardless % of localFlagInput value. LocalFlagInput only dictates % the coordinate system of the input and which direction the rotation % will occur. If localOrigin and localAngle =0; this value is irrelevant.

localFlagInput=0;

% Grid Specification. Enter the limits (ixlim, iylim) and resolution(idxdy) % of your rectified grid. Coordinate system entered will depend on % localFlagInput. Units should be consistent with world Coordinate system % (m vs ft, etc).

ixlim=[0 700]; iylim=[0 1000]; idxdy=2;

% Elevation Specification. Enter the elevation you would like your grid % rectified as. Typically, CIRN specifies an constant elevation across the % entire XY grid consistent with the corresponding tidal level the world % coordinate system. For more accurate results a spatially variable % elevation grid should be entered if available. However, this code is not % designed for that. If you would like to enter a spatially variable % elevation, say from SFM along with tidal elevation, enter your grid as iZ % It is up to the user to make sure it is same size as iX and iY.Spatially % variable Z values are more significant for run up calculations than for % surface current or bathymetric inversion calculations at a distance. % It can also affect image rectifications if concerned with topography % representation.

% What does alter bathymetric inversion, surface current, and run-up % calculations is a temporally variable z elevation. So make sure the % elevation value corresponds to the correct tidal value in time and % location. For short UAS collects, we can assume the elevation is % relatively constant during the collect. However for fixed stations we % would need a variable z in time. This function is designed for % rectification of a single frame, so z is considered constant in time. % Value should be entered in the World Coordinate system and units.

iz=0;

Please let me know. Is this fine or am I making a mistake anywhere?

*Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Fri, Aug 28, 2020 at 10:15 PM burritobrittany notifications@github.com wrote:

Are you getting a correct image in D_gridGenExampleRect?

I would make sure you are entering your local or global coordinate system parameters correctly.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Coastal-Imaging-Research-Network/CIRN-Quantitative-Coastal-Imaging-Toolbox/issues/21#issuecomment-682866773, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKXS4WCYIGESMANTBFOZELSC7NJRANCNFSM4O4TSCYA .

burritobrittany commented 4 years ago

Hi @sivaiahborra

In your code you have the following.....

localOrigin = [0,0]; % [ x y] localAngle =[0]; % Degrees +CCW from Original World X

% localOrigin = [745888,1959765]; % [ x y] % localAngle =[315]; % Degrees +CCW from Original World X

localOrigin and localAngle should only =0 if your input from C is in local coordinates. You specify that your coordinate system is worldCoord='WGS 84 / UTM zone 44N; meters';--not local. I think you tried to enter below but did not uncomment it. Try this

%localOrigin = [0,0]; % [ x y] %localAngle =[0]; % Degrees +CCW from Original World X

localOrigin = [745888,1959765]; % [ x y] localAngle =[315]; % Degrees +CCW from Original World X

Hope this helps!

sivaiahborra commented 4 years ago

Thank you for your email. I did comment localOrigin and localAngle, but this time two images are coming with the whole black like before.

I collected GCPs in lat, lon and height format, then converted into a projected coordinate system .i.e. UTM zone 44N to get output in meters instead of lat, lon and height. so, I gave the input (GCPS.txt, ExtrinsicsIntialGuess) in C as in UTM format as per my zone 44N as shown below.

%% Section 3: User Input: GCP Information % Enter the filepath of the GCP UVd Coordinates produced by B_gcpSelection. % The intinsics of the corresponding image from which the UVd GCP % coordinates were derived from should match that entered in Section 2. gcpUvdPath= '.\GCPs\FixedSingle_gcpUVdInitial.mat';

% Enter the filepath of the GCP World coordinates. File should be a % four column comma delimted txt file with columns representing gcp % number, x coordinate, y coordinate, and z coordinate. Rows will % correspond to each GCP. GCP numbers should match with those entered in % B_gcpSelection ((gcp().num)). gcpXyzPath='.\GCPs\FixedSingle_UTM_GCPS.txt';

% Enter a description of the GCP World coordinate system for your own % records. gcpCoord='WGS 84 / UTM zone 44N; meters'; %gcpCoord='UTM44N, WGS84; meters';

% Enter the path of the image you would like GCP reprojection checked % against (plotted in). This should be the same image used in % B_gcpSelection (imagePath) if you are doing a UAS collect or a moving % camera. imagePath='.\movie2images\FixedSingle_1598610540000.tif';

% Enter the numbers of GCPs you would like to use for the solution. % Numbers must match gcp.num values found in gpcUvPath file. You do not % have to use all of the clicked GCPS or GCPS listed in the file. gcpsUsed=[1 2 3 4 5];

%% Section 4: User Input: Solution Information % Enter the initial guess of extrinsics, for the corresponding camera % image. Extrinsics is formatted as [ x y z azimuth tilt swing] where xyz % correspond to the same world coordinate system as GCPs entered in % gcpXyzPath in Section 3. Azimuth, tilt and swing should be in radians. % For UAS, this information can be estimated from the autopilot. For fixed % camera stations it is suggested you survey in the location of the % cameras.

extrinsicsInitialGuess= [ 745888,1959765,10 deg2rad(75) deg2rad(84) deg2rad(0)]; % [ x y z azimuth tilt swing]

% Enter the number of knowns, or what you would like fixed in your EO % solution. 1 represents fixed where 0 represents floating (solvable) for % each value in beta. extrinsicsKnownsFlag= [ 0 0 0 0 0 0]; % [ x y z azimuth tilt swing]

I was thinking a high tilt angle might be a problem for this but, not sure. I have my GCPs in lat, lon, height format, but I have to get my final outputs in meters

*Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Sat, Aug 29, 2020 at 8:35 PM burritobrittany notifications@github.com wrote:

Hi @sivaiahborra https://github.com/sivaiahborra

In your code you have the following.....

localOrigin = [0,0]; % [ x y] localAngle =[0]; % Degrees +CCW from Original World X

% localOrigin = [745888,1959765]; % [ x y] % localAngle =[315]; % Degrees +CCW from Original World X

localOrigin and localAngle should only =0 if your input from C is in local coordinates. You specify that your coordinate system is worldCoord='WGS 84 / UTM zone 44N; meters';--not local. I think you tried to enter below but did not uncomment it. Try this

%localOrigin = [0,0]; % [ x y] %localAngle =[0]; % Degrees +CCW from Original World X

localOrigin = [745888,1959765]; % [ x y] localAngle =[315]; % Degrees +CCW from Original World X

Hope this helps!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Coastal-Imaging-Research-Network/CIRN-Quantitative-Coastal-Imaging-Toolbox/issues/21#issuecomment-683302456, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKXS4QLCMECZHVQ5KZ4HT3SDEKLXANCNFSM4O4TSCYA .

burritobrittany commented 4 years ago

I would check the following...

  1. What is the order of magnitude of your errors in C? They all need to be <1m.
  2. If those are good, have you tried changing your shoreline angle in D? Or origin? Perhaps you can place it in a location you know your field of view sees? Just to get a estimate? Also make sure to check your limits that they match. I would play with these values. It is a trial and error process.
sivaiahborra commented 4 years ago

I have taken local origin as lat, lon of camera and local angle taken by comparing orientation of x (offshore) relative to x (geo) shown below. I am not sure how far am i correct in picking my local angle? [image: local_angle.png] While I was running the C_singleExtrinsicSolution.m script, I am getting clicked UVs vs Reprojected UVd image with little inaccuracies maybe due to using less resolution devices to collect GCPs. as shown in below

[image: Screenshot (59).png] After that, I am getting rectification output as whole black while I was running D_gridGenExampleRect.m script. as shown below. [image: Screenshot (62).png]

*Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#m_-7147002536220869538m-5706679899157506976_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Sun, Aug 30, 2020 at 6:40 PM burritobrittany notifications@github.com wrote:

I would check the following...

  1. What is the order of magnitude of your errors in C? They all need to be <1m.
  2. If those are good, have you tried changing your shoreline angle in D? Or origin? Perhaps you can place it in a location you know your field of view sees? Just to get a estimate? Also make sure to check your limits that they match. I would play with these values. It is a trial and error process.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Coastal-Imaging-Research-Network/CIRN-Quantitative-Coastal-Imaging-Toolbox/issues/21#issuecomment-683418970, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKXS4XDGMF4NRYPRJFIW5LSDJFTTANCNFSM4O4TSCYA .

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#m_-7147002536220869538_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

sivaiahborra commented 4 years ago

Dear Brittany, North Carolina State Plane, NAVD88; meters mentioned in demo scripts. Is it local coordinates which you made for convenience ? If so, Can I do that with these scripts?

*Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Sun, Aug 30, 2020 at 7:30 PM Sivaiah Borra siva4dad@gmail.com wrote:

I have taken local origin as lat, lon of camera and local angle taken by comparing orientation of x (offshore) relative to x (geo) shown below. I am not sure how far am i correct in picking my local angle? [image: local_angle.png] While I was running the C_singleExtrinsicSolution.m script, I am getting clicked UVs vs Reprojected UVd image with little inaccuracies maybe due to using less resolution devices to collect GCPs. as shown in below

[image: Screenshot (59).png] After that, I am getting rectification output as whole black while I was running D_gridGenExampleRect.m script. as shown below. [image: Screenshot (62).png]

*Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#m_5127116702414697626m-7147002536220869538m-5706679899157506976_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Sun, Aug 30, 2020 at 6:40 PM burritobrittany notifications@github.com wrote:

I would check the following...

  1. What is the order of magnitude of your errors in C? They all need to be <1m.
  2. If those are good, have you tried changing your shoreline angle in D? Or origin? Perhaps you can place it in a location you know your field of view sees? Just to get a estimate? Also make sure to check your limits that they match. I would play with these values. It is a trial and error process.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Coastal-Imaging-Research-Network/CIRN-Quantitative-Coastal-Imaging-Toolbox/issues/21#issuecomment-683418970, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKXS4XDGMF4NRYPRJFIW5LSDJFTTANCNFSM4O4TSCYA .

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#m_5127116702414697626m-7147002536220869538_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

burritobrittany commented 4 years ago

@sivaiahborra

I cannot see your images. Please upload them in the GitHub interface. If you are responding via e-mail they will not show up.

You can either use geographical coordinates (like UTM) or local coordinates. You can do this through the following options.

  1. Your GCPs should be in UTM 44N, easting and northing.

In D.

Option 1: Leave localOrigin=0 and localAngle=0. Then ixlim, iylim should be entered in UTM 44N as well. Not [0 700] or [0 1000]

Option 2: Enter values for localOrigin and localAngle. Leave localFlagInput=1. Then enter ixlim,iylim as distances from your origin. This will only work if your local Origin and localAngle are correct.

Please see Figure 13 in the UserManual for help with localOrigin and localAngle.

sivaiahborra commented 4 years ago

@burritobrittany These are three images which I want to share.. Do I need to mention values for localOrigin and localAngle in UTM as you mentioned as option 2?

local_angle Screenshot (62) Screenshot (59)

Anyhow, I am getting following error as i am changing Localflag origin and angle accordingly the before message. It's may be due to giving improper values Index exceeds matrix dimensions.

Error in imageRectifier (line 130) ir(kk,j,:)=I{k}(Vd(kk,j),Ud(kk,j),:);

Error in D_gridGenExampleRect (line 337) [Ir]= imageRectifier(I,intrinsics,extrinsics,X,Y,Z,teachingMode);

The accuracy between clicked vs reprojected UVds is decreasing i.e. both are not matching well. It;'s coming like shown in above image only when I give no of GcpsUsed=[1 2 3 4 5], They are not matching well when i change my no.of GcpsUsed = [1 2 5] or [1 3 4 5 ] etc,.

sivaiahborra commented 4 years ago

@burritobrittany

Here I am attaching my inputs for your reference. since I already once sent all input portions of each script from A to D in my earlier query regarding matlab2017a version issue.

Here is my FixedSingle_UTM_GCPS.txt file Screenshot (367)

My extrinsic initial guess extrinsicsInitialGuess= [ 745888,1959765,10 deg2rad(75) deg2rad(84) deg2rad(0)]; % [ x y z azimuth tilt swing]

I am actually getting an Index exceeds matrix dimensions error while i was giving ixlim, iylim in UTM. How to give values of ixlim, iylim in UTM. I mean, by taking end locations of my frame in x and y directions and give those as limits in UTM?

I will also include camera calibration results if it's needed.

burritobrittany commented 4 years ago

Thank you, your images were very helpful.

To fix your all black images...

  1. Please try entering in D

localFlagInput=1;

localOrigin = [745888,1959765]; % [ x y] localAngle =[315]; % Degrees +CCW from Original World X

ixlim=[0 700]; iylim=[0 1000]; idxdy=2;

Please make sure these values are not commented out or are overwritten.

If this does not work, could you please provide the value of the output 'extrinsics' from C.

After we fix this issue, we can discuss your GCP accuracy. While I do not think they are the cause of this error, they still can be improved and I will try to help

sivaiahborra commented 4 years ago

@burritobrittany

I tried like how you said by giving inputs as follows

localOrigin = [745888,1959765]; % [ x y] localAngle =[315]; % Degrees +CCW from Original World X

% Enter if you would like to INPUT your grid in rotated local % coordinates. 1=local coordinates, 0= world coordinates. % The function will still rectify both coordinate systems regardless % of localFlagInput value. LocalFlagInput only dictates % the coordinate system of the input and which direction the rotation % will occur. If localOrigin and localAngle =0; this value is irrelevant.

localFlagInput=1;

% Grid Specification. Enter the limits (ixlim, iylim) and resolution(idxdy) % of your rectified grid. Coordinate system entered will depend on % localFlagInput. Units should be consistent with world Coordinate system % (m vs ft, etc).

ixlim=[0 700]; iylim=[0 1000]; idxdy=2;

But, again the same following error is coming.

Index exceeds matrix dimensions.

Error in imageRectifier (line 130) ir(kk,j,:)=I{k}(Vd(kk,j),Ud(kk,j),:);

Error in D_gridGenExampleRect (line 337) [Ir]= imageRectifier(I,intrinsics,extrinsics,X,Y,Z,teachingMode);

Here are my extrinsics of C

Screenshot (72)

burritobrittany commented 4 years ago

I would try improving your extrinsic calculations in C. You have a roll of 22 degrees and a heading of 97 degrees. From your image it seems roll would be zero and heading 33 degrees.

sivaiahborra commented 4 years ago

Dear Brittany, I gave roll as Zero in extrinsics ( extrinsicsInitialGuess= [ 745888,1959765,10 deg2rad(75) deg2rad(84) deg2rad(0)]; % [ x y z azimuth tilt swing] ) since my camera position is fixed if I am not wrong in understanding what you said.

*Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Mon, Aug 31, 2020 at 8:40 PM burritobrittany notifications@github.com wrote:

I would try improving your extrinsic calculations in C. You have a roll of 22 degrees and a heading of 97 degrees. From your image it seems roll would be zero and heading 33 degrees.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Coastal-Imaging-Research-Network/CIRN-Quantitative-Coastal-Imaging-Toolbox/issues/21#issuecomment-683840055, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKXS4WBMN7V2C23A2TYP33SDO4NXANCNFSM4O4TSCYA .

burritobrittany commented 4 years ago

In C... see the following

% Enter the number of knowns, or what you would like fixed in your EO % solution. 1 represents fixed where 0 represents floating (solvable) for % each value in beta. extrinsicsKnownsFlag= [ 0 0 0 0 0 0]; % [ x y z azimuth tilt swing]

Here, you put a 1 if you want your extrinsicsInitialGuess value to be 'fixed.' If all zeros that means that the program will solve for them. This is different then a 'fixed' camera. This is about how the non-linear solver determines the solution of any camera.

Its always a good idea to see what is the difference between extrinsicsInitialGuess and extrinsics output. This will show if your values are fixed or not.

I would suggest doing extrinsicsKnownsFlag= [ 0 0 0 0 0 1]; with roll=0 in your initial guess. Look at your output and iterate on that. I.e. Take your ouput and put it is as an initial guess.

sivaiahborra commented 4 years ago

Dear Brittany,

For each iteration, do I need to keep extrinsicsKnownsFlag= [ 0 0 0 0 0 1] as it is and replace the output of extrinsics in place of extrinsicsInitialGuess ? If it's so I did as you suggested as follows

extrinsicsInitialGuess= [ 745888,1959765,10 deg2rad(75) deg2rad(84) deg2rad(0)]; % [ x y z azimuth tilt swing]

% Enter the number of knowns, or what you would like fixed in your EO % solution. 1 represents fixed where 0 represents floating (solvable) for % each value in beta. extrinsicsKnownsFlag= [ 0 0 0 0 0 1]; % [ x y z azimuth tilt swing]

I am getting results as follows 745734.641460197 1959709.43526850 77.1666899033420 1.66759579982706 1.27129314726602 0 then, replace extrinsicsInitialGuess with above output and got the second iteraton is as follows

extrinsicsInitialGuess= [ 745734.641460197 1959709.43526850 77.1666899033420 1.66759579982706 1.27129314726602 0]; % [ x y z azimuth tilt swing]

% Enter the number of knowns, or what you would like fixed in your EO % solution. 1 represents fixed where 0 represents floating (solvable) for % each value in beta. extrinsicsKnownsFlag= [ 0 0 0 0 0 1]; % [ x y z azimuth tilt swing]

Output of extrinsics 745734.641450810 1959709.43527231 77.1667089629842 1.66759582700387 1.27129310506220 0

*Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Mon, Aug 31, 2020 at 10:08 PM burritobrittany notifications@github.com wrote:

In C... see the following

% Enter the number of knowns, or what you would like fixed in your EO % solution. 1 represents fixed where 0 represents floating (solvable) for % each value in beta. extrinsicsKnownsFlag= [ 0 0 0 0 0 0]; % [ x y z azimuth tilt swing]

Here, you put a 1 if you want your extrinsicsInitialGuess value to be 'fixed.' If all zeros that means that the program will solve for them. This is different then a 'fixed' camera. This is about how the non-linear solver determines the solution of any camera.

Its always a good idea to see what is the difference between extrinsicsInitialGuess and extrinsics output. This will show if your values are fixed or not.

I would suggest doing extrinsicsKnownsFlag= [ 0 0 0 0 0 1]; with roll=0 in your initial guess. Look at your output and iterate on that. I.e. Take your ouput and put it is as an initial guess.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Coastal-Imaging-Research-Network/CIRN-Quantitative-Coastal-Imaging-Toolbox/issues/21#issuecomment-683892519, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKXS4V6OV627BSIBQIWE4TSDPGZDANCNFSM4O4TSCYA .

sivaiahborra commented 4 years ago

Dear Brittany,

I actually collected the camera position (lat, lon and height) by GPS, Azimuth by magnetic compass, Tilt by a kind of clinometer/protractor and roll is taken as 0 since the camera position is fixed. This is how I collected the extrinsics parameters of the camera and entered in code. Is this the correct way of collecting data or any wrong in it? *Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Mon, Aug 31, 2020 at 11:07 PM Sivaiah Borra siva4dad@gmail.com wrote:

Dear Brittany,

For each iteration, do I need to keep extrinsicsKnownsFlag= [ 0 0 0 0 0 1] as it is and replace the output of extrinsics in place of extrinsicsInitialGuess ? If it's so I did as you suggested as follows

extrinsicsInitialGuess= [ 745888,1959765,10 deg2rad(75) deg2rad(84) deg2rad(0)]; % [ x y z azimuth tilt swing]

% Enter the number of knowns, or what you would like fixed in your EO % solution. 1 represents fixed where 0 represents floating (solvable) for % each value in beta. extrinsicsKnownsFlag= [ 0 0 0 0 0 1]; % [ x y z azimuth tilt swing]

I am getting results as follows 745734.641460197 1959709.43526850 77.1666899033420 1.66759579982706 1.27129314726602 0 then, replace extrinsicsInitialGuess with above output and got the second iteraton is as follows

extrinsicsInitialGuess= [ 745734.641460197 1959709.43526850 77.1666899033420 1.66759579982706 1.27129314726602 0]; % [ x y z azimuth tilt swing]

% Enter the number of knowns, or what you would like fixed in your EO % solution. 1 represents fixed where 0 represents floating (solvable) for % each value in beta. extrinsicsKnownsFlag= [ 0 0 0 0 0 1]; % [ x y z azimuth tilt swing]

Output of extrinsics 745734.641450810 1959709.43527231 77.1667089629842 1.66759582700387 1.27129310506220 0

*Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#m_6744240342116241883_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Mon, Aug 31, 2020 at 10:08 PM burritobrittany notifications@github.com wrote:

In C... see the following

% Enter the number of knowns, or what you would like fixed in your EO % solution. 1 represents fixed where 0 represents floating (solvable) for % each value in beta. extrinsicsKnownsFlag= [ 0 0 0 0 0 0]; % [ x y z azimuth tilt swing]

Here, you put a 1 if you want your extrinsicsInitialGuess value to be 'fixed.' If all zeros that means that the program will solve for them. This is different then a 'fixed' camera. This is about how the non-linear solver determines the solution of any camera.

Its always a good idea to see what is the difference between extrinsicsInitialGuess and extrinsics output. This will show if your values are fixed or not.

I would suggest doing extrinsicsKnownsFlag= [ 0 0 0 0 0 1]; with roll=0 in your initial guess. Look at your output and iterate on that. I.e. Take your ouput and put it is as an initial guess.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Coastal-Imaging-Research-Network/CIRN-Quantitative-Coastal-Imaging-Toolbox/issues/21#issuecomment-683892519, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKXS4V6OV627BSIBQIWE4TSDPGZDANCNFSM4O4TSCYA .

SRHarrison commented 4 years ago

Dear @sivaiahborra, The position that you can measure in the field is a good initial estimate, but should still be considered 'unknown' if you have enough GCPs to calculate the position. Calculated position will be more accurate than the measured. Keep in mind that the extrinsic initial guess azimuth should be relative to the local coordinate system, with an Azimuth of 90deg looking straight offshore and 0deg looking all the way left along the positive y axis. Tilt is 90deg looking at horizon, 0deg nadir, etc.

If I had to guess, I think your azimuth value is too far from a good estimate. Is that the measured magnetic heading from a compass? You sample image looks like it's looking up the coast further, maybe at an azimuth of ~33deg like @burritobrittany suggested. Also, you have enough GCPs to solve for roll rather than assume it's known. I'd set it to 0 not 1.

v/r Shawn

burritobrittany commented 4 years ago

Thank you for the input shawn!

Yes, what shawn says is correct. However, azimuth is relative to the world Northing and Easting...not local coordinates. Please see this image for reference. So actually 75 is probably an accurate guess. So sorry- this was my mistake. Fig14

burritobrittany commented 4 years ago

@sivaiahborra If okay with you, please comment with an image and mat file from C. I will look at it to see where the code is failing.

sivaiahborra commented 4 years ago

Yah I got azimuth value as 75 degrees from geographical true north when I placed my compass in the which horizontal direction of camera is pointing.

Edits in inputs section of C

%% Section 1: User Input: Saving Information

% Enter the filename of the IOEO .mat file that will be saved as. Name % should be descriptive of the camera/recording mode, GCP % deployment, and solution. oname='FixedSingle';

% Enter the directory where the IOEO file will be saved. odir= '.\Extrinsics\';

%% Section 2: User Input: Intrinsics % Filepath of the intrinsics matfile output by A_formatIntrinsics. Matfile % should contain at minimum the following variable. Note, the intrinsics % should correspond to the recording mode and camera/lens for the image % taken in B_gcpSelection, imagePath. iopath= '.\Intrinsics\FixedSingle_IO.mat';

%% Section 3: User Input: GCP Information % Enter the filepath of the GCP UVd Coordinates produced by B_gcpSelection. % The intinsics of the corresponding image from which the UVd GCP % coordinates were derived from should match that entered in Section 2. gcpUvdPath= '.\GCPs\FixedSingle_gcpUVdInitial.mat';

% Enter the filepath of the GCP World coordinates. File should be a % four column comma delimted txt file with columns representing gcp % number, x coordinate, y coordinate, and z coordinate. Rows will % correspond to each GCP. GCP numbers should match with those entered in % B_gcpSelection ((gcp().num)). gcpXyzPath='.\GCPs\FixedSingle_UTM_GCPS.txt';

% Enter a description of the GCP World coordinate system for your own % records. gcpCoord='WGS 84 / UTM zone 44N; meters'; %gcpCoord='UTM44N, WGS84; meters';

% Enter the path of the image you would like GCP reprojection checked % against (plotted in). This should be the same image used in % B_gcpSelection (imagePath) if you are doing a UAS collect or a moving % camera. imagePath='.\movie2images\FixedSingle_1598610540000.tif';

% Enter the numbers of GCPs you would like to use for the solution. % Numbers must match gcp.num values found in gpcUvPath file. You do not % have to use all of the clicked GCPS or GCPS listed in the file. gcpsUsed=[1 2 3 4 5];

%% Section 4: User Input: Solution Information % Enter the initial guess of extrinsics, for the corresponding camera % image. Extrinsics is formatted as [ x y z azimuth tilt swing] where xyz % correspond to the same world coordinate system as GCPs entered in % gcpXyzPath in Section 3. Azimuth, tilt and swing should be in radians. % For UAS, this information can be estimated from the autopilot. For fixed % camera stations it is suggested you survey in the location of the % cameras.

extrinsicsInitialGuess= [ 745888,1959765,10 deg2rad(75) deg2rad(84) deg2rad(0)]; % [ x y z azimuth tilt swing]

% Enter the number of knowns, or what you would like fixed in your EO % solution. 1 represents fixed where 0 represents floating (solvable) for % each value in beta. extrinsicsKnownsFlag= [ 0 0 0 0 0 1]; % [ x y z azimuth tilt swing]

Output of extrinsics from C is as follows Actually, Z value at my camera position is 10 m, but, in calculated extrinsics.mat file, it is coming like 77.1847 shown below extrinsics of output from C

745734.613325400 1959709.43110645 77.1847045489105 1.66761520779091 1.27125881247050 0

Screenshot (332)

burritobrittany commented 4 years ago

@sivaiahborra

Please upload FixedSingle_IO.mat' FixedSingle_gcpUVdInitial.mat FixedSingle_1598610540000.tif';

If you are getting 77.18m that is a sign you have a poor solution. If you can I would try to determine more GCPs. Right now you have them in a straight line. Ideally you should have them well distributed on the beach at different elevations. Also, GCP accuracies are very important...so if you can get estimates it would be beneficial.

You need to try to vary your initial guess and fixed parameters to refine your solution. Use your output as a guess for another iteration.

This is a very difficult part of the process and takes time, so please do not get discouraged.

sivaiahborra commented 4 years ago

FixedSingle_IO.mat 4000 2250 2068.70604011295 1005.02436168370 2982.77676305280 2983.51152502005 -0.0150332583982606 0.292020893371850 0 -0.0128983594481790 0.00851853695335397

FixedSingle_gcpUVdInitial.mat [1044.22018348624,997.195281782438] 1 '.\movie2images\FixedSingle_1598610540000.tif' [637.981651376147,814.600262123198] 2 '.\movie2images\FixedSingle_1598610540000.tif' [366.212319790302,695.701179554390] 3 '.\movie2images\FixedSingle_1598610540000.tif' [182.201834862385,615.019659239843] 4 '.\movie2images\FixedSingle_1598610540000.tif' [204.849279161206,544.246395806029] 5 '.\movie2images\FixedSingle_1598610540000.tif'

FixedSingle_1598610540000.tif

FixedSingle_1595932140000

Note: .tif format is not supporting to upload the same image ( FixedSingle_1598610540000.tif';) I uploaded in .png format after running A for a while.

burritobrittany commented 4 years ago

Looking at your input... I believe your intrinsic calculations are incorrect.

In your intrinsic variable- you have NU and NV being 4000 and 2250. These variables are the sizes of your image in pixels. The image you sent me is only 1080x 1920. THis is why there is an error in D and you cannot get a good solution.

When you perform your intrinsic calculation you need to do the following...

  1. Use the same exact camera, lens, and focal length that is used in the photo above.
  2. Make sure the camera is in the same recording mode as your camera above (this may be why the pictures are different sizes).
sivaiahborra commented 4 years ago

Dear Brittany, Ok, Do you mean there is error in Calib_Results.mat? Once again I will calculate the intrinsics and get back to you. But, let me know once that I am following the procedure mentioned in the first example of camera calibration toolbox for matlab. Hope I am correct in this, but, I have to take care in being the same camera which I used to take video, same lens and focal length.

Thank you for great timely assistance and help. Very soon I will get back to you after finishing that.

*Thanks & *Regards B. Sivaiah Research Scholar Dept. of Meteorology & Oceanography Andhra University Visakhapatnam - 530003 INDIA - 91-9676155827

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Tue, Sep 1, 2020 at 8:13 PM burritobrittany notifications@github.com wrote:

Looking at your input... I believe your intrinsic calculations are incorrect.

In your intrinsic variable- you have NU and NV being 4000 and 2250. These variables are the sizes of your image in pixels. The image you sent me is only 1080x 1920. THis is why there is an error in D and you cannot get a good solution.

When you perform your intrinsic calculation you need to do the following...

  1. Use the same exact camera, lens, and focal length that is used in the photo above.
  2. Make sure the camera is in the same recording mode as your camera above (this may be why the pictures are different sizes).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Coastal-Imaging-Research-Network/CIRN-Quantitative-Coastal-Imaging-Toolbox/issues/21#issuecomment-684906260, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKXS4RCQJ2IMLG26OTBWCLSDUCAZANCNFSM4O4TSCYA .

burritobrittany commented 4 years ago

Yes. There is an error in Calib_results.mat.

The first example should be correct.

You need to use the same camera, focal length, and lens...if the camera has been changed in any way you are going to have reduced accuracy.

It is important that the recording mode is the same as when you captured your beach cameras. I.e. If you did video- you need to record video of your checkerboard and make into frames using AO. Then put this in the calibration example.

sivaiahborra commented 4 years ago

Ohh. I actually taken images of checkboards by image mode not in recording mode of my camera. Ok I will take a small video of checkborads in different orientations mentioned in first example and convert into frames by using AO. Thank you.

burritobrittany commented 4 years ago

Excellent! Sounds like we have a plan!

sivaiahborra commented 4 years ago

Dear Brittany, I will be able to fix that issue by changing my Calib_Results.mat but, I got images which are not good to identify any feature instead of black images..

I will upload those images

sivaiahborra commented 4 years ago

Dear Brittany, After correcting my Calib_Results.mat, following are results of D_gridGenExampleRect.m Screenshot (391) Screenshot (392) Then, result of G1_imageProducts.m Screenshot (393) Screenshot (394) Screenshot (395) finally, result of G2_pixelInstruments.m Screenshot (399) Screenshot (398) Screenshot (397) Screenshot (396)

These are the results after I corrected my Calib_Results.mat. But, the images are not looking proper and in case of pixel instruments, they are coming whole black and transects are not showing in one picture..

Please let me know what else needs to be done to make it improve.

sivaiahborra commented 4 years ago

@burritobrittany Please let me know what else to be modify to improve my results. Thank you.