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
def matchSIFTKeyPoints(self, template, quality=200): | |
try: | |
import cv2 | |
except ImportError: | |
logger.warning("OpenCV >= 2.3.0 required") | |
if template == None: | |
return None | |
detector = cv2.FeatureDetector_create("SIFT") | |
descriptor = cv2.DescriptorExtractor_create("SIFT") | |
img = self.getNumpyCv2() |
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
compiling opencv_webcam.cpp | |
opencv_webcam.cpp: In function ‘int main()’: | |
opencv_webcam.cpp:8:9: error: ‘cap’ was not declared in this scope | |
opencv_webcam.cpp:11:9: error: ‘k’ was not declared in this scope | |
opencv_webcam.cpp:11:23: error: ‘waitkey’ was not declared in this scope | |
opencv_webcam.cpp:12:9: error: expected ‘;’ before ‘if’ | |
Output file => opencv_webcam |
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 cv2.cv as cv | |
""" | |
Got the idea from http://newpathprep.wordpress.com/2012/08/13/opencv-forward-and-rewind-avi/ | |
He has done it in C++. | |
""" | |
def start(capture, n): | |
cv.SetCaptureProperty(capture, cv.CV_CAP_PROP_POS_FRAMES, n-1) | |
def rewind(capture): |
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 | |
import itertools | |
lk_params = dict( winSize = (10, 10), | |
maxLevel = 5, | |
criteria = (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 0.03)) | |
feature_params = dict( maxCorners = 3000, | |
qualityLevel = 0.5, |
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
from SimpleCV import * | |
import time, cv2 | |
import cv2.cv as cv | |
i = Image("Python/SimpleCV/line1.jpg") | |
g = i.getGrayNumpyCv2() | |
em = cv2.Canny(g, 70, 100) | |
l = cv2.HoughLines(em, 1.0, cv.CV_PI/180.0, 100) | |
print l.shape | |
l = l[0] |
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
PYTHON_VERSION = 2.7 | |
PYTHON_INCLUDE = /usr/include/python$(PYTHON_VERSION) | |
# location of the Boost Python include files and library | |
BOOST_INC = /usr/include | |
BOOST_LIB = /usr/lib | |
# compile mesh classes | |
TARGET = opencvtest |
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
echo "Install SimpleCV" | |
echo "Installing pre-reqisites" | |
sleep 1 | |
echo "Installing OpenCV..." | |
sudo apt-get install libopencv-* | |
sudo apt-get install python-opencv | |
echo "OpenCV installed" | |
echo "Installing numpy and scipy" | |
sudo apt-get install python-numpy python-scipy | |
echo "numpy and scipy installed" |
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
from SimpleCV import * | |
from cv2.cv import * | |
from cv2 import * | |
import time | |
import math | |
from copy import deepcopy | |
def fbtrack(imgI, imgJ, bb): | |
numM = 10 | |
numN = 10 |
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
from math import sqrt | |
def calculateBBCenter(bb): | |
center = (0.5*(bb[0] + bb[2]),0.5*(bb[1]+bb[3])) | |
return center | |
def getFilledBBPoints(bb, numM, numN, margin): | |
pointDim = 2 | |
bb_local = (bb[0] + margin, bb[1] + margin, bb[2] - margin, bb[3] - margin) | |
if numM == 1 and numN == 1 : |
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 pygtk | |
import gtk | |
import os | |
from random import randint | |
import urllib2 | |
import os | |
from BeautifulSoup import BeautifulSoup | |
from threading import Thread | |
import gobject | |
gtk.gdk.threads_init() |