mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
added option for putText line thickness
This commit is contained in:
parent
afe7467e13
commit
27267f310a
@ -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();
|
||||
}
|
||||
|
||||
@ -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();
|
||||
});
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user