diff --git a/auto_clicker using automation/auto_clicker.py b/auto_clicker using automation/auto_clicker.py new file mode 100644 index 0000000..79a15ea --- /dev/null +++ b/auto_clicker using automation/auto_clicker.py @@ -0,0 +1,57 @@ +import pyautogui +from pynput.keyboard import Key, Listener + +# ======== Controls ======== +start_or_pause_key = Key.f1 +exit_key = Key.esc +delay = 1 # seconds + +# ==== global variables ==== +pause = True +running = True + + +def display_controls(): + + print("F1 = Start / Pause") + print("ESC = Exit\n") + + +def choose_delay(): + + try: + return float(input("Enter wanted delay (seconds): ")) + except ValueError: + print(f"You did not give a valid input, default delay : {delay}sec") + return delay + + +def key_press(key): + global running, pause + + if key == start_or_pause_key: + pause = not pause + print("< Pause >") if pause else print("< Start >") + elif key == exit_key: + running = False + print("< Exit >") + + +def main(): + + delay = choose_delay() + print(f"delay = {str(delay)}sec\n") + display_controls() + + listener = Listener(on_press=key_press) + listener.start() + + while running: + if not pause: + pyautogui.click(pyautogui.position()) + pyautogui.PAUSE = delay + listener.stop() + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/auto_clicker using automation/readme.md b/auto_clicker using automation/readme.md new file mode 100644 index 0000000..0e9f905 --- /dev/null +++ b/auto_clicker using automation/readme.md @@ -0,0 +1,20 @@ +# AutoClicker +This is a basic autoclicker, you can choose the delay you want between each click. +## Prerequisites + +**Python 3.8.x** + +## Setup and activate virtual environment : +For Unix based systems please execute the following command to create venv and install requirements. +``` +make init +source .venv/bin/activate +``` + +Then you can run the script! + +## Controls +Key | Action +--- | --- +F1 | Resume / Pause +ESC | Exit the program \ No newline at end of file diff --git a/image_cartoonizer/image_cartoonizer.py b/image_cartoonizer/image_cartoonizer.py new file mode 100644 index 0000000..7efe7ff --- /dev/null +++ b/image_cartoonizer/image_cartoonizer.py @@ -0,0 +1,24 @@ +import cv2 +# import numpy as np + +img = cv2.imread(r"input image.jpg") + +# 1) Edges +gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) +gray = cv2.medianBlur(gray, 5) +edges = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_MEAN_C, + cv2.THRESH_BINARY, 9, 9) + +# 2) Color +color = cv2.bilateralFilter(img, 9, 300, 300) + +# 3) Cartoon +cartoon = cv2.bitwise_and(color, color, mask=edges) + + +cv2.imshow("Image", img) +cv2.imshow("Cartoon", cartoon) +cv2.imshow("color", color) +cv2.imshow("edges", edges) +cv2.waitKey(0) +cv2.destroyAllWindows() \ No newline at end of file diff --git a/image_cartoonizer/readme.md b/image_cartoonizer/readme.md new file mode 100644 index 0000000..5b918e2 --- /dev/null +++ b/image_cartoonizer/readme.md @@ -0,0 +1,11 @@ +# Image Cartoonizer - Script to convert Image to cartoon + +This python script exatrcts cartton format of any input image by the help of RGB analysis in Open Cv , using py package CV2 .The following points contains description of how to use the script + +### How to Use the script : +``` +Step 1 : First clone the repo +Step 2 : Then install dependencies by python run requirements.txt +step 3 : Input an image to the script +Step 4 : Run the script and see the output +``` \ No newline at end of file diff --git a/image_cartoonizer/requirements.txt b/image_cartoonizer/requirements.txt new file mode 100644 index 0000000..a6b22dd --- /dev/null +++ b/image_cartoonizer/requirements.txt @@ -0,0 +1,2 @@ +numpy = 1.19.2 +cv2 = 4.4.0.44 \ No newline at end of file