In this tutorial you will learn how to use structured forests for the purpose of edge detection in an image.
16 "{i || input image file name}" 17 "{m || model file name}" 18 "{o || output image file name}" 21 int main(
int argc,
const char** argv )
24 parser.about(
"This sample demonstrates usage of structured forests for fast edge detection");
25 parser.printMessage();
27 if ( !parser.check() )
43 if ( modelFilename.size() == 0)
58 std::cout <<
"createStructuredEdgeDetection() time : " << tm << std::endl;
64 pDollar->detectEdges(image, edges);
67 std::cout <<
"detectEdges() time : " << tm << std::endl;
74 pDollar->computeOrientation(edges, orientation_map);
78 pDollar->edgesNms(edges, orientation_map, edge_nms, 2, 0, 1,
true);
82 std::cout <<
"nms time : " << tm << std::endl;
85 if ( outFilename.size() == 0 )
88 imshow(
"edges nms", edge_nms);
92 imwrite(outFilename, 255*edges);
bool imwrite(const String &filename, InputArray img, const std::vector< int > ¶ms=std::vector< int >())
Saves an image to a specified file.
unknown /unspecified error
Definition: base.hpp:71
Mat imread(const String &filename, int flags=IMREAD_COLOR)
Loads an image from a file.
std::shared_ptr< _Tp > Ptr
Definition: cvstd_wrapper.hpp:23
#define CV_Error(code, msg)
Call the error handler.
Definition: base.hpp:320
void imshow(const String &winname, InputArray mat)
Displays an image in the specified window.
"black box" representation of the file storage associated with a file on disk.
Definition: affine.hpp:51
Designed for command line parsing.
Definition: utility.hpp:817
void reset()
resets internal values.
Definition: utility.hpp:374
If set, always convert image to the 3 channel BGR color image.
Definition: imgcodecs.hpp:72
Ptr< StructuredEdgeDetection > createStructuredEdgeDetection(const String &model, Ptr< const RFFeatureGetter > howToGetFeatures=Ptr< RFFeatureGetter >())
a Class to measure passing time.
Definition: utility.hpp:294
Definition: brightedges.hpp:47
void stop()
stops counting ticks.
Definition: utility.hpp:310
void start()
starts counting ticks.
Definition: utility.hpp:304
std::string String
Definition: cvstd.hpp:150
Template "trait" class for OpenCV primitive data types.
Definition: traits.hpp:112
n-dimensional dense array class
Definition: mat.hpp:810
int waitKey(int delay=0)
Waits for a pressed key.