This small piece of code can be helpful if you are trying to generate gray code patterns from scratch.
The approach is intuitive, you just need to adjust a few parameters for your own projects.
- Open
thanh_graycode.py
- Change the following parameters
# Set initial parameters
im_h = 1080
im_w = 1920
# Number of bits
bit_no = 5
- If necessary, make a gif and let it run, it looks cool.
These few lines of code took me more time than I would like to admit. However, I do not come from programming background and it is my best try.
If possible, tell me how I can improve the code.
Also, feel free to use as needed, please also give credit/refer to my github.
Take a look at this gif!