Re: How to convert a 2D matrix into a 2D map intensity graph (color one)
Thanks very much for the reply. Do I need to store x,y information. Because it's just a x,y are correspoding to the i and j of a[i][j] repsectively. And there is no negative values inside my matrix. the minimum value is 0, which I 'd like to corresponding to dark.
The inserted picture is ploted by the matlab. So that's basically what I want.
I am sure there will be a simple way to do this in C++. It is just I am not expert of VC.
Originally Posted by TheGreatCthulhu
Basically, you just need to figure out how to encode those values into the image. You don't have to store x/y information, because it's implicit (the location of the pixel). Depending on the pixel format, there's gonna be a certain limited amount of memory per pixel available; for example, if you use 32 bpp, you can use it all to store an integer or a float. However, if you want to visually encode this info (that is, to create a map that you can look at), then you have to adhere to the pixel format. If you use, say, 32bppArgb, each of the 4 bytes is reserved for a specific channel (B, G, R, A). Depending on what you need to do, you can use each channel separately, to store different information (normal maps used by things like games use the RGB channels to store the three XYZ coordinates of a vector), or you can create a grayscale image (where RGB components all have the same value - but this then limits you to only 256 different values, and introduces redundancy; a different pixel format might be better suited).
The values themselves can be encoded in various ways, depending on your needs. If you have to use less memory than the amount used by the values in the actual matrix, then you have to sacrifice some precision, or quantize; further, if you also might need to think about how to encode negative values.
If u answer my question, I will surely give reputation to you untill i have no reputation! But i will try to get more reputation, and give it to you lately!
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.