I just made a quick demo (not production quality code) to give you a starting working example on unsafe emgu usage.
Image<Gray, Byte> img = new Image<Gray, byte>(510, 510);
// Fill image with random values
img.SetRandUniform(new MCvScalar(), new MCvScalar(255));
// Show Image
ImageViewer.Show(img);
var data = img.Data;
int stride = img.MIplImage.widthStep;
fixed (byte* pData = data)
{
for (int i = 0; i < 255 * stride; i++)
*(pData + i) = (byte)(i % stride);
}
// Show Image Again
ImageViewer.Show(img);
First I fill image with random noise and then fill some rows with a gradient :-)