This file contains hidden or 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 as cv | |
| import sys | |
| img = cv.imread(cv.samples.findFile("cats.jpg")) | |
| if img is None: | |
| sys.exit("Could not read the image.") | |
| cv.imshow("Display window", img) | |
| k = cv.waitKey(0) | |
| if k == ord("s"): | |
| cv.imwrite("starry_night.png", img) |
This file contains hidden or 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 as cv | |
| import sys |
This file contains hidden or 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
| img = cv.imread(cv.samples.findFile("cats.jpg")) |
This file contains hidden or 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
| if img is None: | |
| sys.exit("Could not read the image.") |
This file contains hidden or 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
| cv.imshow("Display window", img) | |
| k = cv.waitKey(0) |
This file contains hidden or 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
| if k == ord("s"): | |
| cv.imwrite("cats.png", img) |
This file contains hidden or 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 as cv | |
| # Read in an image | |
| img = cv.imread('../Resources/Photos/park.jpg') | |
| cv.imshow('Park', img) | |
| # Converting to grayscale | |
| gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) | |
| cv.imshow('Gray', gray) |
This file contains hidden or 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 as cv | |
| # Read in an image | |
| img = cv.imread('../Resources/Photos/park.jpg') | |
| cv.imshow('Park', img) | |
| #Blur an image | |
| blur = cv.GaussianBlur(img, (7,7), cv.BORDER_DEFAULT) | |
| cv.imshow('Blur', blur) |
This file contains hidden or 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
| #library is imported | |
| import cv2 as cv | |
| # Read in an image | |
| img = cv.imread('../Resources/Photos/park.jpg') | |
| cv.imshow('Park', img) | |
| # Edge Cascade | |
| canny = cv.Canny(blur, 125, 175) | |
| cv.imshow('Canny Edges', canny) |
This file contains hidden or 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 opencv CV2 module | |
| import cv2 | |
| # bat.jpg is the batman image. | |
| img = cv2.imread('gfg.png') | |
| # make sure that you have saved it in the same folder | |
| # Averaging | |
| # You can change the kernel size as you want | |
| avging = cv2.blur(img,(10,10)) |
OlderNewer