OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Sat, 12 Mar 2016 15:00:25 -0600Median filter greater than 5.http://answers.opencv.org/question/35431/median-filter-greater-than-5/Hi,
how can I efficiently implement a median filter with kernel size greater than 5. In my case I use float data.
In partucular, I need a median filter with kernel size equal to 39.
ThanksFri, 20 Jun 2014 15:46:41 -0500http://answers.opencv.org/question/35431/median-filter-greater-than-5/Answer by vaaksiainen for <p>Hi,</p>
<p>how can I efficiently implement a median filter with kernel size greater than 5. In my case I use float data.
In partucular, I need a median filter with kernel size equal to 39.</p>
<p>Thanks</p>
http://answers.opencv.org/question/35431/median-filter-greater-than-5/?answer=35516#post-id-35516Linear complexity median filter (such as OpenCV's 8-bit single and multichannel versions) is based on a moving histogram implementation. Naturally for floating point, there is none or it would be close to infinite sized histogram. Simplest workaround would be discretization - say - to 8-bit :) if that suits you. Or then increasing the number of bins in a custom way.
You can follow one of these guidelines or just implement O(N^3) version yourself. The last N comes from the search using `std::nth_element` in a neighborhood of N^2.
Mon, 23 Jun 2014 01:51:15 -0500http://answers.opencv.org/question/35431/median-filter-greater-than-5/?answer=35516#post-id-35516Answer by gdarmon for <p>Hi,</p>
<p>how can I efficiently implement a median filter with kernel size greater than 5. In my case I use float data.
In partucular, I need a median filter with kernel size equal to 39.</p>
<p>Thanks</p>
http://answers.opencv.org/question/35431/median-filter-greater-than-5/?answer=90014#post-id-90014I haven;t tried it, but have a look here, it is the same algorithm as openCV's however it is extended to 16 bits per pixel,
https://github.com/aoles/EBImage/blob/master/src/medianFilter.cSat, 12 Mar 2016 15:00:25 -0600http://answers.opencv.org/question/35431/median-filter-greater-than-5/?answer=90014#post-id-90014Answer by GilLevi for <p>Hi,</p>
<p>how can I efficiently implement a median filter with kernel size greater than 5. In my case I use float data.
In partucular, I need a median filter with kernel size equal to 39.</p>
<p>Thanks</p>
http://answers.opencv.org/question/35431/median-filter-greater-than-5/?answer=35433#post-id-35433Here:
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace std;
using namespace cv;
int main( int argc, char** argv )
{
Mat src = imread( "salt.tif", 1 );
Mat dst;
//Apply median filter
medianBlur ( src, dst, 39 );
imshow("source", src);
imshow("result", dst);
waitKey(0);
return 0;
}
I must give credit to this blog post:
http://opencvexamples.blogspot.com/2013/10/applying-median-filter.html#.U6SgVvmSxqU
Also see to documentation:
http://docs.opencv.org/modules/imgproc/doc/filtering.html?highlight=medianblur#medianblur
GilFri, 20 Jun 2014 16:00:08 -0500http://answers.opencv.org/question/35431/median-filter-greater-than-5/?answer=35433#post-id-35433Answer by Lorenzo_P for <p>Hi,</p>
<p>how can I efficiently implement a median filter with kernel size greater than 5. In my case I use float data.
In partucular, I need a median filter with kernel size equal to 39.</p>
<p>Thanks</p>
http://answers.opencv.org/question/35431/median-filter-greater-than-5/?answer=35500#post-id-35500I can use a median filter graeter than 5 for CV_8U depth image, but not for a CV_32F image.
I need to filter an CV_32F image using a median filter with kernel size equal or greater than 40.Sun, 22 Jun 2014 16:25:08 -0500http://answers.opencv.org/question/35431/median-filter-greater-than-5/?answer=35500#post-id-35500