September 23rd, 2012, 04:24 AM
Doing Image Processing in C# with Pointers ?
I am writing an image processing application in C# that needs to be speed optimized for faster performance.
I have been told that using Unsafe Code together with Pointers can speed my algorithm up significantly. Unfortunately, I have no experience with Pointers at all.
How can I make the following example code work with Pointers? (The example multiplies a 640 x 480 pixel image's pixel values by 2, and copies those new values into another 640 x 480 image)
double[,] Redmap = new double[640, 480];
double[,] Greenmap = new double[640, 480];
double[,] Bluemap = new double[640, 480];
double[,] Redmap2 = new double[640, 480];
double[,] Greenmap2 = new double[640, 480];
double[,] Bluemap2 = new double[640, 480];
for (int y = 0; y < 480; y++)
for (int x = 0; x < 640; x++)
Redmap2[x, y] = Redmap[x, y] * 2;
Greenmap2[x, y] = Greenmap[x, y] * 2;
Bluemap2[x, y] = Bluemap[x, y] * 2;
Thanks in advance for any help provided!
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!