Skip to content

Instantly share code, notes, and snippets.

View sabiipoks's full-sized avatar

Sabina sabiipoks

  • Sydney, Australia
View GitHub Profile
@sabiipoks
sabiipoks / vintagefilter.py
Created December 23, 2022 06:30
Vintage Filter - Python
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)
@sabiipoks
sabiipoks / edgedetectionfilter.py
Created December 23, 2022 06:28
Edge Detection Filter - Python
import cv2
import matplotlib.pyplot as plt
im = cv2.imread('input-image.jpg')
edges = cv2.Canny(im,100,300)
plt.imshow(edges)
plt.show()
@sabiipoks
sabiipoks / BlurFilter.py
Created December 23, 2022 06:21
Blur Filter - Python
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()
@sabiipoks
sabiipoks / object_detection_imports.txt
Created November 26, 2022 08:25
Object detection library imports
opencv-python
cvlib
matplotlib
tensorflow
@sabiipoks
sabiipoks / object_detection_python.py
Created November 26, 2022 08:22
Object detection python
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()
@sabiipoks
sabiipoks / XailientFaceDetection_PiCamera.py
Last active January 3, 2020 06:02
Xailient Face Detection using PiCamera
# 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()
@sabiipoks
sabiipoks / face detection_xailientfacesdk.py
Created December 21, 2019 03:29
Python code for face detection using 7 lines
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)
@sabiipoks
sabiipoks / GoogleCouldVisionAPI_Face.py
Last active December 4, 2019 09:39
Face Detection using Google Cloud Vision API
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()
@sabiipoks
sabiipoks / Xailient_FaceSDK_Python.py
Last active December 4, 2019 08:45
Xailient Face SDK - Face Detection in Python
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)
@sabiipoks
sabiipoks / AmazonRekon_FacePython.py
Last active December 4, 2019 04:19
Amazon Rekognition Face Detection Python
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>"):