mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
example of roi
This commit is contained in:
parent
03a00c062f
commit
b8ec62e5f8
@ -6,6 +6,7 @@ var vid = new cv.VideoCapture(0)
|
||||
var snap = function(){
|
||||
vid.read(function(err, im){
|
||||
im.detectObject(cv.FACE_CASCADE, {}, function(err, faces){
|
||||
|
||||
if (!faces){
|
||||
console.log("No Faces")
|
||||
return;
|
||||
@ -13,14 +14,15 @@ var snap = function(){
|
||||
var face = faces[0]
|
||||
, ims = im.size()
|
||||
|
||||
var im2 = im.roi(face.x, face.y, face.width, face.height)
|
||||
/*
|
||||
im.adjustROI(
|
||||
-face.y
|
||||
, (face.y + face.height) - ims[0]
|
||||
, -face.x
|
||||
, (face.x + face.width) - ims[1])
|
||||
|
||||
console.log("!!", im.locateROI());
|
||||
var im2 = im.clone()
|
||||
*/
|
||||
im2.save('out.jpg')
|
||||
})
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user