00001 /*!@file NeovisionII/nv2_label_server.h */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00005 // by the University of Southern California (USC) and the iLab at USC. // 00006 // See http://iLab.usc.edu for information about this project. // 00007 // //////////////////////////////////////////////////////////////////// // 00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00010 // in Visual Environments, and Applications'' by Christof Koch and // 00011 // Laurent Itti, California Institute of Technology, 2001 (patent // 00012 // pending; application number 09/912,225 filed July 23, 2001; see // 00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00014 // //////////////////////////////////////////////////////////////////// // 00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00016 // // 00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00018 // redistribute it and/or modify it under the terms of the GNU General // 00019 // Public License as published by the Free Software Foundation; either // 00020 // version 2 of the License, or (at your option) any later version. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00025 // PURPOSE. See the GNU General Public License for more details. // 00026 // // 00027 // You should have received a copy of the GNU General Public License // 00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00030 // Boston, MA 02111-1307 USA. // 00031 // //////////////////////////////////////////////////////////////////// // 00032 // 00033 // Primary maintainer for this file: Rob Peters <rjpeters at usc dot edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/NeovisionII/nv2_label_server.h $ 00035 // $Id: nv2_label_server.h 8376 2007-05-13 03:37:47Z lior $ 00036 // 00037 00038 #ifndef NEOVISIONII_NV2_LABEL_SERVER_H_DEFINED 00039 #define NEOVISIONII_NV2_LABEL_SERVER_H_DEFINED 00040 00041 struct nv2_label_server; 00042 struct nv2_image_patch; 00043 struct nv2_patch_label; 00044 00045 #ifdef __cplusplus 00046 # define NV2_EXTERN_C extern "C" 00047 #else 00048 # define NV2_EXTERN_C 00049 #endif 00050 00051 /// Create a label server (which will also be a patch reader) 00052 /** @param patch_reader_port tcp port on which the patch reader should 00053 run on this host machine (by default you should use 00054 NV2_PATCH_READER_PORT) 00055 00056 @param remote_label_reader_addr ip address to which we should 00057 connect to find the label reader 00058 00059 @param remote_label_reader_port tcp port on which the label reader 00060 is running on remote_label_reader_addr 00061 */ 00062 NV2_EXTERN_C 00063 struct nv2_label_server* nv2_label_server_create( 00064 const int patch_reader_port, 00065 const char* remote_label_reader_addr, 00066 const int remote_label_reader_port); 00067 00068 /// Destroy a label server and release all resources associated with it 00069 NV2_EXTERN_C 00070 void nv2_label_server_destroy(struct nv2_label_server* p); 00071 00072 /// Result type of nv2_label_server_get_current_patch() 00073 enum nv2_image_patch_result 00074 { 00075 NV2_IMAGE_PATCH_VALID = 10001, ///< patch is a normal, valid patch 00076 NV2_IMAGE_PATCH_NONE, ///< patch is empty, should be ignored 00077 NV2_IMAGE_PATCH_END ///< patch stream has ended, program should quit 00078 }; 00079 00080 /// Get the most recently received patch 00081 /** @param p handle to the label server from which to retrieve the 00082 patch 00083 00084 @param ret the returned image patch; NOTE that ownership of the 00085 nv2_image_patch object is transferred to the caller here, so that 00086 the caller is responsible for freeing resources associated with 00087 this image patch by calling nv2_image_patch_destroy() after use 00088 */ 00089 NV2_EXTERN_C 00090 enum nv2_image_patch_result 00091 nv2_label_server_get_current_patch(struct nv2_label_server* p, 00092 struct nv2_image_patch* ret); 00093 00094 /// Result type of nv2_label_server_send_label() 00095 enum nv2_label_send_result 00096 { 00097 NV2_LABEL_SEND_OK = 12345, ///< label was sent succesfully 00098 NV2_LABEL_SEND_FAIL, ///< label was not sent (maybe server is down?) 00099 }; 00100 00101 /// Send a patch label 00102 /** @param p handle to the label server from which to send the patch 00103 label 00104 00105 @param l patch label to be sent 00106 00107 @return non-zero if the label was sent succesfully, or zero if 00108 there was an error 00109 */ 00110 NV2_EXTERN_C 00111 enum nv2_label_send_result 00112 nv2_label_server_send_label(struct nv2_label_server* p, 00113 const struct nv2_patch_label* l); 00114 00115 /// Set the verbosity level for the label server 00116 /** @param verbosity if 0, then don't print anything except fatal 00117 error messages; if 1, then also print warnings (but not 00118 informational messages) */ 00119 NV2_EXTERN_C 00120 void nv2_label_server_set_verbosity(struct nv2_label_server* p, 00121 const int verbosity); 00122 00123 #undef NV2_EXTERN_C 00124 00125 // ###################################################################### 00126 /* So things look consistent in everyone's emacs... */ 00127 /* Local Variables: */ 00128 /* indent-tabs-mode: nil */ 00129 /* c-file-style: "linux" */ 00130 /* End: */ 00131 00132 #endif // NEOVISIONII_NV2_LABEL_SERVER_H_DEFINED