after called this function, is there all still 0x00, 0x00 in bmp42 ??
[quote]
@ Dat - Listen, it’s just not good :-([/quote]
No, it should be good and easy, . I am thinking problem is in the convert function BitmapToBMPFile.
Anyway, I can show you how to add the header manually incase that function does not work.
but answer me if all all data in SDcard is 0x00 or not, please
takePicture()
{
Program.camera.SetImageSize(Gadgeteer.Modules.GHIElectronics.SerCam.Camera_Resolution.SIZE_QVGA); // =>> this should be call once time.
Bitmap LCD = new Bitmap(SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight);
Program.camera.StartStreaming();
// if (!Program.camera.isNewImageReady) ==> this should be in while -loop until image is ready
while (!Program.camera.isNewImageReady)
{
Thread.Sleep(100);
}
Program.camera.StopStreaming();
Program.camera.DrawImage(LCD, 0, 0, SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight);
byte[] bmp42 = new byte[320*240*3+54];
Util.BitmapToBMPFile(LCD.GetBitmap(), 320,240, bmp42 );
for (int i = bmp42.Length - 20; i < bmp42.Length; i++)
{
Debug.Print(bmp42[i].ToString());
}
File.WriteAllBytes("\\SD\\CreatedBMPFile.bmp", bmp42);
return bmp42 ;
@ Dat - For some strange reason, windows won’t allow me to copy the new bmp file off the sd card. Why??
U know, once in a while i get all zeros and a black image, but only once in a while.
Will it be helpful if i’ll send you the values?
format BMP is quite simple, just need 54 bytes header and size must be correct, then no matter what data is, even they are 0x00 or whatever.
So, first image that means something wrong in the header.
second image means something wrong with your SD or writing data to SD. Format SD and try again!
@ Dat - Sometimes the array is all zeros and sometimes not, why is that?
I did get a picture on my SD card, and the values are good, but now Matlab has a byte array and i’m not sure what to do with it
[quote]
I did get a picture on my SD card, and the values are good, but now Matlab has a byte array and i’m not sure what to do with it[/quote]
as I know matlab is quite complex, and I am not familiar with Matlab. I just can help you if there is any problem with serCam or jpg / bmp format. Matlab is out of my hand
@ Dat - Ok, and last problem for today, recall the send data function:
Where buf is the bmp42 array.
buf)
{
int offset = 0;
int ret = 0;
int len = buf.Length;
while (len > 0)
{
ret = m_clientSocket.Send(buf, offset, len, SocketFlags.None);
len -= ret;
offset += ret;
}
}
The first 6 values of bmp42 array are:
66
77
54 132
3
0
But on the server side the first 6 values i get are:
66
77
54 -124
3
0
Why is that?
Once you get your data into Matlab, the problem of what to do with it is not a netmf problem. I’m sure you will have better luck on getting assistance if you ask in a more relevant place