Skip to content

General improvements#2

Open
chfour wants to merge 18 commits intoTheScienceElf:mainfrom
chfour:main
Open

General improvements#2
chfour wants to merge 18 commits intoTheScienceElf:mainfrom
chfour:main

Conversation

@chfour
Copy link
Copy Markdown

@chfour chfour commented Mar 11, 2022

I made some changes and corrections, mainly to the Python side of the source code.
The changes include:

  • Adding live webcam input to videoToTextColor.py! Use cam:[webcam_index_here] as the input file. (cv2.VideoCapture() also takes integers, which correspond to webcam indexes)
    Terminal screenshot, showing python videoToTextColor.py cam:0 running, below the prompt is a low-resolution, color ASCII image of the sky, seen through two windows, featuring my hand.
  • Re-indenting from 2 spaces to the standard (recommended) 4 spaces
  • Renaming variables to match Python recommended naming conventions
  • Syntax corrections and function docstrings
  • Changing all %-format strings (old) to Python 3 f-strings
  • Changing all double-quoted strings to single-quoted ones
  • In videoToTextColor.py, importing convert_img() from imgToTextColor.py
  • Adding a .gitignore to make git ignore temporary files
  • Adding a requirements.txt file with required pip modules (installable with pip install -r requirements.txt)
  • Removing an unnecessary import

As a side note, this whole idea with compression based on Markov chains and Huffman trees is genius. The video was awesome too, as always :)

Copy link
Copy Markdown

@toydotgame toydotgame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't tested code, but the changes to more standardised code styles and other similar small improvements LGTM!

@YuenSzeHong
Copy link
Copy Markdown

seen your code, another suggestion is to grab the aspect ratio of the video/image instead of hardcoding to 16:9

@YuenSzeHong
Copy link
Copy Markdown

also, the width of 80 hopefully can be changed by CLI or config file

@YuenSzeHong
Copy link
Copy Markdown

the code worked for my side

OS Version: Windows 11 for Workstations 22H2 22572.100
Python version: 3.10.2

@chfour
Copy link
Copy Markdown
Author

chfour commented Mar 16, 2022

seen your code, another suggestion is to grab the aspect ratio of the video/image instead of hardcoding to 16:9

That could definitely be done with something like ffprobe-python, I'll try to implement it as soon as I have some free time

also, the width of 80 hopefully can be changed by CLI or config file

I'll implement that using shutil.get_terminal_size()

@YuenSzeHong
Copy link
Copy Markdown

btw, i formatted your code to flake8 standard, as a poll request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants