What are the programs (python code) that we use to convert a binary list into specific information like(pictures, words, sound)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What are the programs (python code) that we use to convert a binary list into specific information like(pictures, words, sound)?

I need to build such a code, how let me explain, I am using a laser that modulates light into binary (when the light is on, it means 1 and when it turns off it is 0.) this binary data is received thanks to my solar panel, which I will link to a computer. I am willing to make a python code that decodes this data depending on the information I need to convert. If it is a picture, a text or sound. Could someone help me? Thank you very much for helping me.

26th Mar 2019, 3:54 PM
Maximilien
Maximilien  - avatar
3 Answers
+ 2
I might be writing in my low amount of knowledge in this area, but for images, you can use OpenCV to read images as array. You would use the function cv2.imread to convert the image into array. You can use cv2.imshow to show an image from an array. As for words, I don't know if they use each letter's ASCII representation for their numbers. In python you can convert a letter using the ord function to its number, and then you can use bin to convert that number to binary. Viceversa: use int(number, base=2) to convert binary to decimal, then chr function to get letter. For Sound, I can't really help you there... I wish you success!
27th Mar 2019, 1:02 AM
Luis SepĂșlveda
Luis SepĂșlveda - avatar
+ 2
Thank you for your help! I will try this for now.
27th Mar 2019, 6:15 AM
Maximilien
Maximilien  - avatar
0
Yh
29th Mar 2019, 8:53 AM
Ani Peter Benjamin
Ani Peter Benjamin - avatar