diff --git a/Image-Processing/Sobel-edge-detection/Lion.JPG b/Image-Processing/Sobel-edge-detection/Lion.JPG deleted file mode 100755 index ed732dae..00000000 Binary files a/Image-Processing/Sobel-edge-detection/Lion.JPG and /dev/null differ diff --git a/Image-Processing/Sobel-edge-detection/README.md b/Image-Processing/Sobel-edge-detection/README.md deleted file mode 100644 index 937357f4..00000000 --- a/Image-Processing/Sobel-edge-detection/README.md +++ /dev/null @@ -1,27 +0,0 @@ - -## Canny Edge-detection ## - -- This script implements the sobel filter for edge detection without the use of the openCV in-built functions. -- The basic principle used here is convolution. -- A kernel, a matrix of size(3X3 or 5X5) is often chosen and is convoluted over the image.(which is a matrix of pixels) -- In RGB images there are 3 channels, while in grayscale there is only 1 channel. - -## Implementation ## - -- To run the scripts the user needs to run - - pip install opencv - -- The path to the image needs to be mentioned -- The image is converted to grayscale and then blurred -- The sobel kernel in the X-direction is [-1,-2,-1,0,0,0,1,2,1] -- The sobel kernel in the Y-direction is [-1,0,1,-2,0,2,-1,0,1] - -## Working ## - -This is the example image to begin with : - -![Image](Lion.JPG) - -This is the final image after running the filter : - -![Image](after.png) diff --git a/Image-Processing/Sobel-edge-detection/after.png b/Image-Processing/Sobel-edge-detection/after.png deleted file mode 100755 index e129f1aa..00000000 Binary files a/Image-Processing/Sobel-edge-detection/after.png and /dev/null differ diff --git a/Image-Processing/Sobel-edge-detection/sobel-edge-detect.py b/Image-Processing/Sobel-edge-detection/sobel-edge-detect.py deleted file mode 100755 index ac91318d..00000000 --- a/Image-Processing/Sobel-edge-detection/sobel-edge-detect.py +++ /dev/null @@ -1,76 +0,0 @@ -import numpy as np -import cv2 -from google.colab.patches import cv2_imshow -from math import sqrt, atan - -#This script can be used for edge-detection without the use of any inbuilt openCV libraries -#Here the sobel filter is applied after blurring the image. - -kernelblur = np.array([1/16, 1/8, 1/16, 1/8, 1/4, 1/8, 1/16, 1/8, 1/16]).reshape(3, 3) -kernelsobelX = np.array([-1, -2, -1, 0, 0, 0, 1, 2, 1]).reshape(3, 3) -kernelsobelY = kernelsobelX.transpose() - -def convolute(img, kernel, height, width): - pixels = [] - - #pixels are extracted from the image converted to grayscale - for i in range(height): - for j in range(width): - pixels.append(img[i, j]) - - #The pixels array is resized in accordance with the size of the image - pixels = np.array(pixels).reshape(height, width) - - #To handle the edge cases, sentinel values are used - #The pixels array is bound by zeros on all edges - - # 00000000 - # 0PIXELS0 - # 00000000 - #This is done to ensure that the kernel is applied to all the pixels - #Sentinel values to ensure the edges arent missed out - #Along the rows and columns - pixels = np.insert(pixels, [0, height], np.zeros(len(pixels[0])), axis = 0) - pixels = np.insert(pixels, [0, width], np.zeros((len(pixels[:, 0]), 1)), axis = 1) - - #Convolution is applied here - apply_filter = [] - for i in range(1, height): - for j in range(1, width): - temp = pixels[i:i+3, j:j+3] - product = np.multiply(temp, kernel) - apply_filter.append(sum(sum(product))) - - #The pixels are converted back to the image - apply_filter = np.array(apply_filter).reshape(height-1, width-1) - return(apply_filter) - -def sobel(img): - height = img.shape[0] - width = img.shape[1] - - #The image is blurred, so the noise is removed - blur = convolute(img, kernelblur, height, width) - - height = height - 1 - width = width - 1 - - #The sobel filter is applied in the X and Y direction separately - convoluted_Y = convolute(blur, kernelsobelX, height, width) - convoluted_X = convolute(blur, kernelsobelY, height, width) - - #Every pixel in convoluted_X can be called gx, in convoluted_Y can be called gy, - #The resultant will be sqrt(pow(gx**2) + pow(gy**2)) - resultant = [] - for i in range(height - 1): - for j in range(width - 1): - in_x = pow(convoluted_X[i, j], 2) - in_y = pow(convoluted_Y[i, j], 2) - gradient = sqrt(in_x + in_y) - reusultant.append(grad) - resultant = np.array(resultant).reshape(height-1, width-1) - cv2_imshow(resultant) - -if __name__ == "__main__": - img = cv2.imread("/path to image", 0) - sobel(img) diff --git a/System-Automation-Scripts/Automate-Telegram/README.md b/System-Automation-Scripts/Automate-Telegram/README.md new file mode 100644 index 00000000..1ee9c6e6 --- /dev/null +++ b/System-Automation-Scripts/Automate-Telegram/README.md @@ -0,0 +1,26 @@ +## Automate Telegram +- This script can be used to automate the process of sending messages in Telegram +- Here the process of automation is achieved by using the framework Selenium. +- Selenium is a portable framework for testing and automating web applications web applications + +## Working + +![Image](login.png) + +- The user is prompted to login and verify the phone number + +- The user will receive a code which has to be entered + +![Image](code.png) + +- After the verification process, the user can send messages to the contacts + +![Image](send.png) + +- The user can send multiple messages to the same user + +- The user can also send messages to multiple users + +![Image](working.PNG) + +- An message sent from the commandline diff --git a/System-Automation-Scripts/Automate-Telegram/automate_telegram.py b/System-Automation-Scripts/Automate-Telegram/automate_telegram.py new file mode 100755 index 00000000..986616a3 --- /dev/null +++ b/System-Automation-Scripts/Automate-Telegram/automate_telegram.py @@ -0,0 +1,46 @@ +#Imports and dependencies +from selenium import webdriver +import time +from selenium.webdriver.common.keys import Keys + +time_wait_sixty = 60 +time_wait_four = 4 + +#Here the process of automation is achieved by using the framework Selenium. +#Selenium is a portable framework for testing and automating web applications web applications + +def automate_telegram(): + #Path to the chromedriver must be entered without quotations + PATH = input("Enter path to the location chromedriver ") + chrome_path = PATH + #Initiating and setting up the driver + driver = webdriver.Chrome(chrome_path) + #For logging into web telegram, the user must verify the phone number + URL = "https://web.telegram.org/#/login" + driver.get(URL) + time.sleep(time_wait_sixty) + user = 1 + while user: + driver.find_element_by_xpath("/html/body/div[1]/div[2]/div/div[1]/div[1]/div/input").click() + name = input("Enter the name of the person ") + driver.find_element_by_xpath("/html/body/div[1]/div[2]/div/div[1]/div[1]/div/input").send_keys(name) + time.sleep(time_wait_four) + driver.find_element_by_xpath("/html/body/div[1]/div[2]/div/div[1]/div[2]/div/div[1]/ul/li").click() + msg = 1 + while msg: + message = input("Enter message ") + driver.find_element_by_xpath("/html/body/div[1]/div[2]/div/div[2]/div[3]/div/div[3]/div[2]/div/div/div/form/div[2]/div[5]").send_keys(message) + driver.find_element_by_xpath("/html/body/div[1]/div[2]/div/div[2]/div[3]/div/div[3]/div[2]/div/div/div/form/div[2]/div[5]").send_keys(Keys.ENTER) + print("Do you want to send another message? ") + msg = int(input("Enter 1 to continue, 0 to stop ")) + if msg == 0: + break + + print("Do you want to send messages to another contact? ") + user = int(input("Enter 1 to continue, 0 to stop ")) + + return("All messages sent") + +if __name__ == "__main__": + automate_telegram() + diff --git a/System-Automation-Scripts/Automate-Telegram/code.png b/System-Automation-Scripts/Automate-Telegram/code.png new file mode 100755 index 00000000..a28e99de Binary files /dev/null and b/System-Automation-Scripts/Automate-Telegram/code.png differ diff --git a/System-Automation-Scripts/Automate-Telegram/login.png b/System-Automation-Scripts/Automate-Telegram/login.png new file mode 100755 index 00000000..3e52f5f3 Binary files /dev/null and b/System-Automation-Scripts/Automate-Telegram/login.png differ diff --git a/System-Automation-Scripts/Automate-Telegram/send.png b/System-Automation-Scripts/Automate-Telegram/send.png new file mode 100755 index 00000000..449243be Binary files /dev/null and b/System-Automation-Scripts/Automate-Telegram/send.png differ diff --git a/System-Automation-Scripts/Automate-Telegram/working.PNG b/System-Automation-Scripts/Automate-Telegram/working.PNG new file mode 100755 index 00000000..9db5822b Binary files /dev/null and b/System-Automation-Scripts/Automate-Telegram/working.PNG differ