windy54
Posts: 86
Joined: Sat Dec 29, 2012 3:37 pm

Conversion from RGBarray to io.BytesIO

Sat Dec 12, 2015 9:39 pm

Hi,
Hope this is the right place to post this.
Background.
I have been using opencv to detect faces and other objects on my PI and it works.

I have then tried to put this software onto my robot and it does not detect a face. In order to see what is going wrong I have been trying to display the opencv image in a web page.
I have looked at several approaches and settled on the coderbot approach which is to display a jpeg file as a background image.

This works by capturing a camera image as io.BytesIO and transmitting it as a serial stream.

Another image is captured into an RGBarray and processed to detect for example a face .
This is the image I want to display on the web page.

Is it possible to convert a numpy array into an io.BytesIO object?

I have tried searching and have not come across anything , I did find the tostring method to convert an array but this adds formatting characters such as [ into the string .
The documentation for the camera shows how to go from io.BytesIO to opencv format but not the reverse.

Return to “Camera board”