Author: gnuhpc
Source: http://www.cnblogs.com/gnuhpc/
/** =================================================== ========================================================== =========** Filename: array1.c ** Description: to show how to set and get a array ** version: 1.0 * created: 01/08/2009 09:17:17 * revision: none * Compiler: GCC ** Author: futuredaemon (BUPT), gnuhpc@gmail.com * company: bupt_united ** ========================================== ========================================================== =========*/# pragma comment (Lib, "cxcore. lib ") # include" CV. H "# include <stdio. h> int main () {cvmat * MAT = cvcreatemat (3, 3, cv_32fc1); cvzero (MAT); // sets the Matrix to 0 // assign the cv_mat_elem (* mat, float, 0, 0) = 1.f; cv_mat_elem (* mat, float, 0, 1) = 2.f; cv_mat_elem (* mat, float, 0, 2) = 3.f; cv_mat_elem (* mat, float, 1, 0) = 4.f; cv_mat_elem (* mat, float, 1, 1) = 5.f; cv_mat_elem (* mat, float, 1, 2) = 6.f; cv_mat_elem (* mat, float, 2, 0) = 7.f; cv_mat_elem (* mat, float, 2, 1) = 8.f; cv_mat_elem (* mat, float, 2, 2) = 9.f; // obtain the float * P = (float *) cvptr2d (MAT, 0, 2) of the matrix element (); printf ("% F/N ", * P); Return 0 ;}
Author: gnuhpc
Source: http://www.cnblogs.com/gnuhpc/