Loading...
Searching...
No Matches
Structured forests for fast edge detection
Introduction
In this tutorial you will learn how to use structured forests for the purpose of edge detection in an image.
Examples
- Note
- binarization techniques like Canny edge detector are applicable to edges produced by both algorithms (Sobel and StructuredEdgeDetection::detectEdges).
Source Code
CV_EXPORTS_W bool imwrite(const String &filename, InputArray img, const std::vector< int > ¶ms=std::vector< int >())
Saves an image to a specified file.
Definition: ximgproc.hpp:125
"black box" representation of the file storage associated with a file on disk.
Definition: core.hpp:106
Explanation
Load source color image
Convert source image to float [0;1] range
image.convertTo(image, DataType<float>::type, 1/255.0);void convertTo(OutputArray m, int rtype, double alpha=1, double beta=0) constConverts an array to another data type with optional scaling.Run main algorithm
Ptr<StructuredEdgeDetection> pDollar =createStructuredEdgeDetection(modelFilename);Mat edges;pDollar->detectEdges(image, edges);Show results
if ( outFilename.size() == 0 ){imshow("edges", edges);imshow("edges nms", edge_nms);waitKey(0);}elseimwrite(outFilename, 255*edges);
Literature
For more information, refer to the following papers : [Dollar2013] [Lim2013]