Create a C++ function that passes an image and returns the image with a canny edge detection filter
system
ek C ++ fnction banaaen jo ek chhavi paas karata he or ek kaini age ditection filter ke saath chhavi detaa he
user
yahan code he jo OpenCV librari kaa upyog karke ek kaini age ditection karata he:

#include <opencv2/opencv.hpp>

CV :: MAT ApplyCannyedGedEtection (Const CV :: MAT & INPUTIMAGE, dabl threshold 1, dabl threshold 2)
{
    // input chhavi ko grescale main badalen
    cv :: mat greimage;
    cv :: cvtcolor (inputImage, greimage, cv :: color_bgr2gray);
    
    // shor ko kam karne ke liye gaausi dhabba lagaaein
    cv :: Mat Blurredimage;
    cv :: GaussianBlur (gramage, blerredimage, cv :: aakaar (5, 5), 0);
    
    // kaini age ditection lagu karen
    CV :: MAT kinaaron;
    cv :: canny (blurredimage, kinaaron, threshold 1, threshold 2);
    
    // kinaaron ko dahalij karke ek mukhauta banaaen
    CV :: MAT mask;
    cv :: threshold (kinaaron, mukhauta, 128, 255, cv :: thresh_binary);
    
    // keval kinaaron ko dikhaane ke liye input chhavi par mask lagu karen
    CV :: MAT outputimege;
    inputImage.copyto (outputmej, mask);
    
    vaapasi output;
}

mukhya pravesh bindu()
{
    // ek input chhavi lod karen
    cv :: mat inputimage = cv :: imread ("input.jpg");
    
    if (inputImage.empty ()) {
        std :: cerr << "input chhavi ko lod karne main vifal" << std :: endl;
        lauten 1;
    }
    
    // input chhavi par kaini age ditection lagu karen
    dabl threshold 1 = 50.0;
    dabl threshold 2 = 150.0;
    CV :: MAT outputimege = ApplyCannyDedEtection (InputImage, Threshold1, Threshold2);
    
    // input or output chhaviyon ko pradarshit karen
    cv :: imshow ("input chhavi", inputimege);
    cv :: imshow ("kaini age ditection", outputimege);
    cv :: waitkey (0);
    
    ritern 0;
}
assistant
<|system|>
</s>
<|user|>
ek C ++ fnction banaaen jo ek chhavi paas karata he or ek kaini age ditection filter ke saath chhavi detaa he</s>
<|assistant|>
yahan code he jo OpenCV librari kaa upyog karke ek kaini age ditection karata he:

#include <opencv2/opencv.hpp>

CV :: MAT ApplyCannyedGedEtection (Const CV :: MAT & INPUTIMAGE, dabl threshold 1, dabl threshold 2)
{
    // input chhavi ko grescale main badalen
    cv :: mat greimage;
    cv :: cvtcolor (inputImage, greimage, cv :: color_bgr2gray);
    
    // shor ko kam karne ke liye gaausi dhabba lagaaein
    cv :: Mat Blurredimage;
    cv :: GaussianBlur (gramage, blerredimage, cv :: aakaar (5, 5), 0);
    
    // kaini age ditection lagu karen
    CV :: MAT kinaaron;
    cv :: canny (blurredimage, kinaaron, threshold 1, threshold 2);
    
    // kinaaron ko dahalij karke ek mukhauta banaaen
    CV :: MAT mask;
    cv :: threshold (kinaaron, mukhauta, 128, 255, cv :: thresh_binary);
    
    // keval kinaaron ko dikhaane ke liye input chhavi par mask lagu karen
    CV :: MAT outputimege;
    inputImage.copyto (outputmej, mask);
    
    vaapasi output;
}

mukhya pravesh bindu()
{
    // ek input chhavi lod karen
    cv :: mat inputimage = cv :: imread ("input.jpg");
    
    if (inputImage.empty ()) {
        std :: cerr << "input chhavi ko lod karne main vifal" << std :: endl;
        lauten 1;
    }
    
    // input chhavi par kaini age ditection lagu karen
    dabl threshold 1 = 50.0;
    dabl threshold 2 = 150.0;
    CV :: MAT outputimege = ApplyCannyDedEtection (InputImage, Threshold1, Threshold2);
    
    // input or output chhaviyon ko pradarshit karen
    cv :: imshow ("input chhavi", inputimege);
    cv :: imshow ("kaini age ditection", outputimege);
    cv :: waitkey (0);
    
    ritern 0;
}</s>
