Skip to content

Instantly share code, notes, and snippets.

@yoggy
yoggy / find_large_contour_center_of_gravity.cpp
Created February 6, 2012 08:32
find large contour & calculate center of gravity sample code using OpenCV2
bool find_large_contour_center_of_gravity(cv::Mat &src_img, cv::Point &result)
{
cv::Mat gray_img, bin_img, erode_img, dilate_img;
std::vector<std::vector<cv::Point> > contours;
int max_area = 0;
std::vector<cv::Point> large_contour;
std::vector<cv::Point> convex_hull;
// convert to grayscale
cv::cvtColor(src_img, gray_img, CV_BGR2GRAY);
@pala
pala / navigation.js
Created January 16, 2012 08:10
jquery keyboard navigation
$(function(){
$(document).keydown(function(e) {
var url = false;
if (e.which == 37 || e.which == 74) { // Left arrow and J
{% if page.previous %}
url = '{{page.previous.url}}';
{% endif %}
}
else if (e.which == 39 || e.which == 75) { // Right arrow and K
{% if page.next %}
@vickychijwani
vickychijwani / ai-class.py
Created November 12, 2011 10:37 — forked from sumodx/ai-class.py
Download lecture videos of ai-class, with HTTP proxy and basic resume support
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Deepak.G.R."
__credits__ = "Sumod Hajela"
__license__ = 'Public Domain'
"""
usage:
Go to command line and type
@qingfeng
qingfeng / gist:874415
Created March 17, 2011 14:31
Processing Bubble Game
import hypermedia.video.*; // Imports the OpenCV library
OpenCV opencv; // Creates a new OpenCV object
PImage movementImg; // Creates a new PImage to hold the movement image
int poppedBubbles; // Creates a variable to hold the total number of popped bubbles
ArrayList bubbles; // Creates an ArrayList to hold the Bubble objects
PImage bubblePNG; // Creates a PImage that will hold the image of the bubble
PFont font; // Creates a new font object
void setup()