2017-06-23 3 views
0

OpenCVのGaussianBlur-functionがどこに実装されているかを知りたいと思っていました。 ソースコードを見て、私はこのfileしか見つけられませんでしたが、私は畳み込みが行われたコードを探しています。このような 例えば何か:OpenCVのGaussianBlur -Functionはどのように動作するのですか?

for x to picture.rows 
    for y to picture.cols 
     for r to mask.width 
     for c to mask.cols 
      do convolution 

は、OpenCVのGaussianBlurはそれをスピードアップするためにあらゆる第2の画素のように、すべてのピクセルまたは何かのためのコンボリューションを計算していますか?

+0

実装はSOのために、トピックではないかもしれないコンピュータビジョンの分野、より特定の詳細が含まれています。 –

答えて

-1

以下は、ガウスフィルタが実装されているリンクの数です。私はあなたに役立つことを願っています。

サンプルコード -

int main(int argc, char** argv) 
{ 
    //create 2 empty windows 
    namedWindow("Original Image" , CV_WINDOW_AUTOSIZE); 
    namedWindow("Smoothed Image" , CV_WINDOW_AUTOSIZE); 

    // Load an image from file 
    Mat src = imread("MyPic.JPG", CV_LOAD_IMAGE_UNCHANGED); 

    //show the loaded image 
    imshow("Original Image", src); 

    Mat dst; 
    char zBuffer[35]; 

    for (int i = 1; i < 31; i = i + 2) 
    { 
     //copy the text to the "zBuffer" 
     _snprintf_s(zBuffer, 35,"Kernel Size : %d x %d", i, i); 

     //smooth the image using Gaussian kernel in the "src" and save it to "dst" 
     GaussianBlur(src, dst, Size(i, i), 0, 0); 

     //put the text in the "zBuffer" to the "dst" image 
     putText(dst, zBuffer, Point(src.cols/4, src.rows/8), CV_FONT_HERSHEY_COMPLEX, 1, Scalar(255, 255, 255), 2); 

     //show the blurred image with the text 
     imshow("Smoothed Image", dst); 

     //wait for 2 seconds 
     int c = waitKey(2000); 

     //if the "esc" key is pressed during the wait, return 
     if (c == 27) 
     { 
      return 0; 
     } 
    } 

    //make the "dst" image, black 
    dst = Mat::zeros(src.size(), src.type()); 

    //copy the text to the "zBuffer" 
    _snprintf_s(zBuffer, 35,"Press Any Key to Exit"); 

    //put the text in the "zBuffer" to the "dst" image 
    putText(dst, zBuffer, Point(src.cols/4, src.rows/2), CV_FONT_HERSHEY_COMPLEX, 1, Scalar(255, 255, 255)); 

    //show the black image with the text 
    imshow("Smoothed Image", dst); 

    //wait for a key press infinitely 
    waitKey(0); 

    return 0; 
} 

Links-

Link 1

Link2

+0

リンクが質問に答えるかもしれませんが、関連する内容を回答にコピーすることを検討してください。 –

+0

は、サンプルコードを –

+0

として追加しました。これはガウスフィルタの実装ではありません...それはそれを使用するコードの一部です。 – Miki

関連する問題