I am a newbie to mono C# programming in raspbian os (pi3 b). I have taken a sample code for fingerprint scanner application in C# mono from this github link, Now I am running the same application in Raspbian os under the pi3 b board.
Now after scanning the user finger image, I want to display into my winform PictureBox.
once the application scans each finger then it will send the byte[] to the UI using the below callback method.
private void FingerPrintlib_OnEnrollImageResult(byte[] enrollImage, int count)
{
//lblinstruction.Invoke((MethodInvoker)delegate
//{
// lblinstruction.Visible = false;
//});
if (count == 0)
{
pictureBox4.Invoke((MethodInvoker)delegate
{
//pictureBox4.Image = byteArrayToImage(enrollImage);
pictureBox4.SizeMode = PictureBoxSizeMode.StretchImage;
});
}
else
{
pictureBox5.Invoke((MethodInvoker)delegate
{
//pictureBox5.Image = byteArrayToImage(enrollImage);
pictureBox5.SizeMode = PictureBoxSizeMode.StretchImage;
});
}
}
I am a newbie to mono C# programming in raspbian os (pi3 b). I have written a fingerprint scanner application in C# and using mono, I am running the same application in Raspbian os under the pi3 board.
Now after scanning the user finger image, I want to display into my PictureBox.
once the lib scans each finger then it will send the byte[] to the UI using the below callback method.
private void FingerPrintlib_OnEnrollImageResult(byte[] enrollImage, int count)
{
//lblinstruction.Invoke((MethodInvoker)delegate
//{
// lblinstruction.Visible = false;
//});
if (count == 0)
{
pictureBox4.Invoke((MethodInvoker)delegate
{
//pictureBox4.Image = byteArrayToImage(enrollImage);
pictureBox4.SizeMode = PictureBoxSizeMode.StretchImage;
});
}
else
{
pictureBox5.Invoke((MethodInvoker)delegate
{
//pictureBox5.Image = byteArrayToImage(enrollImage);
pictureBox5.SizeMode = PictureBoxSizeMode.StretchImage;
});
}
}
Image byteArrayToImage(byte[] byteArrayIn)
{
try { MemoryStream ms = new MemoryStream(byteArrayIn);
Image returnImage = Image.FromStream(ms);
return returnImage;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return null;
}
when I execute the above code I am getting an exception like
A null reference or invalid value was found [GDI+ status: InvalidParameter]
so how can I solve this issue and display the image file into my application?
Thanks