Recent releases have been pre-built using cross-compilers and this script and are downloadable below.
If you have found these packages useful, give me a shout out on twitter: @adammw
| import cv2 | |
| import cv2.cv as cv | |
| def detect(img, cascade_fn='haarcascades/haarcascade_frontalface_alt.xml', | |
| scaleFactor=1.3, minNeighbors=4, minSize=(20, 20), | |
| flags=cv.CV_HAAR_SCALE_IMAGE): | |
| cascade = cv2.CascadeClassifier(cascade_fn) | |
| rects = cascade.detectMultiScale(img, scaleFactor=scaleFactor, |
| // This code is modified from the working version to remove coupling with the original | |
| // application, and hasn't been tested in its new form. So, it's enough to give you | |
| // the basic idea, but may not entirely work ;) | |
| // | |
| // It assumes the src image is in HSV and the dst image is grayscale. | |
| // | |
| // CvScalar red = cvScalar(179, 255, 255); | |
| // CvScalar lowOffset = cvScalar(-20, -150, -150); // find colors down to h = 159, s = 105, v = 105 | |
| // CvScalar highOffset = cvScalar(20, 0, 0); // find colors up to h = 19, s = 255, v = 255 (h wraps/is mod 179) | |
| // colorThreshold(img, thresholded, red, lowOffset, highOffset); |
Recent releases have been pre-built using cross-compilers and this script and are downloadable below.
If you have found these packages useful, give me a shout out on twitter: @adammw
| http { | |
| proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m; | |
| proxy_temp_path /var/tmp; | |
| include mime.types; | |
| default_type application/octet-stream; | |
| sendfile on; | |
| keepalive_timeout 65; | |
| gzip on; | |
| gzip_comp_level 6; |
| var cluster = require('cluster'); | |
| var http = require('http'); | |
| var numCPUs = require('os').cpus().length; | |
| if (cluster.isMaster) { | |
| // Fork workers. | |
| for (var i = 0; i < numCPUs; i++) { | |
| cluster.fork(); | |
| } | |
| cluster.on('exit', function(worker, code, signal) { |
| function scoreboardProjection(frame_offset) { | |
| if (frame_offset == null) frame_offset = 0; | |
| var canvas, proj; | |
| var score_img_1, | |
| score_img_2, | |
| overlay, | |
| board_canvas, | |
| score_canvas_1, | |
| score_canvas_2; |
| // node: | |
| var moment = require('moment'); | |
| moment().add('days', 2).fromNow(); | |
| // 'in 2 days' | |
| moment().subtract('days', 2).fromNow(); | |
| // '2 days ago' | |
| moment('November 1977').fromNow() |
| // Server-side | |
| app.get('/keyword/search', | |
| function (req, res, next) { | |
| var query = new RegExp('^' + req.query.q + '.*$', 'i'); | |
| var result = []; | |
| mongodb.keywords.find( | |
| { word: query }, [ 'word' ], { limit: 5 }, | |
| function (err, keywords) { | |
| keywords.forEach(function (k) { | |
| result.push(k.word); |
| return View.extend({ | |
| initialize: function () { | |
| this.el.attr("draggable", "true") | |
| this.el.bind("dragstart", _.bind(this._dragStartEvent, this)) | |
| }, | |
| _dragStartEvent: function (e) { | |
| var data | |
| if (e.originalEvent) e = e.originalEvent | |
| e.dataTransfer.effectAllowed = "copy" // default to copy |