Skip to content

Instantly share code, notes, and snippets.

View kushalvyas's full-sized avatar

Kushal Vyas kushalvyas

View GitHub Profile
import cv2
import numpy as np
from glob import glob
import argparse
from helpers import *
class BOV:
def __init__(self, no_clusters):
self.no_clusters = no_clusters
self.train_path = None
n_samples = 1000
n_features = 5;
n_clusters = 3;
# aint this sweet
X, y = make_blobs(n_samples, n_features)
# X => array of shape [nsamples,nfeatures] ;;; y => array of shape[nsamples]
# X : generated samples, y : integer labels for cluster membership of each sample
"""
Using SKLearns API for performing Kmeans clustering.
Using sklearn.datasets.make_blobs for generating randomized gaussians
for clustering.
"""
import numpy as np
from matplotlib import pyplot as plt
from sklearn.cluster import KMeans
"""
Template matching using opencv
Run : python file.py <templateImage> <actualImage>
"""
import sys, cv2
import numpy as np
/*
Author : Kushal Vyas
Code for template matching as implemented by opencv.
*/
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/opencv.hpp"
#include "iostream"
#include "cmath"