Ask Your Question

Lorenzo_P's profile - activity

2014-06-23 03:31:29 -0600 received badge  Critic (source)
2014-06-23 03:31:19 -0600 received badge  Supporter (source)
2014-06-23 00:50:49 -0600 received badge  Student (source)
2014-06-22 16:25:08 -0600 answered a question Median filter greater than 5.

I 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.

2014-06-20 15:49:26 -0600 received badge  Editor (source)
2014-06-20 15:46:41 -0600 asked a question 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.

Thanks

2014-05-27 11:30:48 -0600 asked a question Efficient way to scan an image with a window

Hi, I need to develop, in an efficient way, a blur filter that considers only the pixels with value different from 0, which are provided by a mask image.

I have developed the following function, but it requires too much time, in case of a large blur kernel size (example: kernel size = 49).

void adaptiveMeanFilter(cv::Mat& source_p, cv::Mat& destination_p, cv::Mat& mask_p, int filterSize_p){

if ((filterSize_p % 2) == 0){

    filterSize_p += 1;
}

float xWeightedMean = 0;
float yWeightedMean = 0;

int count = 0;

cv::Mat temp = cv::Mat::zeros(source_p.rows, source_p.cols, source_p.type());

for (int yIter = (filterSize_p / 2); yIter < source_p.rows - (filterSize_p / 2); yIter++){
    for (int xIter = (filterSize_p / 2); xIter < source_p.cols - (filterSize_p / 2); xIter++){

        xWeightedMean = 0;
        yWeightedMean = 0;
        count = 0;

        for (int yIterFilter = -(filterSize_p / 2); yIterFilter <= (filterSize_p / 2); yIterFilter++){
            for (int xIterFilter = -(filterSize_p / 2); xIterFilter <= (filterSize_p / 2); xIterFilter++){

                if (mask_p.at<uchar>(yIter + yIterFilter, xIter + xIterFilter) != 0){

                    count++;
                    xWeightedMean += source_p.at<cv::Vec2f>(yIter + yIterFilter, xIter + xIterFilter)[0];
                    yWeightedMean += source_p.at<cv::Vec2f>(yIter + yIterFilter, xIter + xIterFilter)[1];
                }
            }
        }

        temp.at<cv::Vec2f>(yIter, xIter)[0] = (xWeightedMean / count);
        temp.at<cv::Vec2f>(yIter, xIter)[1] = (yWeightedMean / count);

    }
}

temp.copyTo(destination_p);

}

Can someone help me?

Thanks