[Opencv] basic data types, channels, and dimensions of Image Processing

Source: Internet
Author: User
Since I was unable to read books, I was able to find a video sync with the book.

Http://www.opencvchina.com/thread-103-1-1.html

This video is very good ~ Let's talk about what we learned today ~

Basic data types used in opencv:

Cvpoint: The point cvpoint2d32f in the image: The point cvpoint3d32f in two-dimensional space: the point of three-dimensional space in the image

Their constructor cvpoint is an inline function, which only writes C in lower case ~

Ncvsize: Image Size
Cvsize2d32f: If you want to use floating-point cvrect to represent part of the image

Cvscalar contains four floating point Members, which can be used to represent B, G, R, Alpha constructor: cvscalar cvrealscalar cvscalarall the first is normal, the second is to set a single channel, and the other is 0; third, set all to a number.

Iplimage can be considered as derived from cvmat. Cvarr can be considered as an abstract class. Although it is C, it can be understood in this way. In order to increase the flexibility of the program, channel and dimension
float data[18] = {30,60,40,60,50,40,67,88,55,33,22,97,59,69,32,46,25,45,};CvMat mat;cvInitMatHeader(&mat,3,3,CV_32FC2,data);//double have3*3 elements//cvInitMatHeader(&mat,3,6,CV_32FC1,data);//single islefor(int y = 0;y<mat.rows;y++){for(int x = 0;x<mat.cols ;x++){//float value = cvGetReal2D(&mat,y,x);//single//printf("%f   ",value);CvScalar value = cvGet2D(&mat,y,x);//doubleprintf("(%f %f)",value.val[0],value.val[1]);//double every point have two values}printf("\n");}
Cvinitmatheader (& mat, cv_32fc1, data); // In the single Isle statement above, a single channel matrix of three rows and six columns is created, and the result is six values in each row, it indicates the color of each coordinate, but it is a single channel, so there is only one value at this point ~ Cvinitmatheader (& mat, 3, 3, cv_32fc2, data); // double have3 * 3 elements this is a dual channel, we can see that it is different from a single channel Shenma ~ This is a two-dimensional matrix of two channels. The number of elements or pixels is 3*3, and each element coordinate point has two values ~ The running result is as follows: To sum up the channel and dimension: 1. A channel is the number of data entries describing each element. A dimension is the data storage method and is independent of a channel. m-dimensional data of each n-channel can be divided into M-dimensional data of n single channels to simplify operations ~ This is my understanding ~ I would also like to thank the opencvchina website for its video ~

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.