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 namespace firevision {
00032 #if 0
00033 }
00034 #endif
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 FilterClosing::FilterClosing()
00045 : MorphologicalFilter("Morphological Closing")
00046 {
00047 dilate = new FilterDilation();
00048 erode = new FilterErosion();
00049 }
00050
00051
00052
00053 FilterClosing::~FilterClosing()
00054 {
00055 delete dilate;
00056 delete erode;
00057 }
00058
00059
00060
00061 void
00062 FilterClosing::set_src_buffer(unsigned char *buf, ROI *roi,
00063 orientation_t ori, unsigned int buffer_num)
00064 {
00065 Filter::set_src_buffer(buf, roi, ori, buffer_num);
00066 dilate->set_src_buffer( buf, roi, ori, buffer_num );
00067 }
00068
00069
00070 void
00071 FilterClosing::set_src_buffer(unsigned char *buf, ROI *roi, unsigned int buffer_num)
00072 {
00073 Filter::set_src_buffer(buf, roi, buffer_num);
00074 dilate->set_src_buffer( buf, roi, buffer_num );
00075 }
00076
00077
00078 void
00079 FilterClosing::set_dst_buffer(unsigned char *buf, ROI *roi)
00080 {
00081 Filter::set_dst_buffer(buf, roi);
00082 dilate->set_dst_buffer( buf, roi );
00083 erode->set_src_buffer( buf, roi );
00084 }
00085
00086
00087 void
00088 FilterClosing::set_structuring_element(unsigned char *se,
00089 unsigned int se_width, unsigned int se_height,
00090 unsigned int se_anchor_x, unsigned int se_anchor_y)
00091 {
00092 MorphologicalFilter::set_structuring_element(se, se_width, se_height, se_anchor_x, se_anchor_y);
00093 dilate->set_structuring_element(se, se_width, se_height, se_anchor_x, se_anchor_y);
00094 erode->set_structuring_element(se, se_width, se_height, se_anchor_x, se_anchor_y);
00095 }
00096
00097
00098 void
00099 FilterClosing::apply()
00100 {
00101 dilate->apply();
00102 erode->apply();
00103 }
00104
00105 }