title: AWS : Running Rekognition on DeepLens device
body: <p>I am creating a DeepLens project to recognise people, when one of select group of people are scanned by the camera.</p>
  
  <p>The project uses a lambda, which processes the images and triggers the 'rekognition' aws api.</p>
  
  <p>On AWS lambda console ( which has 1.8.9 boto version ), I get following issue when I try to call an AWS python API:</p>
  
  <p>Note : <em>img_str</em> is a byte array</p>
  
  <pre><code>img_str = cv2.imencode('.jpg', frame)[1].tostring()
  image = { 'Bytes': img_str }
  response = rekognition.search_faces_by_image(CollectionId = 'TestingCollection', Image = { "Bytes" : image } )
  </code></pre>
  
  <p><strong>First error</strong> : sendall() argument 1 must be string or buffer, not dict</p>
  
  <p><strong>Reason in my understanding</strong> : { "Bytes" : image } is a Json and NOT a string</p>
  
  <p><strong>My Solution</strong> : Make the json a string ( not sure whether I can concatenate img_str ( a byte array )</p>
  
  <pre><code>image = '{ "Bytes" :' + img_str + '}'
  response = rekognition.search_faces_by_image(CollectionId = 'TestingCollection', Image = { "Bytes" : image } )
  </code></pre>
  
  <p><strong>Now error</strong> : Error in face detection lambda: 'ascii' codec can't decode byte 0xff in position 52: ordinal not in range(128)</p>
  
  <p><strong>Question</strong>
  How do I concatenate a byte array (img_str) with strings without losing the array ?</p>
  
  <p>Can i convert <em>image</em> variable to string WITHOUT <em>getting the can't decode byte 0xff</em> exception ? or</p>
  
  <p>Can we do something else to overcome this issue ?</p>
  
  <p>Thanks in advance guys !!</p>