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 | |
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 |
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
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 |
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
""" | |
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 |
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
""" | |
Template matching using opencv | |
Run : python file.py <templateImage> <actualImage> | |
""" | |
import sys, cv2 | |
import numpy as np |
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
/* | |
Author : Kushal Vyas | |
Code for template matching as implemented by opencv. | |
*/ | |
#include "opencv2/imgproc/imgproc.hpp" | |
#include "opencv2/opencv.hpp" | |
#include "iostream" | |
#include "cmath" |
NewerOlder