How to run 'numpy' to change that the image to binary bits

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
destoriNAVY
Posts: 13
Joined: Wed Jan 20, 2021 7:19 am

Re: How to run 'numpy' to change that the image to binary bits

Post by destoriNAVY » Thu Jan 21, 2021 1:18 pm

Two things that I cannot understand is

First, Is the virtual flash drive that you said 'PYBFLASH (E:)' ??

That drive capacity is barely 88.5Kb, but most jpg file's higher than 100Kb

I saw the 'https://github.com/remixer-dec/mpy-img-decoder' but I don't know how to using

Second, Is there no way to change image's each pixels to binary?



Ah the P1 is that It's in the lower right corner of the back of the kit. 'DFU is to the right of BLUE'


What you're talking about seems to be that you don't need to use DFU.


I'm the first to see someone kind like you

THANKS FOR YOUR ENDLESS REPLY

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: How to run 'numpy' to change that the image to binary bits

Post by jimmo » Mon Jan 25, 2021 12:32 am

destoriNAVY wrote:
Thu Jan 21, 2021 1:18 pm
First, Is the virtual flash drive that you said 'PYBFLASH (E:)' ??

That drive capacity is barely 88.5Kb, but most jpg file's higher than 100Kb
Yes, it will show up as PYBFLASH.

It's a microcontroller -- they only have very small amounts of flash and ram. If you want to store big files you'll need to either add external spiflash, or use an SDCard (this is why the pyboard has an SDCard slot).
destoriNAVY wrote:
Thu Jan 21, 2021 1:18 pm
I saw the 'https://github.com/remixer-dec/mpy-img-decoder' but I don't know how to using
I posted an example in your other thread with how to get a pixel.
destoriNAVY wrote:
Thu Jan 21, 2021 1:18 pm
Second, Is there no way to change image's each pixels to binary?
I think I'm not quite sure what you mean by this. What do you mean by binary? Generally when you decode an image you'll get R, G, B values for each pixel. i.e. three bytes per pixel.

The library above gives you the three bytes as a single integer (i.e. 0xrrggbb).

If you want to access individual bits in these bytes you can use regular bitwise operations (left/right shift, and, etc).
destoriNAVY wrote:
Thu Jan 21, 2021 1:18 pm
Ah the P1 is that It's in the lower right corner of the back of the kit. 'DFU is to the right of BLUE'
Ah yeah, you're right. Yep that's the one.
destoriNAVY wrote:
Thu Jan 21, 2021 1:18 pm
What you're talking about seems to be that you don't need to use DFU.
DFU is Device Firmware Update.

You'll need to use it if:
a) The firmware on your device is corrupted or modified and you want to get back to the official firmware.
b) You want to update to the latest official firmware
c) You want to put custom firmware onto the device (i.e. ulab).

I would always recommend checking that you have the latest version (v1.13) but other than that, you shouldn't need to update the firmware to do what you want here.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: How to run 'numpy' to change that the image to binary bits

Post by dhylands » Tue Jan 26, 2021 6:25 pm

DFU is Device Firmware Update.

You'll need to use it if:
a) The firmware on your device is corrupted or modified and you want to get back to the official firmware.
b) You want to update to the latest official firmware
c) You want to put custom firmware onto the device (i.e. ulab).
Personally, I only use the DFU pin when I have to. If I can get to a REPL, then I use the

Code: Select all

pyb.bootloader()
command to get into DFU mode.

With rshell (and the pyboard) you do the following to get into DFU mode:

Code: Select all

rshell repl '~ import pyb~ pyb.bootloader() ~'

Post Reply