Skip to content

Instantly share code, notes, and snippets.

View shachibista's full-sized avatar

Shachi Bista shachibista

View GitHub Profile

Keybase proof

I hereby claim:

  • I am shachibista on github.
  • I am awkwardbird (https://keybase.io/awkwardbird) on keybase.
  • I have a public key ASCCvB-7KfVHGKZAeZ2xz7cnO-ODmAyLQvIJke6Cp9BUIAo

To claim this, I am signing this object:

[program:myserver]
command=/path/to/myserver
autostart=true
autorestart=true
startretries=5
stderr_logfile=/var/log/server/err.log
stdout_logfile=/var/log/server/out.log
user=service
FROM debian:squeeze
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -y install curl apache2 libapache2-mod-php5 php5 php5-suhosin php5-mysql php5-mcrypt php5-gd php5-curl ssl-cert
RUN echo "suhosin.executor.include.whitelist = phar" >> /etc/php5/cli/conf.d/suhosin.ini
ENV APACHE_RUN_USER www-data
#ifndef DuplexCommunicationLink_H
#define DuplexCommunicationLink_H
#include <Arduino.h>
#include <WConstants.h>
class DuplexCommunicationLink : public Stream {
private:
int cs;
File fileInterface;
$config->set('HTML.Doctype', 'HTML 4.01 Transitional');
$config->set('HTML.Allowed', 'img[src|width|height|alt|title],p,br,b,strong,i,em,strike,blockquote,ol,ul,li,a[href|target|title|class],div,span[class],iframe[src|width|height|class|frameborder]');
$config->set('HTML.SafeIframe', true);
$config->set('HTML.SafeObject', true);
$config->set('Output.FlashCompat', true);
$config->set('Filter.YouTube', true);
$config->set('URI.DisableExternalResources', false);
$config->set('URI.SafeIframeRegexp', '%^http://(www.youtube.com/embed/|player.vimeo.com/video/)%');
-module(concurrency).
Dev = fun DevFun() ->
receive
X ->
io:format("Dev(~p) got ~p~n--~n", [self(), X]),
DevFun()
end
end.
#0 __GI___libc_free (mem=0x400881b70) at malloc.c:2970
#1 0x00007ffff7b55a44 in cv::kmeans(cv::_InputArray const&, int, cv::_OutputArray const&, cv::TermCriteria, int, int, cv::_OutputArray const&) ()
from /usr/local/lib/libopencv_core.so.2.4
#2 0x00007ffff6fabcd9 in cv::EM::clusterTrainSamples() () from /usr/local/lib/libopencv_ml.so.2.4
#3 0x00007ffff6fada1f in cv::EM::doTrain(int, cv::_OutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&) () from /usr/local/lib/libopencv_ml.so.2.4
#4 0x00007ffff6fae309 in cv::EM::train(cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&) ()
from /usr/local/lib/libopencv_ml.so.2.4
#5 0x0000000000406886 in PredictAlpha::operator() (this=0x7fffffffe250, r=...) at gmm-windowed-parallel.cpp:132
#6 0x00007ffff7aa962e in tbb::interface6::internal::start_for<tbb::blocked_range<int>, (anonymous namespace)::ProxyLoopBody, tbb::auto_partitioner>::execute() ()
from /usr/local/lib/libopencv_core.so.2.4
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main(int argc, char** argv){
Mat threshold = imread("circle.png", 0);
vector<vector<Point> > contours;
Mat kMeansImg(Mat img, int K){
int r = img.rows;
img = img.reshape(1, img.rows * img.cols);
img.convertTo(img, CV_32FC1);
Mat labels;
Mat centers;
kmeans(img, K, labels, TermCriteria(TermCriteria::EPS | TermCriteria::MAX_ITER, 10, 1.0), 10, KMEANS_RANDOM_CENTERS, centers);
labels = labels.reshape(0, r);
convertScaleAbs(labels, labels, int(255 / K));
Mat neighbourhood(Mat img, int x, int y, int size){
int minX = x - size;
int maxX = x + size;
int minY = y - size;
int maxY = y + size;
if(minX < 0) minX = 0;
if(maxX > img.cols) maxX = img.cols;