diff --git a/.gitignore b/.gitignore index b324036083ef86dc3611c8708c4b96bd2c115a0f..1ea2497ad2a63c1270ade6f8cb0ed3ed0b625d26 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,156 @@ -# Benutzerspezifisch + +# Created by https://www.gitignore.io/api/macos,python,windows + +### macOS ### +*.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp .idea/** + +# Windows shortcuts +*.lnk + +# End of https://www.gitignore.io/api/macos,python,windows \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 9ce46e69a0d5dff1582cce2d4902c023ba348389..0000000000000000000000000000000000000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/medienverarbeitung17.projectmood.iml b/.idea/medienverarbeitung17.projectmood.iml deleted file mode 100644 index 6711606311e2664bd835f92b5c114681d2e284f5..0000000000000000000000000000000000000000 --- a/.idea/medienverarbeitung17.projectmood.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 71529a939195d9cfaa09e723d518de22caa3f871..0000000000000000000000000000000000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/projectmood/cvhelper.py b/projectmood/cvhelper.py new file mode 100644 index 0000000000000000000000000000000000000000..75980c183aaa26e97a1772d59eebb07167050d5c --- /dev/null +++ b/projectmood/cvhelper.py @@ -0,0 +1,7 @@ +import cv2 + +def createwindow(name, view, x=70, y=70, width=700, height=700): + cv2.namedWindow(name, cv2.WINDOW_NORMAL) + cv2.resizeWindow(name, width, height) + cv2.moveWindow(name, x, y) + cv2.imshow(name, view) \ No newline at end of file diff --git a/projectmood/main.py b/projectmood/main.py index eb86ab44ccc72ca1e4224d2c3381b06a9c3f9cad..86efd9f4832be69691d6ea4e84514e2db494197a 100644 --- a/projectmood/main.py +++ b/projectmood/main.py @@ -1,4 +1,29 @@ import cv2 -import emoji +import sys +import cvhelper -print(emoji.emojize('Python is :city_sunrise:', use_aliases=True)) \ No newline at end of file +def main(): + + if len(sys.argv) > 1: + cap = cv2.VideoCapture(str(sys.argv[1])) + else: + cap = cv2.VideoCapture(0) + + while(True): + # Capture frame-by-frame + ret, frame = cap.read() + + # Our operations on the frame come here + gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) + + cvhelper.createwindow('Grayscale', gray) + + + if cv2.waitKey(1) & 0xFF == ord('q'): + break + # When everything done, release the capture + cap.release() + cv2.destroyAllWindows() + +if __name__ == '__main__': + main() \ No newline at end of file