Photo Quadrat Selection Tool
08 Jun 2012
19 Jun 2012)
An interactive tool for manually selecting photo quadrats from a collection of images.
%%place quadratSelection_AllImages.m in the
%%current directory containing images, and run this program. It allows the
%%user to interactively select and save one quadrat per image. The saved
%%quadrats are stored in a generated subfolder called 'savedQuadrats'. See
%%quadratSelection_OneImage.m for the interactive quadrat selection of one
%%image. This program is simply a top-level that loops through the images
%%to call the individual selection function.
%%quadratSelection_OneImage and quadratSelection_AllImages
%%should both be in the same folder. The two arguments are defaulted, read
W&L, Image Group
Citation is currency. Please see README. Please cite:
Joshua Stough, Matlab quadrat selection tool, 2012.
Joshua Stough, Lisa Greer, William Benson: Texture and Color Distribution-based
Classification for Live Coral Detection. Proceedings of the 12th International
Coral Reef Symposium, Cairns, Australia, 9-13 July 2012
function  = quadratSelection_AllImages(extension, quadratSize)
%The quadrat image can be scaled to any size through the imtransform
%(see quadratSelection_OneImage), and presumeably you don't want to
if nargin < 2, quadratSize = 2048; end
%Only certain image types are imread-able, right? But most good
%cameras offer non-lossy output too, right? Anyway, what files to
%perform the quadrat selection on...
if nargin < 1, extension = '*.jpg'; end
%Make results directory if it doesn't already exist.
if ~exist('savedQuadrats', 'dir')
%Make meta directory if it doesn't already exist.
if ~exist('savedQuadratMetaData', 'dir')
%Get all files in the current directory that fit the extension
imFiles = dir(extension);
for i = 1:length(imFiles)
fprintf('Beginning quadrat selection for image %s...\n', imFiles(i).name);
%New to matlab GUIs, this is how I revert control back to this
%process. I instantiate a hidden figure that
%quadratSelection_OneImage knows to close when the user completes
%interaction with the one image.
h = figure('Visible', 'off');
quadratSelection_OneImage(imFiles(i).name, h, quadratSize);
%Blocks execution, of this process, until the handle h is
fprintf('Done with image %s.\n\n', imFiles(i).name);