Post a new topicPost a reply Page 1 of 1   [ 6 posts ]
Author Message
 Post subject: Reading in JPEG images from SD and sending
PostPosted: Mon Apr 16, 2012 12:12 pm 

Joined: Tue Nov 29, 2011 1:01 pm
Posts: 32
Hello,

I am currently implementing some code that reads in images from an SD (as a fat_file_struct) and sends this onto the next node.

I was thinking of using ifstream but I was wondering if anyone had tried this and what the best way to implement this would be?

Below is an example of what I have tried, but I am not sure of the best way to read the file and rebuild it at the other end?

Code:
USB.println(SD.ls());
  image = SD.openFile("img.jpg");
  if(image) USB.println("Image read in");
  uint8_t buffer[37];
  img = fat_read_file(image, buffer, sizeof(buffer));


Thanks!
Chris


Top
 Profile  
 
 Post subject: Re: Reading in JPEG images from SD and sending
PostPosted: Tue Apr 17, 2012 9:10 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7506
encima,

We have no experience reading images of SD card using Waspmote.

What kind of images are you trying to read/send? You should take into account RAM limitation of Waspmote...If you read full images your code may stuck.

Regarding the way of a .jpeg image is coded, you can google for more information and some already coded algorithms to manage .jpeg images.

Why do you want to send an image from one mote to another? (just curiosity)

Best Regards.


Top
 OnlineProfile  
 
 Post subject: Re: Reading in JPEG images from SD and sending
PostPosted: Tue Apr 17, 2012 9:21 am 

Joined: Tue Nov 29, 2011 1:01 pm
Posts: 32
Hi,

Thanks for the reply. We have our motes connected to wildlife cameras and we we are using them to form a sensor network, forwarding the images on to a base station.

Each image is around 660kb so I assume that it cannot read the whole image into RAM?

Is the best way to send a header packet to the next mote, holding the information of the image and then split it into 256 byte packets for the other mote to reconstruct when it receives them?

I have looked online but all the recommendations involve the use of an external library, which I believe is not possible with the waspmotes?

Thanks!


Top
 Profile  
 
 Post subject: Re: Reading in JPEG images from SD and sending
PostPosted: Tue Apr 17, 2012 9:58 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7506
encima,

Ok, now we have better idea of what are you trying to do.

We have to say that your application requires big amount of data transfer and it may be a difficult task, due to Waspmote's microcontroller only has 8KBytes of RAM memory, and probably your program will require at least 4 or 5 KBytes to run (you can test free RAM memory with freeMemory() function). That means that you should split image in a big amount of pieces...

Regarding libraries to manage Jpeg images, probably are too big for Waspmote capability. you can try tu use only required Library functions to fit inside Waspmote.

Take into account that what you are trying to do is a bit far of Waspmote purposes, due to the big amount of information managed.

Best regards.


Top
 OnlineProfile  
 
 Post subject: Re: Reading in JPEG images from SD and sending
PostPosted: Tue Apr 17, 2012 10:03 am 

Joined: Tue Nov 29, 2011 1:01 pm
Posts: 32
Thank you!

I did speak with your sales team before ordering and they said it was possible but it would not be easy!

Hmmm, yeah, I think I am going to split the image into packets, freeing them as they are sent and the receiving mote will write each packet to an SD card. Maybe it is better to have the base station rebuild the images?

I will let you know how it goes!

Thanks again!


Top
 Profile  
 
 Post subject: Re: Reading in JPEG images from SD and sending
PostPosted: Tue Apr 17, 2012 1:48 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7506
encima,

We think would be better if you send the packets to your base station and build images there. Doing this you free from this task other motes and you save time and power.

Try to do with motes only necessary task and the rest of all with your base station.

We will be happy to know your progress

Regards.


Top
 OnlineProfile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 6 posts ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use