function [membership,means,rms] = kmeansML(k,data,varargin)
% [membership,means,rms] = kmeansML(k,data,.)
% Multi-level kmeans.
% Tries very hard to always return k clusters.
% k Number of clusters
% data dxn matrix of data points
function [oninds] = selectRegion(im, positions)
% takes as input the image to show, as well as the positions where
% it has SIFT descriptors extracted.
% Displays the image, then lets a user select a polygonal region.
% Then it determines which of the giv
% This script is to illustrate a couple of the provided functions,
% and to demonstrate loading a data file.
framesdir = '/usr/local/189data/frames/';
siftdir = '/usr/local/189data/sift/';
% Get a list of all the .mat files in
function [patch] = getPatchFromSIFTParameters(position, scale, orient, im)
% position is 2d vector, scale and orient are scalars;
% im is the image from which the patch will be grabbed.
% returns in 'patch' the rotated patch from the original image,
function n2 = dist2(x, c)
%DIST2 Calculates squared distance between two sets of points.
% D = DIST2(X, C) takes two matrices of vectors and calculates the
% squared Euclidean distance between them. Both matrices must be of
% the same colu
function displaySIFTPatches(positions, scales, orients, im)
% position is n x 2, scale and orient are n x 1 vectors.
% im is the original image in which the patches were detected.
% This function shows the image with the patches outlined on top of it.
function z = distSqr(x,y)
% function z = distSqr(x,y)
% Return matrix of all-pairs squared distances between the vectors
% in the columns of x and y.
% x dxn matrix of vectors
% y dxm matrix of vectors
% z nxm matrix of squa