EasyCV  0.9.36
Easy! Computer Vision
Classes | Typedefs | Enumerations | Functions | Variables
cvac Namespace Reference

Classes

class  Corpus
 
class  CorpusCallback
 
class  CorpusService
 
struct  Purpose
 
class  PurposedList
 
class  PurposedLabelableSeq
 
struct  DirectoryPath
 
class  PurposedDirectory
 
struct  RunSet
 
struct  FilePath
 
struct  Substrate
 
struct  Semantics
 
struct  Label
 
class  Labelable
 
struct  Size
 
class  Location
 
class  Point2D
 
class  BBox
 
class  PreciseLocation
 
class  PreciseBBox
 
class  PreciseCircle
 
class  Silhouette
 
class  LabeledFullSubstrate
 
class  LabeledLocation
 
struct  VideoSeekTime
 
struct  FrameLocation
 
class  LabeledVideoSegment
 
class  LabeledTrack
 
struct  Result
 
struct  ResultSet
 
struct  FileProperties
 
exception  FileServiceException
 
class  FileService
 
class  CallbackHandler
 
class  DetectorCallbackHandler
 
class  TrainerCallbackHandler
 
class  CVAlgorithmService
 
struct  DetectorProperties
 
struct  TrainerProperties
 
class  Detector
 
class  DetectorTrainer
 
class  ConfusionMatrix
 
class  DetectorDataArchive
 
class  MediaConverter
 
class  MediaConverter_openCV_i2i
 
class  MediaConverter_openCV_v2i
 
class  OutputResults
 
struct  RectangleLabels
 
struct  RunSetConstraint
 
class  RunSetIterator
 
class  RunSetWrapper
 
class  ClientSandbox
 
class  SandboxManager
 
class  ServiceManager
 
class  StartStop
 
class  ServiceManagerI
 

Typedefs

typedef bool(* GetImageSizeFunction )(std::string filename, int &width, int &height)
 
typedef ResultSet(* DoDetectFunc )(DetectorPtr detector, const char *filename)
 
typedef pair< string,
MediaConverter * > 
rsMediaPair
 
typedef string rsMediaType
 
typedef std::set< std::string > StringSet
 

Enumerations

enum  PurposeType {
  UNPURPOSED, POSITIVE, NEGATIVE, MULTICLASS,
  ANY
}
 
enum  Interpolation { DISCRETE, LINEAR, POLYNOMIAL }
 

Functions

VLoggergetVLogger ()
 
void localAndClientMsg (VLogger::Levels level, const CallbackHandlerPrx &callbackHandler, const char *fmt,...)
 
bool directoryExists (const std::string &directory)
 
bool fileExists (const std::string &abspath)
 
std::string getFileDirectory (const std::string &fileName)
 
std::string getCurrentWorkingDirectory ()
 
bool makeDirectories (const std::string &path)
 
bool makeDirectory (const std::string &path)
 
std::string getFileName (const std::string &fileName)
 
std::string getBaseFileName (const std::string &fileName)
 
std::string getFileExtension (const std::string &path)
 
bool deleteDirectory (const std::string &path)
 
std::string getPurposeName (const cvac::Purpose &purpose)
 
bool compatiblePurpose (const cvac::Purpose &actual, const cvac::Purpose &constraint)
 
void addFileToRunSet (cvac::RunSet &runSet, const std::string &relativePath, const std::string &filename, const cvac::Purpose &purpose)
 
void addFileToRunSet (cvac::RunSet &runSet, const std::string &relativePath, const std::string &filename, int classID)
 
bool makeSymlinkFile (const std::string linkFullPath, const std::string tgtFile)
 
std::string getTempFilename (const std::string &basedir="", const std::string &prefix="")
 
std::string getDateFilename (const std::string &basedir="", const std::string &prefix="")
 
std::string getFSPath (const cvac::FilePath &fp, const std::string &CVAC_DataDir="")
 
bool copyFile (const std::string &fromFile, const std::string &toFile)
 
bool pathAbsolute (const std::string &path)
 
int processLabelArtifactsToRects (cvac::RunSetWrapper &wrapper, cvac::RunSetConstraint &constraint, std::string cvacDataDir, cvac::ServiceManager *serviceMan, const CallbackHandlerPrx &callback, GetImageSizeFunction sfunc, int skipFrames, std::vector< RectangleLabels > *result, bool square)
 
int processLabelArtifactsToRects (LabelableList *artifacts, GetImageSizeFunction sfunc, std::vector< RectangleLabels > *result, bool square, std::string cvacDataDir)
 
void cleanupRectangleLabels (std::vector< RectangleLabels > *rects)
 
void processRunSet (DetectorPtr detector, const DetectorCallbackHandlerPrx &client, DoDetectFunc detectFunc, const RunSet &run, const std::string &pathPrefix, ServiceManager *servMan)
 
void sendResultsToClient (const DetectorCallbackHandlerPrx &client, const ResultSet &results)
 
bool containsIllegalChars (FilePath filePath)
 
void addToRunSet (RunSet &runSet, const std::string &relativePath, const std::string &filename, const Purpose &purpose, LocationPtr loc=NULL)
 
void addToRunSet (RunSet &runSet, const std::string &relativePath, const std::string &filename, int classID, LocationPtr loc=NULL)
 
void addFilenamePair (const std::string &filename, const std::string &symLinkName)
 
std::string getSymlinkSubstitution (const std::string &illegalFileName)
 
std::string getLegalPath (std::string tempDir, FilePath filePath, bool &newSymlink)
 
std::string fixupRunSet (RunSet &runset, const std::string &CVAC_DataDir)
 
std::string getClientConnectionName (const Ice::Current &cur)
 
string getLowercase (const string &_str)
 
ResultSet detect (const std::string &algorithm, const cvac::RunSet &runset, const cvac::FilePath &model, const cvac::DetectorProperties *props)
 
std::string getCVACDataDir (const std::string &algorithm)
 
StringSet startServices ()
 
void sleep (int numberOfMilliseconds)
 

Variables

sequence< LabelableLabelableList
 
sequence< string > StringList
 
sequence< PurposedListPurposedListSequence
 
dictionary< string, string > LabelProperties
 
const bool CVACFALSE = false
 
sequence< Point2DPoint2DList
 
sequence< FrameLocationFrameLocationList
 
sequence< ResultResultList
 
sequence< byte > ByteSeq
 
const int MINUSONE = -1
 
dictionary< string, string > Properties
 

Detailed Description

File handling and remote sychronization for CVAC. A remote site that provides CVAC services should run a FileService if it is expected to process media that is not already stored at the remote site, and/or if the clients are permitted to obtain the actual files on which processing was performed. The clients need to be configured to know about the FileServer location (host, port) next to the CVAC service. Utility functions exist that implement the client functionality.

A custom FileService is necessary as IcePatch2 does not meet our needs. To explain the differences: FileService can send and receive files, bidirectionally. FileService provides some security and privacy to shield multiple clients from each other. With FileService, clients can obtain media-related metadata without downloading the entire image or video. FileService can create and transfer a thumbnail image. Two IcePatch2 instances, one for each direction, could be used as the transport mechanism underneath FileService.

The OutputResults class sends results to the client based upon how the client has specified it wants to recieve these results.

Utilities to read in a LabelableList and return a vetector of file names and rectangles.

Utilities to read in a RunSet and then make callbacks to a user supplied routine to process each file of the RunSet.

Utilities to invoke a CVAC service.

Functions to manage a CVAC service. Programs that take a long time to complete need to periodically call stopRequested to see if the user has canceled the operation. If they have then the processing should stop and stopCompleted should be called. The service names should be the service names defined in config.services.

This is the public interface to the ServiceManager, which hides the Ice aspects. Ice aspects are introduced in the subclass which implements this interface, specified in ServiceManI.h.

Typedef Documentation

typedef ResultSet(* cvac::DoDetectFunc)(DetectorPtr detector, const char *filename)

This function is called from processRunSet() as the RunSet is traversed. It will be called for each file that needs to have the detector run on it. The detector is responsible for returning a filled out ResultSet (whether or not it found anything). Here it is assumed that the detector pointer really points to a DetectorI (a detector instance).

typedef bool(* cvac::GetImageSizeFunction)(std::string filename, int &width, int &height)

A function to call to get the width and height in pixels of an image. Return true and the size if the image could be opened, else return false.

typedef pair<string,MediaConverter*> cvac::rsMediaPair
typedef string cvac::rsMediaType
typedef std::set<std::string> cvac::StringSet

Enumeration Type Documentation

A Track: A sequence of Locations in a Video - note that all Locations have the same label. The annotations can be interpreted as DISCRETE annotations on the keyframes, as linearly interpolated in frames between the specified keyframes; or polynomially interpolated. Interpolation only makes sense for some types of Locations.

Enumerator
DISCRETE 
LINEAR 
POLYNOMIAL 
Enumerator
UNPURPOSED 
POSITIVE 
NEGATIVE 
MULTICLASS 
ANY 

Function Documentation

void cvac::addFilenamePair ( const std::string &  filename,
const std::string &  symLinkName 
)
void cvac::addFileToRunSet ( cvac::RunSet runSet,
const std::string &  relativePath,
const std::string &  filename,
const cvac::Purpose purpose 
)

Add a file path to a RunSet reference, under the given purpopse.

Parameters
runSet,:The target runset
relativePath,:The media file path to be added, relative to working dir
filename,:The media file name to be added
purposeThe purpose describing intent and content of the media file
void cvac::addFileToRunSet ( cvac::RunSet runSet,
const std::string &  relativePath,
const std::string &  filename,
int  classID 
)

Add a file path to a RunSet reference, under the given purpopse.

Parameters
runSet,:The target runset
relativePath,:The media file path to be added, relative to working dir
filename,:The media file name to be added
classID,:Identifying class for media file
void cvac::addToRunSet ( RunSet runSet,
const std::string &  relativePath,
const std::string &  filename,
const Purpose purpose,
LocationPtr  loc = NULL 
)
void cvac::addToRunSet ( RunSet runSet,
const std::string &  relativePath,
const std::string &  filename,
int  classID,
LocationPtr  loc = NULL 
)
void cvac::cleanupRectangleLabels ( std::vector< RectangleLabels > *  rects)

Cleanup the memory allocated inside the RectangleLabels but not the RectangleLabels itself

Delete all the BBoxPtrs

bool cvac::compatiblePurpose ( const cvac::Purpose actual,
const cvac::Purpose constraint 
)

Ensure 'actual' purpose is compatible with the constraint

bool cvac::containsIllegalChars ( FilePath  filePath)
bool cvac::copyFile ( const std::string &  fromFile,
const std::string &  toFile 
)

Copy a file

Parameters
fromFilesource file
toFiledestination file
Returns
true if file was copied
bool cvac::deleteDirectory ( const std::string &  path)

Remove the contents of the directory and delete the directory.

Returns
True if successfull
Parameters
pathof the directory to remove
ResultSet cvac::detect ( const std::string &  algorithm,
const cvac::RunSet runset,
const cvac::FilePath model,
const cvac::DetectorProperties detprops 
)

A convenience function that creates the callback, collects results, and makes them available in the return argument. If you don't want to configure the detector beyond the default then pass NULL in props.

A convenience function that creates the callback, collects results, and makes them available in the return argument.

bool cvac::directoryExists ( const std::string &  directory)

Does the supplied directory exist?

Parameters
directoryThe path to the directory to verify
Returns
True if the directory exists, false if not (or if something exists but is not a directory.
bool cvac::fileExists ( const std::string &  abspath)

Does the supplied file exists? Must be specified as absolute path. This implementation may not be able to handle the file which is larger than 2GB.

Parameters
abspath(directory + filename) to verify
Returns
True if the file exists, false if not but is not a directory.
std::string cvac::fixupRunSet ( RunSet run,
const std::string &  CVAC_DataDir 
)

Fix the Run Set by linking files with illegal names (containing spaces) to valid file names. These links are stored in the directory name returned and should be deleted after the run set is finished being processed.

Fixes the RunSet files so they don't contain spaces. Returns the directory of symbolic links created. This will need to be deleted after the run set is used.

std::string cvac::getBaseFileName ( const std::string &  fileName)

Get the base of a file name without the path or extension. This contains all the characters of the file name up to the first '.' character.

getBaseFileName("/temp/myfile.tar.gz") //returns "myfile"
Returns
The base part of the supplied fileName
Parameters
fileNameThe full file name, with or without path
std::string cvac::getClientConnectionName ( const Ice::Current &  cur)

Return the remote address name of the client given this current.

std::string cvac::getCurrentWorkingDirectory ( )

Return the working directory that exists at the time of this function call

Returns
The current working directory
string cvac::getCVACDataDir ( const std::string &  algorithm)

Get The value of the CVAC_DataDir from the config file

std::string cvac::getDateFilename ( const std::string &  basedir = "",
const std::string &  prefix = "" 
)

Return a filename formated by the date and time. If basedir is not defined then the file name is a relative filename

Parameters
basedir- Base directory of the dated filename.
prefix- Prefix the file name with prefix_.
Returns
The dated file name including path.
std::string cvac::getFileDirectory ( const std::string &  fileName)

Extract just the path to the supplied fully-qualified file name.

getFileDirectory("c:/temp/foo/myFile.txt"); //returns "c:/temp/foo"
Parameters
fileNamethe full path and file name
Returns
The extracted path to the supplied fileName
std::string cvac::getFileExtension ( const std::string &  path)

Get the file extension, excluding the path and the filename.

getFileExtension("/temp/myfile.tar.gz") //returns "tar.gz"
Parameters
path(directory + filename)
Returns
Just the extension
std::string cvac::getFileName ( const std::string &  fileName)

Get the file name, excluding the path.

getFileName("/temp/myfile.tar.gz") //returns "myfile.tar.gz"
Parameters
fileNameThe file name with path to extract just the file name from
Returns
Just the file name
std::string cvac::getFSPath ( const cvac::FilePath fp,
const std::string &  CVAC_DataDir = "" 
)

Turn a CVAC path info a file system path

Parameters
fpThe filepath to change
CVAC_DataDirThe CVAC data directory
Returns
a string that concatinates CVAC_Dir and the relative path and filename defined in fp.

Turn a CVAC path into a file system path

std::string cvac::getLegalPath ( std::string  putLinksDir,
FilePath  filePath,
bool &  newSymlink 
)

Return path of a new symlink if fname contains illegal chars, or original path otherwise. The map between old and new names is managed directly by clients outside this function.

Return path of a new symlink if fname contains illegal chars, or original path otherwise. The map between old and new names is managed directly by clients outside this function. If links need to be created, they'll be put into putLinksDir, which will be created on demand.

string cvac::getLowercase ( const string &  _str)
string cvac::getPurposeName ( const cvac::Purpose purpose)

Produce a string identifier for the given Purpose.

Returns
a string to identify the purpose or an int to identify a multiclass class ID.

Returns a string to identify the purpose or an int to identify a multiclass class ID.

std::string cvac::getSymlinkSubstitution ( const std::string &  illegalFileName)

replace space with underscore in illegalFileName and return result

std::string cvac::getTempFilename ( const std::string &  basedir = "",
const std::string &  prefix = "" 
)

Return a unique temporary file name. If basedir is not defined then the file name is in the current systems temporary file .

Parameters
basedir- Base directory of the temp filename.
prefix- Prefix the file name with this.
Returns
The temp file name including path.
VLogger & cvac::getVLogger ( )

Get The cvac logger

void cvac::localAndClientMsg ( VLogger::Levels  level,
const CallbackHandlerPrx &  callbackHandler,
const char *  fmt,
  ... 
)

Echo message both locally ('printv'), and by sending a client message only if there is adequate verbosity level.

Parameters
levelVerbosity level inherent to the message.
callbackHandlerA reference to the Ice client callbackHandler object.
fmtFormat string and arguments akin to printf
bool cvac::makeDirectories ( const std::string &  path)

Make each directory based on the supplied path as required.

Parameters
pathThe directory tree to create.
Returns
True if the command was successful, false otherwise
bool cvac::makeDirectory ( const std::string &  path)

Make a directory based on the supplied path. This will only create one level of directory (i.e., it won't create every directory in the path).

Parameters
pathThe directory to create (assumes the path's parent exists)
Returns
True if the command was successful, false otherwise
bool cvac::makeSymlinkFile ( const std::string  linkFullPath,
const std::string  tgtFile 
)

Create a symlink given the parameters using the appropriate Windows or Linux API command.

Parameters
linkFullPath,:Path to the link file which will be created.
tgtFile
bool cvac::pathAbsolute ( const std::string &  path)

Returns true if the path is absolute

Parameters
paththe file path or directory path in question
Returns
true if the input path is absolute, false if relative
int cvac::processLabelArtifactsToRects ( cvac::RunSetWrapper wrapper,
cvac::RunSetConstraint constraint,
std::string  cvacDataDir,
cvac::ServiceManager serviceMan,
const CallbackHandlerPrx &  callback,
GetImageSizeFunction  sfunc,
int  skipFrames,
std::vector< RectangleLabels > *  result,
bool  square 
)

Return the filenames and rectangles listed in artifacts. If no artifacts listed then have a single rectangle of the size of the image file.

int cvac::processLabelArtifactsToRects ( LabelableList *  artifacts,
GetImageSizeFunction  sfunc,
std::vector< RectangleLabels > *  result,
bool  square,
std::string  cvacDataDir 
)

Process a LabelableList and fill the result data with the information. If the LabelableList has no data but the sfunc is not null then there will be a single rectangle that is the size of the image.

Parameters
artifacts- the image list containing images and ploygons.
sfunc- The function to call to get the size of the image when LabelableList has no size data. This can be null.
result- vector of rectangles returned by the function.
square- If the function should return rectangles that are square. Default is false.
cvacDataDir- CVAC data folder root
Returns
the number of added rectangles in the result vector.

Return the filenames and rectangles listed in artifacts. If no artifacts listed then have a single rectangle of the size of the image file.

void cvac::processRunSet ( DetectorPtr  detector,
const DetectorCallbackHandlerPrx &  client,
DoDetectFunc  detectFunc,
const RunSet run,
const std::string &  pathPrefix,
ServiceManager servMan 
)

Process a RunSet calling the passed in DoDetectFunc for each file in to be processed and then calling the DetectorCallbacHandler with that result.

void cvac::sendResultsToClient ( const DetectorCallbackHandlerPrx &  client,
const ResultSet &  results 
)
void cvac::sleep ( int  numberOfMilliseconds)
StringSet cvac::startServices ( )

Start the services as per config file; this won't re-start the services if they are already running. Still, avoid calling this multiple times because it will access the file system several times. It returns the names of running services.

Variable Documentation

sequence< byte > cvac::ByteSeq

This is a placeholder for the algorithm-internal data that turns a generic "object" detection algorithm into a detector for, say, faces, or cars, etc.; We also use it to transfer files.

const bool cvac::CVACFALSE = false

A label. A Labelable image artifact can have a single name, such as "pedestrian" or it can have a series of name-value pair LabelProperties. The Semantics refer to a URL that specifies the meaning of the name strings.

sequence<FrameLocation> cvac::FrameLocationList
sequence<Labelable> cvac::LabelableList
dictionary<string, string> cvac::LabelProperties

LabelProperties are name-value pairs that can specify such aspects of Labelable image artifacts as their orientation towards the camera "face_orientation = frontal" or simply a collection of properties such as "hairy" "purrs" "has_claws" etc.

const int cvac::MINUSONE = -1

This is required to fix a defect with slice2c++ not initializing floats correctly (bad type cast).

sequence<Point2D> cvac::Point2DList
dictionary<string, string> cvac::Properties
sequence<PurposedList> cvac::PurposedListSequence
sequence<Result> cvac::ResultList

One result for each Labelable in the RunSet, albeit, they might be reported bit by bit.

sequence<string> cvac::StringList