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

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -