I'm trying to use AForge in Unity and I have trouble converting the input data. I have a 2-dimensional array storing pixel values that I need to convert to UnmanagedImage. I came up with the following code, but I am not sure if its the most efficient way:

```
img = UnmanagedImage.Create(sizx,sizy, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
for (int i =0;i<sizx;i++)
for (int j =0;j<sizy;j++){
int index = i+j*sizx;
img.SetPixel(i,j, new AForge.Imaging.RGB(t[index].r, t[index].g, t[index].b).Color);
}
```

Any help appreciated!

By : jurer