title: Encode/decode image data after changing to/from string/bytes
body: <p>The end goal of this is to create a program running on a Raspberry Pi that can stream video data to a remote client. To do this I (believe) I need to change the frame data to raw bytes in order for them to be sent over sockets. Before deploying this into the real world, I'm simply checking to make sure I can do the transformation to and from bytes. I do get output and it is reading data from the camera in real-time, but the way it's displayed is in a 1 pixel wide vertical left-aligned line. (When using the default full screen button on the OpenCV window it increases to about 5 pixels wide.) Also just to clarify, the tostring() function apparently transforms the given data into raw bytes and not a string? In checking, Python said the new variable was bytes.</p>
  
  <p>My previous attempts were focused on just taking the raw image data and attempting to encode and decode that, but I was met with an error. I think I'm on the right track but this is a bump in the road.</p>
  
  <pre class="lang-py prettyprint-override"><code>import cv2
  import numpy as np
  
  vid = cv2.VideoCapture(0)
  
  while True:
      empty, frame = vid.read()
  
      frameString = frame.tostring()
  
      # Intermediary socket stuffs.
  
      newFrame = np.frombuffer(frameString)
  
      cv2.imshow("s", newFrame)
  
      if cv2.waitKey(1) &amp; 0xFF == ord('q'):
          break
  
  vid.release()
  </code></pre>
  
  <p>Considering this is all working through Numpy I would expect to have equal results on either end of the transformation but something goes wrong and I'm not even sure where to start looking.(Standard and full screen screenshots: <a href="https://imgur.com/a/BIPxr50" rel="nofollow noreferrer">https://imgur.com/a/BIPxr50</a>)</p>