Canny edge detection
Iplimage * cvloadimage (const char * filename, int flags = cv_load_image_color );
The first parameter is the file name of the image to be loaded.
The second parameter specifies the color and depth of the image to be read,
You can convert the input image into a channel (cv_load_image_color), a single channel (cv_load_image_grayscale), or a constant (cv_load_image_anycolor ).
Void cvkan (const cvarr * image, cvarr * edges, double threshold1, double threshold2, int aperture_size = 3 );
The first parameter is image single-channel input image.
The second parameter edges stores the output image of the edge in a single channel
The third and fourth parameters are thresholds.
The last parameter is the size of the Sobel operator kernel.
# Include "stdafx. H "# include" CV. H "# include" cxcore. H "# include" highgui. H "# include <opencv. HPP> # include <iostream> using namespace STD; using namespace CV; int edge_thresh; iplimage * sourceimage, * destimage; const char * filename = "yayade.jpg "; // original image name void callback (INT); // progress bar callback function int main () {// load the image sourceimage to be processed = cvloadimage (filename, cv_load_image_anydepth | cv_load_image_anycolor ); // generate a target of the same size as the input image Image destimage = cvcreateimage (cvgetsize (sourceimage), ipl_depth_8u, 1); If (! Sourceimage) {cout <"error" <Endl; Return-1;} cvnamedwindow ("image window", cv_window_autosize); edge_thresh = 1; // only used to adjust the threshold. cvcreatetrackbar ("threshold", "image window", & edge_thresh, 100, callback); callback (0); CV: waitkey (0 ); cvreleaseimage (& sourceimage); cvreleaseimage (& destimage); cvdestroywindow ("image window"); Return 0;} void callback (INT thresh) {cvcanny (sourceimage, destimage, (float) thresh, (float) 3 * Thresh, 3); cvshowimage ("image window", destimage );}
Processing results
The first run is successful, and the second run is in this situation, but the generated EXE file can still run. I don't know what the situation is. I hope you can give me some guidance ..
Reference learning opencv