Fawkes API Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * sharpen.cpp - Implementation of the sharpen filter 00004 * 00005 * Created: Thu Jun 16 16:13:15 2005 00006 * Copyright 2005-2007 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program 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 Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #include <filters/sharpen.h> 00025 00026 #include <core/exception.h> 00027 00028 #include <ippi.h> 00029 00030 namespace firevision { 00031 #if 0 /* just to make Emacs auto-indent happy */ 00032 } 00033 #endif 00034 00035 /** @class FilterSharpen <filters/sharpen.h> 00036 * Sharpen filter. 00037 * @author Tim Niemueller 00038 */ 00039 00040 /** Constructor. */ 00041 FilterSharpen::FilterSharpen() 00042 : Filter("FilterSharpen") 00043 { 00044 } 00045 00046 00047 void 00048 FilterSharpen::apply() 00049 { 00050 IppiSize size; 00051 size.width = src_roi[0]->width; 00052 size.height = src_roi[0]->height; 00053 00054 IppStatus status; 00055 00056 // base + number of bytes to line y + pixel bytes 00057 status = ippiFilterSharpen_8u_C1R( src[0] + (src_roi[0]->start.y * src_roi[0]->line_step) + (src_roi[0]->start.x * src_roi[0]->pixel_step), src_roi[0]->line_step, 00058 dst + (dst_roi->start.y * dst_roi->line_step) + (dst_roi->start.x * dst_roi->pixel_step), dst_roi->line_step, 00059 size ); 00060 00061 if ( status != ippStsNoErr ) { 00062 throw fawkes::Exception("Sharpen filter failed with %i\n", status); 00063 } 00064 00065 } 00066 00067 } // end namespace firevision