├── .gitattributes ├── Grayscale ├── Pika.jpg ├── grayscale.jpg └── main.py ├── LICENSE ├── README.md ├── Research Papers └── 10.31590-ejosat.804599-1325431.pdf ├── Various operations ├── BMP image operations.docx ├── Basic pixel manipulation.docx ├── Huffman code.docx ├── Mean Filter, Weighted mean and High Boost Filter.docx ├── Pika.jpg ├── bmp header information.docx ├── canny.py ├── colorspace.py ├── contours.py ├── houghcircle.py ├── houghlines.py ├── meme.jpeg ├── psuedo color image processing.docx ├── reflection_out.jpg ├── shapes.png └── transformations.py └── thresholding ├── images.jpeg └── main.py /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /Grayscale/Pika.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kartik-Katkar/Image-Processing/8748d25314a57486570fa205a5d31a3525804cfc/Grayscale/Pika.jpg -------------------------------------------------------------------------------- /Grayscale/grayscale.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kartik-Katkar/Image-Processing/8748d25314a57486570fa205a5d31a3525804cfc/Grayscale/grayscale.jpg -------------------------------------------------------------------------------- /Grayscale/main.py: -------------------------------------------------------------------------------- 1 | # import the cv2 library 2 | import cv2 3 | 4 | # The function cv2.imread() is used to read an image. 5 | image = cv2.imread('Pika.jpg',0) 6 | 7 | # The function cv2.imshow() is used to display an image in a window. 8 | cv2.imshow('graycsale image',image) 9 | 10 | # waitKey() waits for a key press to close the window and 0 specifies indefinite loop 11 | cv2.waitKey(0) 12 | 13 | # cv2.destroyAllWindows() simply destroys all the windows we created. 14 | cv2.destroyAllWindows() 15 | 16 | # The function cv2.imwrite() is used to write an image. 17 | cv2.imwrite('grayscale.jpg',image) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Kartik Banshi Katkar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Image-Processing 2 | 3 | These Image processing techniques are used in AUV (Autonomous Underwater Vehicle) 4 | 5 | Key Features: 6 | 7 | Underwater-Specific Algorithms: The repository offers a wide array of image processing algorithms specifically designed for underwater environments. These algorithms address challenges such as color correction, image enhancement, noise reduction, and image restoration, improving the quality and clarity of underwater images captured by AUVs. 8 | 9 | Object Detection and Tracking: The toolbox includes algorithms and techniques for detecting and tracking objects of interest in underwater imagery. This functionality aids in tasks like identifying marine life, tracking underwater structures, or detecting anomalies in the underwater environment. 10 | 11 | Machine Learning Integration: The repository offers integration with machine learning frameworks to train custom models for specific underwater image processing tasks. Developers can leverage deep learning techniques to enhance object detection, classification, and segmentation in underwater images, boosting the accuracy and efficiency of AUV-based applications. 12 | 13 | Performance Optimization: The image processing code within the repository is designed with a focus on efficiency and performance. Utilizing optimized algorithms and parallel computing techniques, the code ensures fast and real-time processing, making it suitable for onboard AUV systems with limited computational resources. 14 | 15 | Collaborative Development and Contribution: The repository encourages collaboration and welcomes contributions from the AUV community. Developers and researchers can actively participate by submitting bug reports, suggesting improvements, or contributing new image processing algorithms that cater to specific underwater scenarios. 16 | 17 | The Trident Labs Image Processing Toolbox for Autonomous Underwater Vehicles is an invaluable asset for researchers, developers, and organizations working with AUVs. By harnessing the power of Python and advanced image processing techniques, this repository empowers AUVs to acquire, analyze, and interpret underwater imagery, enabling a deeper understanding of our oceans and marine ecosystems. 18 | -------------------------------------------------------------------------------- /Research Papers/10.31590-ejosat.804599-1325431.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kartik-Katkar/Image-Processing/8748d25314a57486570fa205a5d31a3525804cfc/Research Papers/10.31590-ejosat.804599-1325431.pdf -------------------------------------------------------------------------------- /Various operations/BMP image operations.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kartik-Katkar/Image-Processing/8748d25314a57486570fa205a5d31a3525804cfc/Various operations/BMP image operations.docx -------------------------------------------------------------------------------- /Various operations/Basic pixel manipulation.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kartik-Katkar/Image-Processing/8748d25314a57486570fa205a5d31a3525804cfc/Various operations/Basic pixel manipulation.docx -------------------------------------------------------------------------------- /Various operations/Huffman code.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kartik-Katkar/Image-Processing/8748d25314a57486570fa205a5d31a3525804cfc/Various operations/Huffman code.docx -------------------------------------------------------------------------------- /Various operations/Mean Filter, Weighted mean and High Boost Filter.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kartik-Katkar/Image-Processing/8748d25314a57486570fa205a5d31a3525804cfc/Various operations/Mean Filter, Weighted mean and High Boost Filter.docx -------------------------------------------------------------------------------- /Various operations/Pika.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kartik-Katkar/Image-Processing/8748d25314a57486570fa205a5d31a3525804cfc/Various operations/Pika.jpg -------------------------------------------------------------------------------- /Various operations/bmp header information.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kartik-Katkar/Image-Processing/8748d25314a57486570fa205a5d31a3525804cfc/Various operations/bmp header information.docx -------------------------------------------------------------------------------- /Various operations/canny.py: -------------------------------------------------------------------------------- 1 | import cv2 as cv 2 | import numpy as np 3 | from matplotlib import pyplot as plt 4 | 5 | img = cv.imread('./Pika.jpg',0) 6 | cv.imshow("orignal image",img) 7 | cv.waitKey() 8 | 9 | print(img.shape) 10 | print(img.size) 11 | print(type(img)) 12 | 13 | edges = cv.Canny(img,100,200) 14 | plt.subplot(121),plt.imshow(img,cmap = 'gray') 15 | plt.title('Original Image'), plt.xticks([]), plt.yticks([]) 16 | plt.subplot(122),plt.imshow(edges,cmap = 'gray') 17 | plt.title('Edge Image'), plt.xticks([]), plt.yticks([]) 18 | plt.show() 19 | 20 | 21 | # noise reduction Gaussian filter blurs image but not that much 22 | # Finding Intensity Gradient of the Image 23 | # Non-maximum Suppression 24 | # Hysteresis Thresholding -------------------------------------------------------------------------------- /Various operations/colorspace.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | 3 | img1 = cv2.imread("Pika.jpg") 4 | 5 | bgrgray = cv2.cvtColor(img1,cv2.COLOR_BGR2GRAY) 6 | bgrhsv = cv2.cvtColor(img1,cv2.COLOR_BGR2HSV) 7 | brightlab = cv2.cvtColor(img1,cv2.COLOR_BGR2LAB) 8 | 9 | cv2.imshow("Bgr to Gray",bgrgray) 10 | cv2.imshow("Bgr to HSV",bgrhsv) 11 | cv2.imshow("Bgr to lab",brightlab) 12 | 13 | # cmyk in printers for cheapness cyan magenta pink Half toning used 14 | # hsv is hue (color) saturation (amt of gray) value (brightness or intensity) 15 | # lab for l = lightness a = green to magenta b = blue to yellow 16 | # Drawback of RGB is no intensity like bright or dark 17 | 18 | cv2.waitKey(0) 19 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Various operations/contours.py: -------------------------------------------------------------------------------- 1 | # Contours can be explained simply as a curve joining all the continuous points (along the boundary), 2 | # having same color or intensity. The contours are a useful tool for shape analysis and object detection 3 | # and recognition. 4 | 5 | # Python code to find the co-ordinates of 6 | # the contours detected in an image. 7 | import numpy as np 8 | import cv2 9 | 10 | # Reading image 11 | font = cv2.FONT_HERSHEY_COMPLEX 12 | img2 = cv2.imread('./shapes.png', cv2.IMREAD_COLOR) 13 | 14 | # Reading same image in another 15 | # variable and converting to gray scale. 16 | img = cv2.imread('./shapes.png', cv2.IMREAD_GRAYSCALE) 17 | 18 | # Converting image to a binary image 19 | # ( black and white only image). 20 | _, threshold = cv2.threshold(img, 110, 255, cv2.THRESH_BINARY) 21 | 22 | # Detecting contours in image. 23 | contours, _= cv2.findContours(threshold, cv2.RETR_TREE, 24 | cv2.CHAIN_APPROX_SIMPLE) 25 | 26 | # Going through every contours found in the image. 27 | for cnt in contours : 28 | 29 | approx = cv2.approxPolyDP(cnt, 0.009 * cv2.arcLength(cnt, True), True) 30 | 31 | # draws boundary of contours. 32 | cv2.drawContours(img2, [approx], 0, (0, 0, 255), 5) 33 | 34 | # Used to flatted the array containing 35 | # the co-ordinates of the vertices. 36 | n = approx.ravel() 37 | i = 0 38 | 39 | for j in n : 40 | if(i % 2 == 0): 41 | x = n[i] 42 | y = n[i + 1] 43 | 44 | # String containing the co-ordinates. 45 | string = str(x) + " " + str(y) 46 | 47 | if(i == 0): 48 | # text on topmost co-ordinate. 49 | cv2.putText(img2, "Arrow tip", (x, y), 50 | font, 0.5, (255, 0, 0)) 51 | else: 52 | # text on remaining co-ordinates. 53 | cv2.putText(img2, string, (x, y), 54 | font, 0.5, (0, 255, 0)) 55 | i = i + 1 56 | 57 | # Showing the final image. 58 | cv2.imshow('image2', img2) 59 | 60 | # Exiting the window if 'q' is pressed on the keyboard. 61 | if cv2.waitKey(0) & 0xFF == ord('q'): 62 | cv2.destroyAllWindows() 63 | 64 | # See, there are three arguments in cv.findContours() function, first one is source image, 65 | # second is contour retrieval mode, third is contour approximation method. -------------------------------------------------------------------------------- /Various operations/houghcircle.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | 4 | # Read image. 5 | img = cv2.imread('./shapes.png', cv2.IMREAD_COLOR) 6 | 7 | # Convert to grayscale. 8 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 9 | 10 | # Blur using 3 * 3 kernel. 11 | gray_blurred = cv2.blur(gray, (3, 3)) 12 | 13 | # Apply Hough transform on the blurred image. 14 | detected_circles = cv2.HoughCircles(gray_blurred, 15 | cv2.HOUGH_GRADIENT, 1, 20, param1 = 50, 16 | param2 = 30, minRadius = 1, maxRadius = 40) 17 | 18 | # Draw circles that are detected. 19 | if detected_circles is not None: 20 | 21 | # Convert the circle parameters a, b and r to integers. 22 | detected_circles = np.uint16(np.around(detected_circles)) 23 | 24 | for pt in detected_circles[0, :]: 25 | a, b, r = pt[0], pt[1], pt[2] 26 | 27 | # Draw the circumference of the circle. 28 | cv2.circle(img, (a, b), r, (0, 255, 0), 2) 29 | 30 | # Draw a small circle (of radius 1) to show the center. 31 | cv2.circle(img, (a, b), 1, (0, 0, 255), 3) 32 | cv2.imshow("Detected Circle", img) 33 | cv2.waitKey(0) 34 | -------------------------------------------------------------------------------- /Various operations/houghlines.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | 4 | # Read image 5 | image = cv2.imread('./meme.jpeg') 6 | 7 | # Convert image to grayscale 8 | gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY) 9 | 10 | # Use canny edge detection 11 | edges = cv2.Canny(gray,50,150,apertureSize=3) 12 | 13 | # Apply HoughLinesP method to 14 | # to directly obtain line end points 15 | lines_list =[] 16 | lines = cv2.HoughLinesP( 17 | edges, # Input edge image 18 | 1, # Distance resolution in pixels 19 | np.pi/180, # Angle resolution in radians 20 | threshold=100, # Min number of votes for valid line 21 | minLineLength=5, # Min allowed length of line 22 | maxLineGap=10 # Max allowed gap between line for joining them 23 | ) 24 | 25 | # Iterate over points 26 | for points in lines: 27 | # Extracted points nested in the list 28 | x1,y1,x2,y2=points[0] 29 | # Draw the lines joing the points 30 | # On the original image 31 | cv2.line(image,(x1,y1),(x2,y2),(0,255,0),2) 32 | # Maintain a simples lookup list for points 33 | lines_list.append([(x1,y1),(x2,y2)]) 34 | 35 | # Save the result image 36 | cv2.imshow('detectedLines.png',image) 37 | cv2.waitKey(0) 38 | cv2.destroyAllWindows() 39 | -------------------------------------------------------------------------------- /Various operations/meme.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kartik-Katkar/Image-Processing/8748d25314a57486570fa205a5d31a3525804cfc/Various operations/meme.jpeg -------------------------------------------------------------------------------- /Various operations/psuedo color image processing.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kartik-Katkar/Image-Processing/8748d25314a57486570fa205a5d31a3525804cfc/Various operations/psuedo color image processing.docx -------------------------------------------------------------------------------- /Various operations/reflection_out.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kartik-Katkar/Image-Processing/8748d25314a57486570fa205a5d31a3525804cfc/Various operations/reflection_out.jpg -------------------------------------------------------------------------------- /Various operations/shapes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kartik-Katkar/Image-Processing/8748d25314a57486570fa205a5d31a3525804cfc/Various operations/shapes.png -------------------------------------------------------------------------------- /Various operations/transformations.py: -------------------------------------------------------------------------------- 1 | # Just shifting the image a little bit down 2 | 3 | # import numpy as np 4 | # import cv2 as cv 5 | # img = cv.imread('./shapes.png', 0) 6 | # rows, cols = img.shape 7 | # M = np.float32([[1, 0, 100], [0, 1, 50]]) 8 | # dst = cv.warpAffine(img, M, (cols, rows)) 9 | # cv.imshow('img', dst) 10 | # cv.waitKey(0) 11 | # cv.destroyAllWindows() 12 | 13 | # In the first argument, we passed the image, in the second argument it takes a matrix as a parameter in the matrix we 14 | # give x = 100, which means we are telling the function to shift the image 70 units on the right side and y= 50, which 15 | # means we are telling the function to shift the image 50 units downwards. In the third argument, where we mentioned 16 | # the cols and rows, we told the function to do not to crop the image from both the x and y sides. 17 | 18 | 19 | # Reflection of an image or flipping 20 | 21 | # import numpy as np 22 | # import cv2 as cv 23 | # img = cv.imread('./meme.jpeg', 0) 24 | # rows, cols = img.shape 25 | # M = np.float32([[1, 0, 0], 26 | # [0, -1, rows], 27 | # [0, 0, 1]]) 28 | 29 | # To flip horizontally 30 | # M = np.float32([[1, 0, 0], [0, -1, rows],[0, 0, 1]]) 31 | 32 | # vertically 33 | # M = np.float32([[-1, 0, cols], [0, 1, 0], [0, 0, 1]]) 34 | 35 | 36 | # reflected_img = cv.warpPerspective(img, M, 37 | # (int(cols), 38 | # int(rows))) 39 | # cv.imshow('img', reflected_img) 40 | # cv.imwrite('reflection_out.jpg', reflected_img) 41 | # cv.waitKey(0) 42 | # cv.destroyAllWindows() 43 | 44 | 45 | # Shrinking and enlarging the image 46 | 47 | import numpy as np 48 | import cv2 as cv 49 | img = cv.imread('./meme.jpeg', 0) 50 | rows, cols = img.shape 51 | img_shrinked = cv.resize(img, (250, 200), 52 | interpolation=cv.INTER_AREA) 53 | img_enlarged = cv.resize(img_shrinked, None, 54 | fx=1.5, fy=1.5, 55 | interpolation=cv.INTER_CUBIC) 56 | cv.imshow('img1', img_shrinked) 57 | cv.imshow('img2', img_enlarged) 58 | 59 | cv.waitKey(0) 60 | cv.destroyAllWindows() 61 | -------------------------------------------------------------------------------- /thresholding/images.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kartik-Katkar/Image-Processing/8748d25314a57486570fa205a5d31a3525804cfc/thresholding/images.jpeg -------------------------------------------------------------------------------- /thresholding/main.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | 4 | img = cv2.imread('./images.jpeg') 5 | retval, threshold = cv2.threshold(img, 12, 255, cv2.THRESH_BINARY) 6 | cv2.imshow('original',img) 7 | cv2.imshow('threshold',threshold) 8 | cv2.waitKey(0) 9 | cv2.destroyAllWindows() --------------------------------------------------------------------------------