closing.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <filters/morphology/closing.h>
00025
00026 #include <filters/morphology/dilation.h>
00027 #include <filters/morphology/erosion.h>
00028
00029 #include <cstddef>
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 FilterClosing::FilterClosing()
00040 : MorphologicalFilter("Morphological Closing")
00041 {
00042 dilate = new FilterDilation();
00043 erode = new FilterErosion();
00044 }
00045
00046
00047
00048 FilterClosing::~FilterClosing()
00049 {
00050 delete dilate;
00051 delete erode;
00052 }
00053
00054
00055
00056 void
00057 FilterClosing::set_src_buffer(unsigned char *buf, ROI *roi,
00058 orientation_t ori, unsigned int buffer_num)
00059 {
00060 Filter::set_src_buffer(buf, roi, ori, buffer_num);
00061 dilate->set_src_buffer( buf, roi, ori, buffer_num );
00062 }
00063
00064
00065 void
00066 FilterClosing::set_src_buffer(unsigned char *buf, ROI *roi, unsigned int buffer_num)
00067 {
00068 Filter::set_src_buffer(buf, roi, buffer_num);
00069 dilate->set_src_buffer( buf, roi, buffer_num );
00070 }
00071
00072
00073 void
00074 FilterClosing::set_dst_buffer(unsigned char *buf, ROI *roi)
00075 {
00076 Filter::set_dst_buffer(buf, roi);
00077 dilate->set_dst_buffer( buf, roi );
00078 erode->set_src_buffer( buf, roi );
00079 }
00080
00081
00082 void
00083 FilterClosing::set_structuring_element(unsigned char *se,
00084 unsigned int se_width, unsigned int se_height,
00085 unsigned int se_anchor_x, unsigned int se_anchor_y)
00086 {
00087 MorphologicalFilter::set_structuring_element(se, se_width, se_height, se_anchor_x, se_anchor_y);
00088 dilate->set_structuring_element(se, se_width, se_height, se_anchor_x, se_anchor_y);
00089 erode->set_structuring_element(se, se_width, se_height, se_anchor_x, se_anchor_y);
00090 }
00091
00092
00093 void
00094 FilterClosing::apply()
00095 {
00096 dilate->apply();
00097 erode->apply();
00098 }