c++ - Best way to display 2D vectors with CImg -
What is the best way to display 2D matrix using CIMG? I am trying the following code but it is giving me a split error:
float matrix [100] [100]; Int i; Int j; (I = 0; i & lt; 100; i ++) {for (j = 0; j & lt; 100; j ++) {matrix [i] [j] = 10.0 * sin (float) j / (2.0 * 3.1416); }} CIMG & lt; Float & gt; Img (100,100,1,1); Img._data = & amp; Matrix [0] [0]; Img.display ("test"); What am I doing?
What you did is probably not a good idea: Destructor ~ CImg & lt; T & gt; Your CImg & lt; T & gt; By attempting to duplicate the buffer from the example, and as you have compelled its value, matrix , you will be in big trouble. I suggest using shared pictures instead, it's efficient (no extra memory copy) and is safe to use: CImg
Comments
Post a Comment