So I have a Black/White only Graphic LCD that I want to feed images to. I choose Bitmap arrays as my image data storage type.
So I have managed to convert an image to 128x64 resolution and made it black and white (only logical 1 and 0) and my matrix looks like this:
I want to convert (automatically for multiple photos/video) these logical values to look like this:

답변 (1개)

Steven Lord
Steven Lord 2021년 6월 22일

0 개 추천

I can understand how you generate the 0x00 and 0xFF values from your logical data, but how do you generate the other values from false and true? What are the rules behind the conversion?
For mapping false to 0 and true to 0xFF:
r = rand(5) > 0.5
r = 5×5 logical array
1 1 1 0 0 0 1 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 0
r2 = zeros(size(r), 'uint8');
r2(r) = intmax('uint8')
r2 = 5×5
255 255 255 0 0 0 255 255 255 255 255 0 0 0 255 0 0 255 255 0 255 0 255 0 0

댓글 수: 2

Mihnea Dumitriu
Mihnea Dumitriu 2021년 6월 22일
편집: Mihnea Dumitriu 2021년 6월 22일
0xFF just means "1111 1111" in binary.
I wish to convert first 8 bites into a hex value then next 8 and so on and format the output as in the second screenshot.
Mihnea Dumitriu
Mihnea Dumitriu 2021년 6월 22일
You see as I have 0x94 it means "1001 0100" which is the format I have for sending data to my GLCD, 8 bites that indicate if the X,Y position of a LCD pixel is ON = 1 or OFF = 0.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2021년 6월 22일

편집:

2021년 6월 22일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by