00001 /* --------------------------------------------------------------------------- 00002 Phission : 00003 Realtime Vision Processing System 00004 00005 Copyright (C) 2003-2005 Philip D.S. Thoren (pthoren@cs.uml.edu) 00006 University of Massachusetts at Lowell, 00007 Laboratory for Artificial Intelligence and Robotics 00008 00009 This file is part of Phission. 00010 00011 Phission is free software; you can redistribute it and/or modify 00012 it under the terms of the GNU Lesser General Public License as published by 00013 the Free Software Foundation; either version 2 of the License, or 00014 (at your option) any later version. 00015 00016 Phission is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 GNU Lesser General Public License for more details. 00020 00021 You should have received a copy of the GNU Lesser General Public License 00022 along with Phission; if not, write to the Free Software 00023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00024 00025 ---------------------------------------------------------------------------*/ 00026 #ifdef HAVE_CONFIG_H 00027 #include <phissionconfig.h> 00028 #endif 00029 00030 #include <phStandard.h> 00031 00032 #include <crop_Filter.h> 00033 00034 #include <phError.h> 00035 #include <phMemory.h> 00036 #include <phPrint.h> 00037 00038 /* ---------------------------------------------------------------------- */ 00039 /* (int outformat) */ 00040 /* ---------------------------------------------------------------------- */ 00041 crop_Filter::crop_Filter(uint32_t x1, 00042 uint32_t y1, 00043 uint32_t x2, 00044 uint32_t y2) : 00045 phFilter("crop_Filter") 00046 00047 { 00048 /* Crop accepts all packed image formats */ 00049 this->m_format = phImagePackedFormatMask; 00050 this->set(x1,y1,x2,y2); 00051 } 00052 00053 /* ---------------------------------------------------------------------- */ 00054 crop_Filter::~crop_Filter() 00055 { 00056 } 00057 00058 /* ------------------------------------------------------------------------ */ 00059 phFilter *crop_Filter::cloneFilter() 00060 { 00061 phFUNCTION("crop_Filter::cloneFilter") 00062 int locked = 0; 00063 crop_Filter *conv = new crop_Filter(); 00064 00065 phTHIS_LOOSE_LOCK(locked); 00066 00067 conv->set(this->m_x1,this->m_y1,this->m_x2,this->m_y2); 00068 00069 phTHIS_LOOSE_UNLOCK(locked); 00070 00071 return (phFilter *)conv; 00072 } 00073 00074 /* ---------------------------------------------------------------------- */ 00075 int crop_Filter::set(uint32_t x1, 00076 uint32_t y1, 00077 uint32_t x2, 00078 uint32_t y2 ) 00079 { 00080 phFUNCTION("crop_Filter::set") 00081 int locked = 0; 00082 00083 phTHIS_LOOSE_LOCK(locked); 00084 00085 this->m_x1 = x1; 00086 this->m_y1 = y1; 00087 this->m_x2 = x2; 00088 this->m_y2 = y2; 00089 00090 phTHIS_LOOSE_UNLOCK(locked); 00091 00092 return phSUCCESS; 00093 } 00094 00095 /* ---------------------------------------------------------------------- */ 00096 int crop_Filter::filter() 00097 { 00098 phFUNCTION("crop_Filter::filter") 00099 00100 /* defined before being called: 00101 * width 00102 * height 00103 * depth 00104 * Image 00105 */ 00106 00107 /* Begin Filter */ 00108 rc = this->m_workspaceImage->crop(this->m_x1, 00109 this->m_y1, 00110 this->m_x2, 00111 this->m_y2); 00112 phPRINT_RC(rc,NULL,"Image->crop(x1,y1,x2,y2) failed."); 00113 00114 /* End Filter */ 00115 00116 return phSUCCESS; 00117 /* 00118 error: 00119 00120 return phFAIL; 00121 */ 00122 } 00123 00124
Copyright (C) 2002 - 2007 |
Philip D.S. Thoren ( pthoren@users.sourceforge.net ) University Of Massachusetts at Lowell Robotics Lab |