You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: icorner.m
    path of file: ./repos/machinevision-toolbox-matlab
    
    the code of the file until where you have to start completion: %ICORNER Corner detector
%
% F = ICORNER(IM, OPTIONS) is a vector of PointFeature objects describing
% corner features detected in the image IM.  This is a non-scale space detector 
% and by default the Harris method is used but Shi-Tomasi and Noble are also
% supported.
%
% If IM is an image sequence a cell array of PointFeature vectors for the 
% correspnding frames of IM.
%
% The PointFeature object has many properties including:
%  u            horizontal coordinate
%  v            vertical coordinate
%  strength     corner strength
%  descriptor   corner descriptor (vector)
%
% See PointFeature for full details
%
% Options::
% 'detector',D      choose the detector where D is one of 'harris' (default),
%                   'noble' or 'klt'
% 'sigma',S         kernel width for smoothing (default 2)
% 'deriv',D         kernel for gradient (default kdgauss(2))
% 'cmin',CM         minimum corner strength
% 'cminthresh',CT   minimum corner strength as a fraction of maximum corner 
%                   strength
% 'edgegap',E       don't return features closer than E pixels to the edge of 
%                   image (default 2)
% 'suppress',R      don't return a feature closer than R pixels to an earlier 
%                   feature (default 0)
% 'nfeat',N         return the N strongest corners (default Inf)
% 'k',K             set the value of k for the Harris detector
% 'patch',P         use a PxP patch of surrounding pixel values as the 
%                   feature vector.  The vector has zero mean and unit norm.
% 'color'           specify that IM is a color image not a sequence
%
% Example::
%
% Compute the 100 strongest Harris features for the image
%         c = icorner(im, 'nfeat', 100);
% and overlay them on the image
%         idisp(im);
%         c.plot();
%
% Notes::
% - Corners are processed in order from strongest to weakest.
% - The function stops when:
%     - the corner strength drops below cmin, or
%     - the corner strength drops below cMinThresh x strongest corner, or
%     - the list of corners is exhausted
% - Features are returned in
    
function stops when:
%     - the corner strength drops below cmin, or
%     - the corner strength drops below cMinThresh x strongest corner, or
%     - the list of corners is exhausted
% - Features are returned in descending strength order
% - If IM has more than 2 dimensions it is either a color image or a sequence
% - If IM is NxMxP it is taken as an image sequence and F is a cell array whose
%   elements are feature vectors for the corresponding image in the sequence.
% - If IM is NxMx3 it is taken as a sequence unless the option 'color' is given
% - If IM is NxMx3xP it is taken as a sequence of color images and F is a cell
%   array whose elements are feature vectors for the corresponding color image 
%   in the sequence.
% - The default descriptor is a vector [Ix* Iy* Ixy*] which are the unique
%   elements of the structure tensor, where * denotes squared and smoothed.
% - The descriptor is a vector of float types to save space
%
% References::
% - "A combined corner and edge detector", 
%   C.G. Harris and M.J. Stephens,
%   Proc. Fourth Alvey Vision Conf., Manchester, pp 147-151, 1988.
% - "Finding corners", 
%   J.Noble, 
%   Image and Vision Computing, vol.6, pp.121-128, May 1988.
% - "Good features to track",
%   J. Shi and C. Tomasi, 
%   Proc. Computer Vision and Pattern Recognition, pp. 593-593,
%   IEEE Computer Society, 1994.
%  - Robotics, Vision & Control, Section 13.3,
%    P. Corke, Springer 2011.
%
% See also PointFeature, ISURF.



% Copyright (C) 1993-2011, by Peter I. Corke
%
% This file is part of The Machine Vision Toolbox for Matlab (MVTB).
% 
% MVTB is free software: you can redistribute it and/or modify
% it under the terms of the GNU Lesser General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
% 
% MVTB is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU Lesser General Public License for more details.
% 
% You should have received a copy of the GNU Leser General Public License
% along with MVTB.  If not, see <http://www.gnu.org/licenses/>.


function [features, corner_strength] = icorner(im, varargin)

    % TODO, can handle image sequence, return 3D array of corner_strength if requested 
    % and cell array of corner vectors
    % handle tiling

    % parse options into parameter struct
    opt.k = 0.04;
    opt.deriv = kdgauss(2);

    opt.cmin = 0;
    opt.cminthresh = 0.0;
    opt.edgegap = 2;
    opt.nfeat = Inf;
    opt.sigma = 2;
    opt.patch = 0;
    opt.detector = {'harris', 'noble', 'st'};
    opt.color = false;

    opt.suppress = 0;
    opt.nfeat = 100;

    [opt,arglist] = tb_optparse(opt, varargin);

    if opt.patch > 0
        opt.edgegap = opt.patch;
    end