/usr/share/doc/octave-vlfeat/examples/apps/recognition/readImage.m is in octave-vlfeat 0.9.17+dfsg0-6build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | function [im, scale] = readImage(imagePath)
% READIMAGE Read and standardize image
% [IM, SCALE] = READIMAGE(IMAGEPATH) reads the specified image file,
% converts the result to SINGLE class, and rescales the image
% to have a maximum height of 480 pixels, returing the corresponding
% scaling factor SCALE.
%
% READIMAGE(IM) where IM is already an image applies only the
% standardization to it.
% Author: Andrea Vedaldi
% Copyright (C) 2013 Andrea Vedaldi
% All rights reserved.
%
% This file is part of the VLFeat library and is made available under
% the terms of the BSD license (see the COPYING file).
if ischar(imagePath)
try
im = imread(imagePath) ;
catch
error('Corrupted image %s', imagePath) ;
end
else
im = imagePath ;
end
im = im2single(im) ;
scale = 1 ;
if (size(im,1) > 480)
scale = 480 / size(im,1) ;
im = imresize(im, scale) ;
im = min(max(im,0),1) ;
end
|