Fixed Algorithm usage example #1904
This commit is contained in:
parent
8f3273bf07
commit
0ba3236ce0
@ -2324,6 +2324,7 @@ The class provides the following features for all derived classes:
|
|||||||
Here is example of SIFT use in your application via Algorithm interface: ::
|
Here is example of SIFT use in your application via Algorithm interface: ::
|
||||||
|
|
||||||
#include "opencv2/opencv.hpp"
|
#include "opencv2/opencv.hpp"
|
||||||
|
#include "opencv2/nonfree/nonfree.hpp"
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
@ -2334,22 +2335,22 @@ Here is example of SIFT use in your application via Algorithm interface: ::
|
|||||||
FileStorage fs("sift_params.xml", FileStorage::READ);
|
FileStorage fs("sift_params.xml", FileStorage::READ);
|
||||||
if( fs.isOpened() ) // if we have file with parameters, read them
|
if( fs.isOpened() ) // if we have file with parameters, read them
|
||||||
{
|
{
|
||||||
sift.read(fs["sift_params"]);
|
sift->read(fs["sift_params"]);
|
||||||
fs.release();
|
fs.release();
|
||||||
}
|
}
|
||||||
else // else modify the parameters and store them; user can later edit the file to use different parameters
|
else // else modify the parameters and store them; user can later edit the file to use different parameters
|
||||||
{
|
{
|
||||||
sift.set("contrastThreshold", 0.01f); // lower the contrast threshold, compared to the default value
|
sift->set("contrastThreshold", 0.01f); // lower the contrast threshold, compared to the default value
|
||||||
|
|
||||||
{
|
{
|
||||||
WriteStructContext ws(fs, "sift_params", CV_NODE_MAP);
|
WriteStructContext ws(fs, "sift_params", CV_NODE_MAP);
|
||||||
sift.write(fs);
|
sift->write(fs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Mat image = imread("myimage.png", 0), descriptors;
|
Mat image = imread("myimage.png", 0), descriptors;
|
||||||
vector<KeyPoint> keypoints;
|
vector<KeyPoint> keypoints;
|
||||||
sift(image, noArray(), keypoints, descriptors);
|
(*sift)(image, noArray(), keypoints, descriptors);
|
||||||
|
|
||||||
|
|
||||||
Algorithm::get
|
Algorithm::get
|
||||||
|
Loading…
x
Reference in New Issue
Block a user