Hi, I would like make spectrogram images, I have data in matrix format, where each cell have an power value. when the value is higher the color of the pixel is red, when is lower he take another color.
In the moment my solution was make that using a picturebox control, and taking color pixels from a palet. but in this way take a lot of time (an CPU of course); I would like know if I can use acceleration video from make my spectrogram, and in that case, MOGRE it's the right library for me?, or what it's a good library (free) for make that?
Thanks in advance.
Can't you just use GDI+ if you want to make it in c#.
can you give me an example with GDI+?, how convert matrix of data to colors?; in the moment I generate a image with the scale of color (800 colors), I read the matrix cell by cell, for example, when the value is 800, I get the color pixel in the scale (red for example), and draw a point with that color in my picturebox, this way works, but take a lot of time, for that reason I would like know a better tool that can help me to improve the drawing.
My result is something like this:
draw a point with that color in my picturebox
Do you use the Graphics.Draw* methods?
You can speed up drawing significantly if you manipulate the pixels directly, e.g.:
public static void Draw(int grid, Bitmap bitmap)
var data = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.WriteOnly, bitmap.PixelFormat);
var c = (Colour*)data.Scan0;
int count = grid.Length;
Parallel.For(0, count, x =>
c[x] = Colours[grid[x]];
private static readonly Colour Colours =
new Colour(255, 255, 255),
new Colour(0, 0, 255)
private struct Colour
private readonly byte B;
private readonly byte G;
private readonly byte R;
private readonly byte A;
public Colour(byte r, byte g, byte b)
A = 255;
R = r;
G = g;
B = b;
An alternative is using OpenCL via Cloo