Basic Data Types of opencv

Source: Internet
Author: User

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/D9/wKiom1PsdBHAJjR9AAKEh0wvtkE573.jpg "Title =" clipboard1.png "alt =" wkiom1psdbhajjr9aakeh0wvtke573.jpg "/>

The constructor generally converts the first C to lowercase.

Cvscalar has three constructors: 1. cvscalar, which respectively assigns two values to four values. cvrealscalar: assign a value to the first value, and the remaining three values are 0 3. cvscalarall: assign a value to all parameters.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/D9/wKiom1PsdB7wSJuyAABlp7LixS8849.jpg "Title =" clipboard2.png "alt =" wkiom1psdb7wsjuyaablp7lixs8849.jpg "/>

1. cvarr

Abstract base class

2. cvmat

Typedef struct cvmat
{
Int type;/* cvmat identifier (cv_mat_magic_val), element type and flag */
Int step;/* length of row data in bytes */
Int * refcount;/* data reference count */
Union
{
Uchar * PTR;
Short * s;
Int * I;
Float * FL;
Double * dB;
} Data;/* Data Pointer */
# Ifdef _ cplusplus
Union
{
Int rows;
Int height;
};
Union
{
Int Cols;
Int width;
};
# Else
Int rows;/* number of rows */
Int Cols;/* Number of columns */
# Endif
} Cvmat;

Create cvmat:

1. cvmat * cvcreatemat (INT rows, int cols, int type );

Consists of cvcreatematheader () and cvcreatematdata. The former only creates a cvmat structure and does not allocate memory. The latter only allocates memory.

2. cvclonemat (cvmat *)

Release:

Cvreleasemat (cvmat *)

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/D9/wKiom1PsdC-Bd0bqAAECI_oZ7Ig037.jpg "style =" float: none; "Title =" clipboard3.png "alt =" wKiom1PsdC-Bd0bqAAECI_oZ7Ig037.jpg "/>

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/DA/wKioL1PsdUnz9iJFAAFYmvV8pFY053.jpg "style =" float: none; "Title =" clipboard4.png "alt =" wkiol1psdunz9ijfaafymvv8pfy053.jpg "/>

Program:

# Include "CV. H "# include <stdio. h> int main () {// create an opencv matrix containing some fixed data. // float Vals [] = {0.866025,-0.500000, 0.500000, 0.866025}; cvmat rotmat; cvinitmatheader (& rotmat, 2, 2, cv_32fc1, Vals ); printf ("Ex 3_3 matrix initialized \ n");} iplimagetypedef struct _ iplimage {int nsize;/* iplimage size */int id;/* version (= 0) */INT nchannels;/* Most opencv Functions Support 1, 2, 3, or 4 channels */INT alphachannel;/* ignored by opencv */INT depth;/* bit depth of pixels: optional, optional, ipl_depth_16u, ipl_depth_16s, ipl_depth_32s, supported and ipl_depth_64f support */Char colormodel [4];/* ignored by opencv */Char channelseq [4]; /* same as */INT dataorder;/* 0-Cross-access color channel, 1-separated color channel. cvcreateimage can only create cross-access images */INT origin;/* 0-top-left structure, 1-bottom-left structure (Windows bitmaps style) */INT align; /* arrange image rows (4 or 8 ). opencv ignores it and replaces */INT width with widthstep;/* Number of Image Width bins */INT height;/* Number of Image Height bins */struct _ iplroi * roi; /* areas of interest to the image. when this value is not null, only the region is processed */struct _ iplimage * maskroi;/* null */void * imageid must be set in opencv; /* same as above */struct _ ipltileinfo * tileinfo;/* same as above */INT imagesize; /* image data size (in cross-Access format, imagesize = image-> height * image-> widthstep), in bytes */char * imagedata; /* point to the arranged image data */INT widthstep;/* the size of the row of the arranged image, in bytes */INT bordermode [4];/* Edge End mode, ignored by opencv */INT borderconst [4];/* same as */char * imagedataorigin;/* the pointer points to a different image data structure (not necessarily arranged ), prepared to correct image memory allocation */}

Important members:

1. width and height

2. Depth and nchannals

3. Origin

You can set two values, ipl_origin_tl and ipl_origin_tl, respectively, to set the coordinates of the origin in the upper left corner and lower left corner of the image.

4. widthstep

The number of bytes in the same column of the adjacent row is different from that in width. To ensure high processing efficiency, fixed bytes are used for this reason. Therefore, redundant bytes may exist.

5. imagedata

Contains a pointer pointing to the first line of image data

6. region of interest ROI

The function operates only on the image area in the ROI setting. If the COI in the ROI structure is set to non-zero, the specified channel is operated (provided that the function supports COI)

To set and cancel the ROI, use cvsetimageroi (iplimage * image, cvrect) and cvresetimageroi (iplimage * image) respectively)

7. dataorder

Ipl_data_order_plane: continuous access with the same channel. opencv does not support

Ipl_data_order_pixel: the channels are staggered. Currently, opencv supports


This article is from the "flyclc" blog, please be sure to keep this source http://flyclc.blog.51cto.com/1385758/1540016

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.