Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

VC0706 Adafruit camera and Netduino Plus 1

VC0706 Netduino Plus 1 Base64

  • Please log in to reply
4 replies to this topic

#1 Barbez95

Barbez95

    New Member

  • Members
  • Pip
  • 6 posts

Posted 10 June 2014 - 04:10 PM

Good morning,

I use the Netduino helpers VC0706.cs class, I modify the function "TakePicture" which doesn't need anymore a path to save the image on the Netduino Plus but it sends bytes via TCP/IP.  

I retrieve bytes from the camera buffer, but I can't convert them into a base64 string because a few of them are equal to '!' and '*' characters which aren't supported by the base64 standard, so I can't rebuild the base64 string as an image with a memory stream... Any ideas?

Thanks for your help!



#2 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 10 June 2014 - 05:43 PM

How exactly are you converting the source string? Base64 is not simple substitution, it converts three octets (bytes) into four 6-bit encoded characters, using some bit manipulation.

#3 Barbez95

Barbez95

    New Member

  • Members
  • Pip
  • 6 posts

Posted 11 June 2014 - 06:43 AM

Yes, we get a byte array (length 120) from the camera buffer and we convert it into a base64 string format via the static method "ToBase64String" in Convert class. The issue is that in the final string we get characters that are not valid for a base64 string. The conversion is correctly handled i think...My doubt is about the buffer: being a jpeg stream, once frozen, could it contain bytes with a value > of 63? And, if it isn't possible, maybe i've got a dirty read? Could it be solved by the use of a shielded wire on TX pin?



#4 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 11 June 2014 - 07:54 AM

Ok, thanks for the clarification. This was fixed in .NET Micro Framework 4.3 (see Issue #1388), you can set Convert.UseRFC4648Encoding property in order to get '+' and '/' instead of '!' and '*':
 

System.Convert.UseRFC4648Encoding = true;


#5 Barbez95

Barbez95

    New Member

  • Members
  • Pip
  • 6 posts

Posted 28 June 2014 - 06:13 PM

Thanks for the reply! I will try in these weeks because I'm in holiday! And thank you again!







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.