@Namespace(value="cv") public static class opencv_core.Algorithm extends Pointer
especially for classes of algorithms, for which there can be multiple implementations. The examples are stereo correspondence (for which there are algorithms like block matching, semi-global block matching, graph-cut etc.), background subtraction (which can be done using mixture-of-gaussians models, codebook-based algorithm etc.), optical flow (block matching, Lucas-Kanade, Horn-Schunck etc.).
Here is example of SIFT use in your application via Algorithm interface:
#include "opencv2/opencv.hpp"
#include "opencv2/xfeatures2d.hpp"
using namespace cv::xfeatures2d;
Ptr<Feature2D> sift = SIFT::create();
FileStorage fs("sift_params.xml", FileStorage::READ);
if( fs.isOpened() ) // if we have file with parameters, read them
{
sift->read(fs["sift_params"]);
fs.release();
}
else // else modify the parameters and store them; user can later edit the file to use different parameters
{
sift->setContrastThreshold(0.01f); // lower the contrast threshold, compared to the default value
{
WriteStructContext ws(fs, "sift_params", CV_NODE_MAP);
sift->write(fs);
}
}
Mat image = imread("myimage.png", 0), descriptors;
vector<KeyPoint> keypoints;
sift->detectAndCompute(image, noArray(), keypoints, descriptors);
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator| Constructor and Description |
|---|
opencv_core.Algorithm() |
opencv_core.Algorithm(long size)
Native array allocator.
|
opencv_core.Algorithm(Pointer p)
Pointer cast constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
\brief Clears the algorithm state
|
boolean |
empty()
\brief Returns true if the Algorithm is empty (e.g.
|
BytePointer |
getDefaultName()
Returns the algorithm string identifier.
|
opencv_core.Algorithm |
position(long position) |
void |
read(opencv_core.FileNode fn)
\brief Reads algorithm parameters from a file storage
|
void |
save(BytePointer filename)
Saves the algorithm to a file.
|
void |
save(String filename) |
void |
write(opencv_core.FileStorage fs)
\brief Stores algorithm parameters in a file storage
|
address, asBuffer, asByteBuffer, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, hashCode, isNull, limit, limit, maxBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, position, put, setNull, sizeof, toString, totalBytes, withDeallocator, zeropublic opencv_core.Algorithm(Pointer p)
Pointer.Pointer(Pointer).public opencv_core.Algorithm(long size)
Pointer.position(long).public opencv_core.Algorithm()
public opencv_core.Algorithm position(long position)
public void clear()
public void write(@ByRef opencv_core.FileStorage fs)
public void read(@Const@ByRef opencv_core.FileNode fn)
@Cast(value="bool") public boolean empty()
public void save(@opencv_core.Str BytePointer filename)
public void save(@opencv_core.Str String filename)
@opencv_core.Str public BytePointer getDefaultName()
Copyright © 2016. All rights reserved.