<commit_before>var cv = require('../lib/opencv');

var lowThresh = 0;
var highThresh = 100;
var nIters = 2;
var maxArea = 2500;

var GREEN = [0, 255, 0]; //B, G, R
var WHITE = [255, 255, 255]; //B, G, R
var RED   = [0, 0, 255]; //B, G, R

cv.readImage('./stuff.png', function(err, im) {

	var big = new cv.Matrix(im.width(), im.height()); 
	var all = new cv.Matrix(im.width(), im.height()); 

	im.convertGrayscale();
	im_canny = im.copy();

	im_canny.canny(lowThresh, highThresh);
	im_canny.dilate(nIters);

	contours = im_canny.findContours();

	for(i = 0; i < contours.size(); i++) {
		if(contours.area(i) > maxArea) {
			var moments = contours.moments(i);
			var cgx = Math.round(moments.m10/moments.m00);
			var cgy = Math.round(moments.m01/moments.m00);
			big.drawContour(contours, i, GREEN);
			big.line([cgx - 5, cgy], [cgx + 5, cgy], RED);
			big.line([cgx, cgy - 5], [cgx, cgy + 5], RED);
		}
	}

	all.drawAllContours(contours, WHITE);


	big.save('./big.png');
	all.save('./all.png');
});<commit_msg>swap width/height in Matrix constructor<commit_after>var cv = require('../lib/opencv');

var lowThresh = 0;
var highThresh = 100;
var nIters = 2;
var maxArea = 2500;

var GREEN = [0, 255, 0]; //B, G, R
var WHITE = [255, 255, 255]; //B, G, R
var RED   = [0, 0, 255]; //B, G, R

cv.readImage('./stuff.png', function(err, im) {

	var big = new cv.Matrix(im.height(), im.width()); 
	var all = new cv.Matrix(im.height(), im.width()); 

	im.convertGrayscale();
	im_canny = im.copy();

	im_canny.canny(lowThresh, highThresh);
	im_canny.dilate(nIters);

	contours = im_canny.findContours();

	for(i = 0; i < contours.size(); i++) {
		if(contours.area(i) > maxArea) {
			var moments = contours.moments(i);
			var cgx = Math.round(moments.m10/moments.m00);
			var cgy = Math.round(moments.m01/moments.m00);
			big.drawContour(contours, i, GREEN);
			big.line([cgx - 5, cgy], [cgx + 5, cgy], RED);
			big.line([cgx, cgy - 5], [cgx, cgy + 5], RED);
		}
	}

	all.drawAllContours(contours, WHITE);


	big.save('./big.png');
	all.save('./all.png');
});
{'fraction_non_alphanumeric': 0.20751953125, 'fraction_numerical': 0.0400390625, 'mean_word_length': 3.5331858407079646, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5859792', 'n_tokens_mistral': 1001, 'n_tokens_neox': 858, 'n_words': 198}