vid2a

width = 39;
height = 15;
load test1;
size(data)
ans =

   480   640     3     5

% do this interactively
% for n=1:5
%     img = data(:,:,:,n);
%     imshow(img);
%     hd = imdistline();
%     pause();
%     api = iptgetapi(hd);
%     w(n) = api.getDistance();
% end
ratio = width./w;
c = polyfit(dist,ratio,1);
s = [0 350];
plot(dist,ratio,'k+',s,polyval(c,s),'LineWidth',2);
xlabel('distance');
ylabel('ratio (actual width/(pixel width)');
% efl = 4.2; % mm
f = 1/c(1);
fprintf('focal length %g pixels\n',f);
focal length 859.276 pixels
t = 320/f; % half-width of image (in pixels) divided by focal length

hfov = atan(t)*180/pi;
fprintf('half horizontal field-of-view %g degrees\n',hfov);
half horizontal field-of-view 20.4257 degrees