Commit 7738440a987be8f87a2f18faf83f128cf5e525f2

Authored by Elie Dumas-Lefebvre
1 parent e70023e3
Exists in master

Ajout de documentation dans g_res_field et changements legers dans g_vis_field p…

…our permettre son utilisation peu importe la version de matlab
Showing 2 changed files with 48 additions and 10 deletions   Show diff stats
src/g_rect/g_res_field.m
1   -function delta = g_res_field(LAT, LON)
  1 +function res = g_res_field(LAT, LON, varargin)
  2 +% g_res_field - Function calculating the loss of resolution with de distance
  3 +% from the camera
  4 +%
  5 +% Inputs:
  6 +%
  7 +% LAT : Latitude matrix obtained from g_rect
  8 +%
  9 +% LON : Longitude matrix obtained from g_rect
  10 +%
  11 +% Outputs:
  12 +%
  13 +% res : The field of resolution which is degrading with distance from
  14 +% the camera
  15 +%
  16 +%
  17 +% Author: Daniel Bourgault
  18 +% Institut des sciences de la mer de Rimouski
  19 +%
  20 +% email: daniel_bourgault@uqar.ca
  21 +% Website: http://demeter.uqar.ca/g_rect/
  22 +% February 2013
  23 +%
  24 +% Author: Elie Dumas-Lefebvre
  25 +% Institut des Science de la Mer de Rimouski
  26 +%
  27 +% Note: Matricial formulation of the calculation for a faster execution
  28 +%
  29 +% email: elie.dumas-lefebvre@uqar.ca
  30 +% March 2019
  31 +%
2 32  
3 33 % LAT and LON difference in the x-axis
4 34 dLATi = diff(LAT, 1, 2);
... ... @@ -17,6 +47,7 @@ meterPerDegLat = 1852*60.0;
17 47 meterPerDegLoni = meterPerDegLat .* cosd(LAT_meani);
18 48 meterPerDegLonj = meterPerDegLat .* cosd(LAT_meanj);
19 49  
  50 +% Conversion from degrees to meters
20 51 dxi = dLONi.*meterPerDegLoni;
21 52 dxj = dLONj.*meterPerDegLonj;
22 53  
... ... @@ -27,8 +58,13 @@ dyj = dLATj.*meterPerDegLat;
27 58 deltai = sqrt(dxi.^2 + dyi.^2);
28 59 deltaj = sqrt(dxj.^2 + dyj.^2);
29 60  
30   -% Overall distance
31   -delta = sqrt(deltai.^2 + deltaj.^2);
  61 +% Adjusting the shape for plotting
  62 +deltai = deltai(1:end-1, :);
  63 +deltaj = deltaj(:, 1:end-1);
  64 +
  65 +% field of resolution
  66 +res = sqrt(deltai.^2 + deltaj.^2);
  67 +
32 68  
33 69 end
34 70  
... ...
src/g_rect/g_viz_field.m
... ... @@ -9,7 +9,7 @@ function [h_figure,h_pcolor,h_datetext] = g_viz_field(imgFname,rectFile,varargin
9 9 % showTime, Default 0, if 1, displays the timestamp of the
10 10 % image in the figure's title
11 11 % showLand, Default 0, if 'f' or 'h', displays the land contour
12   -% with m_gshhs_f or m_gshhs_f
  12 +% with m_gshhs_f or m_gshhs_h
13 13 % landcolor, Default [241 235 144]/255, Color of the land on the
14 14 % map
15 15 %
... ... @@ -72,8 +72,7 @@ int = int';
72 72  
73 73 int = int - nanmean(nanmean(int));
74 74  
75   -
76   -
  75 +figure('Renderer', 'painters', 'Position', [100 100 900 700])
77 76 m_proj('mercator','longitudes',[lon_min lon_max],'latitudes',[lat_min lat_max]);
78 77 hold on;
79 78  
... ... @@ -84,9 +83,11 @@ h = pcolor(X,Y,int);
84 83 shading('interp');
85 84  
86 85  
87   -% Uncomment one of these lines if you want the coastline to be pltoted.
  86 +% Uncomment one of these lines if you want the coastline to be plotted.
88 87 if show_land
89   - if strcmpi(show_land,'f')
  88 + if strcmpi(show_land,'fjord')
  89 + m_usercoast('fjord_coastlines.mat', 'patch', land_color)
  90 + elseif strcmpi(show_land, 'f')
90 91 m_gshhs_f('patch',land_color)
91 92 else
92 93 m_gshhs_h('patch',land_color)
... ... @@ -117,8 +118,9 @@ end
117 118  
118 119 clear LON LAT X Y
119 120  
120   -m_grid('box','fancy','fontsize',fs);
121   -
  121 +m_grid_old('box','fancy','fontsize',fs);
  122 +%m_gshhs('f','patch', 'gray');
  123 +%print('g_rect_drone_1', '-dpng')
122 124 if nargout > 1
123 125 h_figure = gcf;
124 126 h_pcolor = h;
... ...