1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

clean up c-api

This commit is contained in:
Suleyman TURKMEN
2021-11-20 00:00:57 +03:00
parent 1470f90c2a
commit 4f0fe1de96
22 changed files with 49 additions and 974 deletions
@@ -1078,38 +1078,11 @@ CVAPI(int) cvCheckArr( const CvArr* arr, int flags CV_DEFAULT(0),
#define CV_RAND_UNI 0
#define CV_RAND_NORMAL 1
/** @brief Fills an array with random numbers and updates the RNG state.
The function fills the destination array with uniformly or normally distributed random numbers.
@param rng CvRNG state initialized by cvRNG
@param arr The destination array
@param dist_type Distribution type
> - **CV_RAND_UNI** uniform distribution
> - **CV_RAND_NORMAL** normal or Gaussian distribution
@param param1 The first parameter of the distribution. In the case of a uniform distribution it is
the inclusive lower boundary of the random numbers range. In the case of a normal distribution it
is the mean value of the random numbers.
@param param2 The second parameter of the distribution. In the case of a uniform distribution it
is the exclusive upper boundary of the random numbers range. In the case of a normal distribution
it is the standard deviation of the random numbers.
@sa randu, randn, RNG::fill.
*/
CVAPI(void) cvRandArr( CvRNG* rng, CvArr* arr, int dist_type,
CvScalar param1, CvScalar param2 );
CVAPI(void) cvRandShuffle( CvArr* mat, CvRNG* rng,
double iter_factor CV_DEFAULT(1.));
#define CV_SORT_EVERY_ROW 0
#define CV_SORT_EVERY_COLUMN 1
#define CV_SORT_ASCENDING 0
#define CV_SORT_DESCENDING 16
CVAPI(void) cvSort( const CvArr* src, CvArr* dst CV_DEFAULT(NULL),
CvArr* idxmat CV_DEFAULT(NULL),
int flags CV_DEFAULT(0));
/** Finds all real and complex roots of a polynomial equation */
CVAPI(void) cvSolvePoly(const CvMat* coeffs, CvMat *roots2,
int maxiter CV_DEFAULT(20), int fig CV_DEFAULT(100));
-200
View File
@@ -1272,45 +1272,6 @@ CvSize2D32f cvSize2D32f(const cv::Size_<_Tp>& sz)
}
#endif
/** @sa RotatedRect
*/
typedef struct CvBox2D
{
CvPoint2D32f center; /**< Center of the box. */
CvSize2D32f size; /**< Box width and length. */
float angle; /**< Angle between the horizontal axis */
/**< and the first side (i.e. length) in degrees */
#if defined(CV__ENABLE_C_API_CTORS) && defined(__cplusplus)
CvBox2D(CvPoint2D32f c = CvPoint2D32f(), CvSize2D32f s = CvSize2D32f(), float a = 0) : center(c), size(s), angle(a) {}
CvBox2D(const cv::RotatedRect& rr) : center(rr.center), size(rr.size), angle(rr.angle) {}
#endif
#ifdef __cplusplus
operator cv::RotatedRect() const { return cv::RotatedRect(center, size, angle); }
#endif
}
CvBox2D;
#ifdef __cplusplus
CV_INLINE CvBox2D cvBox2D(CvPoint2D32f c = CvPoint2D32f(), CvSize2D32f s = CvSize2D32f(), float a = 0)
{
CvBox2D self;
self.center = c;
self.size = s;
self.angle = a;
return self;
}
CV_INLINE CvBox2D cvBox2D(const cv::RotatedRect& rr)
{
CvBox2D self;
self.center = cvPoint2D32f(rr.center);
self.size = cvSize2D32f(rr.size);
self.angle = rr.angle;
return self;
}
#endif
/** Line iterator state: */
typedef struct CvLineIterator
@@ -1958,167 +1919,6 @@ CvSeqReader;
(edge)->next[(edge)->vtx[1] == (vertex)])
/****************************************************************************************\
* Data structures for persistence (a.k.a serialization) functionality *
\****************************************************************************************/
#if 0
/** "black box" file storage */
typedef struct CvFileStorage CvFileStorage;
/** Storage flags: */
#define CV_STORAGE_READ 0
#define CV_STORAGE_WRITE 1
#define CV_STORAGE_WRITE_TEXT CV_STORAGE_WRITE
#define CV_STORAGE_WRITE_BINARY CV_STORAGE_WRITE
#define CV_STORAGE_APPEND 2
#define CV_STORAGE_MEMORY 4
#define CV_STORAGE_FORMAT_MASK (7<<3)
#define CV_STORAGE_FORMAT_AUTO 0
#define CV_STORAGE_FORMAT_XML 8
#define CV_STORAGE_FORMAT_YAML 16
#define CV_STORAGE_FORMAT_JSON 24
#define CV_STORAGE_BASE64 64
#define CV_STORAGE_WRITE_BASE64 (CV_STORAGE_BASE64 | CV_STORAGE_WRITE)
/** @brief List of attributes. :
In the current implementation, attributes are used to pass extra parameters when writing user
objects (see cvWrite). XML attributes inside tags are not supported, aside from the object type
specification (type_id attribute).
@see cvAttrList, cvAttrValue
*/
typedef struct CvAttrList
{
const char** attr; /**< NULL-terminated array of (attribute_name,attribute_value) pairs. */
struct CvAttrList* next; /**< Pointer to next chunk of the attributes list. */
}
CvAttrList;
/** initializes CvAttrList structure */
CV_INLINE CvAttrList cvAttrList( const char** attr CV_DEFAULT(NULL),
CvAttrList* next CV_DEFAULT(NULL) )
{
CvAttrList l;
l.attr = attr;
l.next = next;
return l;
}
struct CvTypeInfo;
#define CV_NODE_NONE 0
#define CV_NODE_INT 1
#define CV_NODE_INTEGER CV_NODE_INT
#define CV_NODE_REAL 2
#define CV_NODE_FLOAT CV_NODE_REAL
#define CV_NODE_STR 3
#define CV_NODE_STRING CV_NODE_STR
#define CV_NODE_REF 4 /**< not used */
#define CV_NODE_SEQ 5
#define CV_NODE_MAP 6
#define CV_NODE_TYPE_MASK 7
#define CV_NODE_TYPE(flags) ((flags) & CV_NODE_TYPE_MASK)
/** file node flags */
#define CV_NODE_FLOW 8 /**<Used only for writing structures in YAML format. */
#define CV_NODE_USER 16
#define CV_NODE_EMPTY 32
#define CV_NODE_NAMED 64
#define CV_NODE_IS_INT(flags) (CV_NODE_TYPE(flags) == CV_NODE_INT)
#define CV_NODE_IS_REAL(flags) (CV_NODE_TYPE(flags) == CV_NODE_REAL)
#define CV_NODE_IS_STRING(flags) (CV_NODE_TYPE(flags) == CV_NODE_STRING)
#define CV_NODE_IS_SEQ(flags) (CV_NODE_TYPE(flags) == CV_NODE_SEQ)
#define CV_NODE_IS_MAP(flags) (CV_NODE_TYPE(flags) == CV_NODE_MAP)
#define CV_NODE_IS_COLLECTION(flags) (CV_NODE_TYPE(flags) >= CV_NODE_SEQ)
#define CV_NODE_IS_FLOW(flags) (((flags) & CV_NODE_FLOW) != 0)
#define CV_NODE_IS_EMPTY(flags) (((flags) & CV_NODE_EMPTY) != 0)
#define CV_NODE_IS_USER(flags) (((flags) & CV_NODE_USER) != 0)
#define CV_NODE_HAS_NAME(flags) (((flags) & CV_NODE_NAMED) != 0)
#define CV_NODE_SEQ_SIMPLE 256
#define CV_NODE_SEQ_IS_SIMPLE(seq) (((seq)->flags & CV_NODE_SEQ_SIMPLE) != 0)
typedef struct CvString
{
int len;
char* ptr;
}
CvString;
/** All the keys (names) of elements in the read file storage
are stored in the hash to speed up the lookup operations: */
typedef struct CvStringHashNode
{
unsigned hashval;
CvString str;
struct CvStringHashNode* next;
}
CvStringHashNode;
typedef struct CvGenericHash CvFileNodeHash;
/** Basic element of the file storage - scalar or collection: */
typedef struct CvFileNode
{
int tag;
struct CvTypeInfo* info; /**< type information
(only for user-defined object, for others it is 0) */
union
{
double f; /**< scalar floating-point number */
int i; /**< scalar integer number */
CvString str; /**< text string */
CvSeq* seq; /**< sequence (ordered collection of file nodes) */
CvFileNodeHash* map; /**< map (collection of named file nodes) */
} data;
}
CvFileNode;
#ifdef __cplusplus
extern "C" {
#endif
typedef int (CV_CDECL *CvIsInstanceFunc)( const void* struct_ptr );
typedef void (CV_CDECL *CvReleaseFunc)( void** struct_dblptr );
typedef void* (CV_CDECL *CvReadFunc)( CvFileStorage* storage, CvFileNode* node );
typedef void (CV_CDECL *CvWriteFunc)( CvFileStorage* storage, const char* name,
const void* struct_ptr, CvAttrList attributes );
typedef void* (CV_CDECL *CvCloneFunc)( const void* struct_ptr );
#ifdef __cplusplus
}
#endif
/** @brief Type information
The structure contains information about one of the standard or user-defined types. Instances of the
type may or may not contain a pointer to the corresponding CvTypeInfo structure. In any case, there
is a way to find the type info structure for a given object using the cvTypeOf function.
Alternatively, type info can be found by type name using cvFindType, which is used when an object
is read from file storage. The user can register a new type with cvRegisterType that adds the type
information structure into the beginning of the type list. Thus, it is possible to create
specialized types from generic standard types and override the basic methods.
*/
typedef struct CvTypeInfo
{
int flags; /**< not used */
int header_size; /**< sizeof(CvTypeInfo) */
struct CvTypeInfo* prev; /**< previous registered type in the list */
struct CvTypeInfo* next; /**< next registered type in the list */
const char* type_name; /**< type name, written to file storage */
CvIsInstanceFunc is_instance; /**< checks if the passed object belongs to the type */
CvReleaseFunc release; /**< releases object (memory etc.) */
CvReadFunc read; /**< reads object from file storage */
CvWriteFunc write; /**< writes object to file storage */
CvCloneFunc clone; /**< creates a copy of the object */
}
CvTypeInfo;
#endif
/** @} */
#endif /*OPENCV_CORE_TYPES_H*/