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 | |
from matplotlib import pyplot as plt | |
im = cv2.imread('input-image.jpg') | |
rows, cols = im.shape[:2] | |
# Create a Gaussian filter | |
kernel_x = cv2.getGaussianKernel(cols,200) | |
kernel_y = cv2.getGaussianKernel(rows,200) | |
kernel = kernel_y * kernel_x.T | |
filter = 255 * kernel / np.linalg.norm(kernel) |
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 matplotlib.pyplot as plt | |
im = cv2.imread('input-image.jpg') | |
edges = cv2.Canny(im,100,300) | |
plt.imshow(edges) | |
plt.show() |
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 matplotlib.pyplot as plt | |
im = cv2.imread('input-image.jpg') | |
dst = cv2.GaussianBlur(im,(5,5),cv2.BORDER_DEFAULT) | |
plt.imshow(dst) | |
plt.show() |
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
opencv-python | |
cvlib | |
matplotlib | |
tensorflow |
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 matplotlib.pyplot as plt | |
import cvlib as cv | |
from cvlib.object_detection import draw_bbox | |
im = cv2.imread('apple-256261_640.jpg') | |
bbox, label, conf = cv.detect_common_objects(im) | |
output_image = draw_bbox(im, bbox, label, conf) | |
plt.imshow(output_image) | |
plt.show() |
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
# This script has been tested using a Raspberry Pi Camera Modeule v1.3 | |
from picamera.array import PiRGBArray | |
from picamera import PiCamera | |
import time | |
import cv2 as cv | |
import math | |
import dnn | |
import numpy as np | |
detectum = dnn.FaceDetector() |
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 dnn | |
import cv2 as cv | |
im = cv.imread('image.jpg') | |
_, bboxes = dnn.FaceDetector().process_frame(im, threshold=0.4) | |
for i in bboxes: | |
cv.rectangle(im, (i[0], i[1]), (i[2], i[3]), (0, 255, 0), 3) | |
cv.imwrite('/image_output.jpg', im) |
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
from google.cloud import vision | |
import io | |
from PIL import Image, ImageDraw | |
client = vision.ImageAnnotatorClient() | |
image_path = 'image_4.jpg' | |
with io.open(image_path, 'rb') as image_file: | |
content = image_file.read() |
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 dnn | |
import cv2 as cv | |
im = cv.imread('image.jpg') | |
_, bboxes = dnn.FaceDetector().process_frame(im, threshold=0.4) | |
for i in bboxes: | |
cv.rectangle(im, (i[0], i[1]), (i[2], i[3]), (0, 255, 0), 3) | |
cv.imwrite('/image_output.jpg', im) |
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 boto3 | |
from PIL import Image, ImageDraw | |
BUCKET = "<BUCKET_NAME>" | |
KEY = "<IMAGE_KEY>" | |
ACCESS_KEY = "<ACCESS_KEY>" | |
SECRET_KEY = "<SECRET_KEY>" | |
FEATURES_BLACKLIST = ("Landmarks", "Emotions", "Pose", "Quality", "BoundingBox", "Confidence") | |
def detect_faces(bucket, key, attributes=['ALL'], region="<REGION>"): |
NewerOlder