Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto_clicker using automation #438

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions auto_clicker using automation/auto_clicker.py
Original file line number Diff line number Diff line change
@@ -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()
20 changes: 20 additions & 0 deletions auto_clicker using automation/readme.md
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions image_cartoonizer/image_cartoonizer.py
Original file line number Diff line number Diff line change
@@ -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()
11 changes: 11 additions & 0 deletions image_cartoonizer/readme.md
Original file line number Diff line number Diff line change
@@ -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
```
2 changes: 2 additions & 0 deletions image_cartoonizer/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
numpy = 1.19.2
cv2 = 4.4.0.44