수색…


통사론

  1. 가우시안 블러 구문 C ++ : void GaussianBlur (InputArray src, OutputArray dst, Size ksize, double sigmaX, double sigmaY = 0, int borderType = BORDER_DEFAULT)

매개 변수

가우시안 블러의 매개 변수 세부
src 이미지를 입력 할 때, 이미지는 독립적으로 처리되는 채널 수를 가질 수 있지만, 깊이는 CV_8U , CV_16U , CV_16S , CV_32F 또는 CV_64F 합니다.
DST src 와 같은 크기와 형태의 출력 이미지
크기 가우스 커널 크기. ksize.widthksize.height 는 다를 수 있지만 둘 다 양수 여야합니다. 또는 0이 될 수 있고 시그마에서 계산됩니다.
sigmaX 가우스 커널 표준 편차 ( X 방향) .
sigmaY Y 방향의 가우시안 커널 표준 편차. sigmaY 가 0이면 sigmaY 같게 설정되고 sigmaX 가 0이면 ksize.widthksize.height 에서 계산됩니다. 이 모든 의미의 향후 수정 가능성에 관계없이 결과를 완전히 제어하려면 ksize , sigmaXsigmaY 모두 지정하는 것이 좋습니다.
borderType 픽셀 외삽 법.

비고

주제가 너무 넓어서 많은 다른 예제를 포함해야하기 때문에 가우스 블러에 특정한 구문과 매개 변수를 넣는 것이 이치에 맞지 않는다고 생각합니다.

C ++에서 가우시안 블러로 이미지 스무딩하기

흐림 이라고도하는 스무딩은 이미지 처리에서 가장 일반적으로 사용되는 작업 중 하나입니다.

평활화 작업의 가장 일반적인 사용은 추가 처리를 위해 이미지의 노이즈줄이는 것 입니다.

평활화 작업을 수행하는 알고리즘이 많이 있습니다.

OpenCV 라이브러리 함수 GaussianBlur() 사용하여 가우시안 필터 를 이미지 흐림에 가장 일반적으로 사용되는 필터 중 하나를 살펴 보겠습니다. 이 필터는 이미지에서 고주파 노이즈 를 제거하기 위해 특별히 설계되었습니다.

#include <opencv2/opencv.hpp>
#include <iostream>

using namespace std;
using namespace cv;

int main(int argc, char** argv){

    Mat image , blurredImage;

    // Load the image file
    image = imread(argv[1], CV_LOAD_IMAGE_COLOR);

    // Report error if image could not be loaded
    if(!image.data){
        cout<<"Error loading image" << "\n";
        return -1;
    }

    // Apply the Gaussian Blur filter. 
    // The Size object determines the size of the filter (the "range" of the blur)
    GaussianBlur( image, blurredImage, Size( 9, 9 ), 1.0);

    // Show the blurred image in a named window
    imshow("Blurred Image" , blurredImage);

    // Wait indefinitely untill the user presses a key
    waitKey(0);

    return 0;
}

상세한 수학적 정의 및 기타 유형의 필터는 원본 문서를 확인할 수 있습니다.

임계 값

파이썬에서 :

문턱 전에

import cv2
image_path= 'd:/contour.png'
img = cv2.imread(image_path)

#display image before thresholding
cv2.imshow('I am an image display window',img)
cv2.waitKey(0)

#convert image to gray scale - needed for thresholding
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)


#apply threshold to gray image to obtain binary image

threshold=150 #value above which pixel values will be set to max_value
max_value=255  #value to which pixels above threshold will be set
threshold_stype=cv2.THRESH_BINARY #default threshold method

ret, img_binary = cv2.threshold(img_gray, threshold, max_value, threshold_stype)

#display image after thresholding
cv2.imshow('image after applying threshold',img_binary)
cv2.waitKey(0)

#save the binary image
cv2.imwrite('d:/binary.png',img_binary)
cv2.destroyAllWindows()

문턱 후

양자 간 필터링

이미지 처리 애플리케이션에서, 양측 필터는 특별한 유형의 비선형 필터 입니다.

노이즈를 제거하는 가장 보편적 인 방법은 이미지의 구조를 인식하지 못하는 가우시안 블러 링 (Gaussian blurring)이기 때문에 구조를 잃어 버리는 것과 노이즈 제거 사이에 트레이드 오프가 있습니다. 따라서 가장자리를 제거합니다. 대부분의 시간에는 씬에 대한 중요한 정보가 포함되어 있으므로 훼손하고 싶지는 않습니다. 양측 필터 는 장면의 구조를 알고 있으며 가장자리가없는 영역에있을 때 고전적인 흐림 필터처럼 작동하는 경향이 있습니다. 그러나 가장자리를 볼 때 행동이 바뀝니다. 그래야 블러 링이 가장자리에서 작동하지 않지만 에지를 따라 작동하므로 가장자리를 유지하는 필터 라는 의미입니다.

#include <opencv2/opencv.hpp>
#include <iostream>

void main(int argc, char* argv[]) {
    if(argc==1) {
        std::cout << argv[0] << " <image>" << endl;
        return;
    }

    cv::Mat image, output;
    image = cv::imread(argv[1]);
    if(image.empty()) {
        std::cout << "Unable to load the image: " << argv[1] << endl;
        return;
    }

    cv::bilateralFilter(image, output, 3, 5, 3);
}


Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow