ValueError : buffer object must be one-dimensional and have unsigned byte format ("B").

OpenCV, Python and other image processing questions
Post Reply
megil
Posts: 12
Joined: Mon Dec 23, 2019 8:32 am

ValueError : buffer object must be one-dimensional and have unsigned byte format ("B").

Post by megil »

Hello everyone,

I have a problem.

I get this error when running 1_test.py in tutorial;
ValueError : buffer object must be one-dimensional and have unsigned byte format ("B").

"raspistill -cs 0" - OK
"raspistill -cs 1" - OK

Can you help me?

Thanks.

User avatar
Realizator
Site Admin
Posts: 900
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: ValueError : buffer object must be one-dimensional and have unsigned byte format ("B").

Post by Realizator »

Hi Megil,
As a rule, such an errors appears if you're installing our tutorial scripts on a Raspbian with a newer Python or OpenCV version.

Solutions:
1. [recommended] Use the latest code and Raspbian image. This is Buster-based image and a code from this repo: https://github.com/realizator/stereopi-fisheye-robot
You can find downloads link in this repository description file.

(JFYI: This is updated version of older "https://github.com/realizator/stereopi-tutorial" code)

2. You can use previous code https://github.com/realizator/stereopi-tutorial and appropriate Stretch image

3. If you're advanced user, you can prepare appropriate Raspbian image by installing OpenCV as mentioned in this guide.

UPD> According to your another post on our forum, I can suggest you're using Ubuntu Mate. In this case it is better to follow step 3.
Eugene a.k.a. Realizator

megil
Posts: 12
Joined: Mon Dec 23, 2019 8:32 am

Re: ValueError : buffer object must be one-dimensional and have unsigned byte format ("B").

Post by megil »

I'm using Ubuntu-Mate.

The codes I use are the latest in your github repository.

User avatar
Realizator
Site Admin
Posts: 900
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: ValueError : buffer object must be one-dimensional and have unsigned byte format ("B").

Post by Realizator »

megil wrote:
Tue Dec 24, 2019 2:00 pm
I'm using Ubuntu-Mate.

The codes I use are the latest in your github repository.
Okay.
1. Which repository you're using now?
2. For our python codes you need to use python3. In our image we've tuned system, so running "python 1_test.py" actually runs python3, that is "python3 1_test.py". Have you tried to run "python3" instead of "python"?
Eugene a.k.a. Realizator

megil
Posts: 12
Joined: Mon Dec 23, 2019 8:32 am

Re: ValueError : buffer object must be one-dimensional and have unsigned byte format ("B").

Post by megil »

I tried it with python3 but it didn't work.

I think I have a bug related to numpy, I used PiRGBArray instead of numpy. I solved the problem.

Thanks.

User avatar
Realizator
Site Admin
Posts: 900
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: ValueError : buffer object must be one-dimensional and have unsigned byte format ("B").

Post by Realizator »

It's great that you've solved your issue! :-)
Eugene a.k.a. Realizator

Post Reply