This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import the required libraries | |
import matplotlib.pyplot as plt | |
import cv2 | |
%matplotlib inline | |
#reading the image | |
image = cv2.imread('index.png') | |
#reading in grayscale format | |
grayscale_image = cv2.imread('index.png',0) | |
#plotting the image | |
plt.imshow(image) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import the libraries | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import cv2 | |
%matplotlib inline | |
#reading the image | |
image = cv2.imread('index.png') | |
image = cv2.cvtColor(image,cv2.COLOR_BGR2RGB) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import the required libraries | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import cv2 | |
%matplotlib inline | |
image = cv2.imread('index.jpg') | |
#converting image to Gray scale | |
gray_image = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY) | |
#plotting the grayscale image | |
plt.imshow(gray_image) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
#reading the image | |
image = cv2.imread('index.jpg') | |
#converting image to size (100,100,3) | |
smaller_image = cv2.resize(image,(100,100),inerpolation='linear') | |
#plot the resized image | |
plt.imshow(smaller_image) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#importing the required libraries | |
import numpy as np | |
import cv2 | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
image = cv2.imread('index.png') | |
rows,cols = image.shape[:2] | |
#(col/2,rows/2) is the center of rotation for the image | |
# M is the cordinates of the center | |
M = cv2.getRotationMatrix2D((cols/2,rows/2),90,1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#importing the required libraries | |
import numpy as np | |
import cv2 | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
#reading the image | |
image = cv2.imread('index.png') | |
#shifting the image 100 pixels in both dimensions | |
M = np.float32([[1,0,-100],[0,1,-100]]) | |
dst = cv2.warpAffine(image,M,(cols,rows)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#importing the required libraries | |
import numpy as np | |
import cv2 | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
#here 0 means that the image is loaded in gray scale format | |
gray_image = cv2.imread('index.png',0) | |
ret,thresh_binary = cv2.threshold(gray_image,127,255,cv2.THRESH_BINARY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import the libraries | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import cv2 | |
%matplotlib inline | |
#ADAPTIVE THRESHOLDING | |
gray_image = cv2.imread('index.png',0) | |
ret,thresh_global = cv2.threshold(gray_image,127,255,cv2.THRESH_BINARY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#importing required libraries | |
import numpy as np | |
import cv2 | |
import matplotlib.pyplot as plt | |
#reading the image | |
image = cv2.imread('coins.jpg') | |
#converting image to grayscale format | |
gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY) | |
#apply thresholding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import required libraries | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import cv2 | |
%matplotlib inline | |
#read the image | |
image = cv2.imread('coins.jpg') | |
#apply thresholdin | |
ret,mask = cv2.threshold(sure_fg,0,255,cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU) | |
#apply AND operation on image and mask generated by thrresholding |
OlderNewer