Skip to content

Instantly share code, notes, and snippets.

View devarshi16's full-sized avatar
💭
Curiosity, always there

Devarshi Aggarwal devarshi16

💭
Curiosity, always there
View GitHub Profile
@devarshi16
devarshi16 / text_overlay.py
Created February 27, 2020 10:44
Vectorly interview assignment, first round
# This is the problem for First technical round for the role of Computer Vision Engineer at Vectorly
# More details at https://www.linkedin.com/jobs/view/1629909785/
#
# Write a function which will segment and extract the text overlay "Bart & Homer's EXCELLENT Adventure"
# Input image is at https://vectorly.io/demo/simpsons_frame0.png
# Output : Image with only the overlay visible and everything else white
#
# Note that you don't need to extract the text, the output is an image with only
# the overlay visible and everything else (background) white
#
import cv2
import numpy as np
# Finds distance between two points
def points_distance(pt1,pt2):
return (((pt1[0]-pt2[0])**2 + (pt1[1]-pt2[1])**2)**(1/2))
# Orders points clockwise
# Credits pyimagesearch.com
def order_points(pts):
@devarshi16
devarshi16 / one_hot_compare.py
Created July 11, 2021 11:10
Compare execution times of two different one hot encoding algorithms using numpy and python
import numpy as np
import matplotlib.pyplot as plt
import random
import time
def one_hot(Y):
data_size=Y.shape[0]
classes=np.unique(Y).reshape(-1,1)
num_classes=classes.shape[0]
class_mappings=np.arange(0,max(Y)+1)
import os
import numpy as np
import time
import matplotlib.pyplot as plt
from tqdm import tqdm
import requests
import gzip
from numpy import loadtxt,savetxt
np.seterr(divide='ignore',invalid='ignore')
" Personal neovim config file. NOTETOSELF: paste in ~/.config/nvim/
:set number
:set autoindent
:set tabstop=4
:set shiftwidth=4
:set smarttab
:set softtabstop=4
:set mouse=a
call plug#begin('~/.config/nvim/plugged')