added option for putText line thickness

This commit is contained in:
Morgan 'ARR\!' Allen 2015-05-06 10:46:00 -07:00
parent afe7467e13
commit 27267f310a
2 changed files with 7 additions and 5 deletions

View File

@ -1984,8 +1984,9 @@ NAN_METHOD(Matrix::PutText) {
}
double scale = args.Length() < 6 ? 1 : args[5]->NumberValue();
double thickness = args.Length() < 7 ? 1 : args[6]->NumberValue();
cv::putText(self->mat, text, cv::Point(x, y), constFont, scale, color, 2);
cv::putText(self->mat, text, cv::Point(x, y), constFont, scale, color, thickness);
NanReturnUndefined();
}

View File

@ -252,8 +252,9 @@ test("fonts", function(t) {
return Math.round(Math.random() * 255);
};
cv.readImage('./examples/files/coin1.jpg', function(e, im){
cv.readImage("./examples/files/coin1.jpg", function(e, im){
var y = 0;
var scale = 1;
([
"HERSEY_SIMPLEX",
@ -266,11 +267,11 @@ test("fonts", function(t) {
"HERSEY_SCRIPT_COMPLEX",
"HERSEY_SCRIPT_SIMPLEX"
]).forEach(function(font) {
im.putText("Some text", 0, y += 20, font, [rnd(), rnd(), rnd()]);
im.putText("Some text", 0, y += 20, font, [rnd(), rnd(), rnd()], 2, scale++);
});
t.ok(im, "image is ok")
//im.save("./examples/tmp/coin1-with-text.jpg");
t.ok(im, "image is ok");
im.save("./examples/tmp/coin1-with-text.jpg");
t.end();
});
})