mirror of
https://github.com/ruby-opencv/ruby-opencv
synced 2023-03-27 23:22:12 -04:00
add Cv::Mat#median_blur
This commit is contained in:
parent
54ab023195
commit
02d8cf8f32
4 changed files with 52 additions and 0 deletions
|
@ -241,5 +241,29 @@ namespace rubyopencv {
|
|||
|
||||
return mat2obj(dstptr, CLASS_OF(self));
|
||||
}
|
||||
|
||||
/*
|
||||
* Blurs an image using the median filter.
|
||||
*
|
||||
* @overload median_blur(ksize)
|
||||
* @param ksize [Integer] Aperture linear size; it must be odd and greater than 1,
|
||||
* for example: 3, 5, 7 ...
|
||||
* @return [Mat] Output array
|
||||
* @opencv_func cv::medianBlur
|
||||
*/
|
||||
VALUE rb_median_blur(VALUE self, VALUE ksize) {
|
||||
cv::Mat* selfptr = obj2mat(self);
|
||||
cv::Mat* dstptr = NULL;
|
||||
try {
|
||||
dstptr = new cv::Mat();
|
||||
cv::medianBlur(*selfptr, *dstptr, NUM2INT(ksize));
|
||||
}
|
||||
catch (cv::Exception& e) {
|
||||
delete dstptr;
|
||||
Error::raise(e);
|
||||
}
|
||||
|
||||
return mat2obj(dstptr, CLASS_OF(self));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue