Remove OpenCV examples
They live in hybridgroup/cylon-opencv now.
This commit is contained in:
parent
267c9fc7f6
commit
f3135bfd2c
Binary file not shown.
|
@ -1,46 +0,0 @@
|
||||||
Cylon = require('../..')
|
|
||||||
|
|
||||||
Cylon.robot
|
|
||||||
connection:
|
|
||||||
name: 'opencv', adaptor: 'opencv'
|
|
||||||
|
|
||||||
devices: [
|
|
||||||
{ name: 'window', driver: 'window' }
|
|
||||||
{
|
|
||||||
name: 'camera',
|
|
||||||
driver: 'camera',
|
|
||||||
camera: 0,
|
|
||||||
haarcascade: "#{ __dirname }/examples/opencv/haarcascade_frontalface_alt.xml"
|
|
||||||
} # Default camera is 0
|
|
||||||
]
|
|
||||||
|
|
||||||
work: (my) ->
|
|
||||||
my.camera.once('cameraReady', ->
|
|
||||||
console.log('The camera is ready!')
|
|
||||||
# We listen for the frameReady event, when triggered
|
|
||||||
# we display the frame/image passed as an argument to
|
|
||||||
# the listener function, and we tell the window to wait 40 milliseconds
|
|
||||||
my.camera.on('frameReady', (err, im) ->
|
|
||||||
console.log("FRAMEREADY!")
|
|
||||||
my.window.show(im, 40)
|
|
||||||
#my.camera.readFrame()
|
|
||||||
)
|
|
||||||
# Here we have two options to start reading frames from
|
|
||||||
# the camera feed.
|
|
||||||
# 1. 'As fast as possible': triggering the next frame read
|
|
||||||
# in the listener for frameReady, if you need video
|
|
||||||
# as smooth as possible uncomment #my.camera.readFrame()
|
|
||||||
# in the listener above and the one below this comment.
|
|
||||||
# Also comment out the `every 50, my.camera.readFrame`
|
|
||||||
# at the end of the comments.
|
|
||||||
#
|
|
||||||
# my.camera.readFrame()
|
|
||||||
#
|
|
||||||
# 2. `Use an interval of time`: to try to get a set amount
|
|
||||||
# of frames per second (FPS), we use an `every 50, myFunction`,
|
|
||||||
# we are trying to get 1 frame every 50 milliseconds
|
|
||||||
# (20 FPS), hence the following line of code.
|
|
||||||
#
|
|
||||||
every 50, my.camera.readFrame
|
|
||||||
)
|
|
||||||
.start()
|
|
|
@ -1,29 +0,0 @@
|
||||||
var Cylon = require('../..');
|
|
||||||
|
|
||||||
Cylon.robot({
|
|
||||||
connection: {
|
|
||||||
name: 'opencv',
|
|
||||||
adaptor: 'opencv'
|
|
||||||
},
|
|
||||||
devices: [
|
|
||||||
{
|
|
||||||
name: 'window',
|
|
||||||
driver: 'window'
|
|
||||||
}, {
|
|
||||||
name: 'camera',
|
|
||||||
driver: 'camera',
|
|
||||||
camera: 0,
|
|
||||||
haarcascade: "" + __dirname + "/examples/opencv/haarcascade_frontalface_alt.xml"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
work: function(my) {
|
|
||||||
return my.camera.once('cameraReady', function() {
|
|
||||||
console.log('The camera is ready!');
|
|
||||||
my.camera.on('frameReady', function(err, im) {
|
|
||||||
console.log("FRAMEREADY!");
|
|
||||||
return my.window.show(im, 40);
|
|
||||||
});
|
|
||||||
return every(50, my.camera.readFrame);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).start();
|
|
|
@ -1,62 +0,0 @@
|
||||||
# Display Camera
|
|
||||||
|
|
||||||
First, let's import Cylon:
|
|
||||||
|
|
||||||
Cylon = require('../..')
|
|
||||||
|
|
||||||
Now that we have Cylon imported, we can start defining our robot
|
|
||||||
|
|
||||||
Cylon.robot
|
|
||||||
|
|
||||||
Let's define the connections and devices:
|
|
||||||
|
|
||||||
connection:
|
|
||||||
name: 'opencv', adaptor: 'opencv'
|
|
||||||
|
|
||||||
devices: [
|
|
||||||
{ name: 'window', driver: 'window' }
|
|
||||||
{
|
|
||||||
name: 'camera',
|
|
||||||
driver: 'camera',
|
|
||||||
camera: 1,
|
|
||||||
haarcascade: "#{ __dirname }/examples/opencv/haarcascade_frontalface_alt.xml"
|
|
||||||
} # Default camera is 0
|
|
||||||
]
|
|
||||||
|
|
||||||
Now that Cylon knows about the necessary hardware we're going to be using, we'll
|
|
||||||
tell it what work we want to do:
|
|
||||||
|
|
||||||
work: (my) ->
|
|
||||||
my.camera.once('cameraReady', ->
|
|
||||||
console.log('The camera is ready!')
|
|
||||||
# We listen for frame ready event, when triggered
|
|
||||||
# we display the frame/image passed as an argument to
|
|
||||||
# the listener function, and we tell the window to wait 40 milliseconds
|
|
||||||
my.camera.on('frameReady', (err, im) ->
|
|
||||||
console.log("FRAMEREADY!")
|
|
||||||
my.window.show(im, 40)
|
|
||||||
#my.camera.readFrame()
|
|
||||||
)
|
|
||||||
# Here we have two options to start reading frames from
|
|
||||||
# the camera feed.
|
|
||||||
# 1. 'As fast as possible': triggering the next frame read
|
|
||||||
# in the listener for frameReady, if you need video
|
|
||||||
# as smooth as possible uncomment #my.camera.readFrame()
|
|
||||||
# in the listener above and the one below this comment.
|
|
||||||
# Also comment out the `every 50, my.camera.readFrame`
|
|
||||||
# at the end of the comments.
|
|
||||||
#
|
|
||||||
# my.camera.readFrame()
|
|
||||||
#
|
|
||||||
# 2. `Use an interval of time`: to try to get a set amount
|
|
||||||
# of frames per second (FPS), we use an `every 50, myFunction`,
|
|
||||||
# we are trying to get 1 frame every 50 milliseconds
|
|
||||||
# (20 FPS), hence the following line of code.
|
|
||||||
#
|
|
||||||
every 50, my.camera.readFrame
|
|
||||||
)
|
|
||||||
|
|
||||||
Now that our robot knows what work to do, and the work it will be doing that
|
|
||||||
hardware with, we can start it:
|
|
||||||
|
|
||||||
.start()
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -1,20 +0,0 @@
|
||||||
Cylon = require('../..')
|
|
||||||
|
|
||||||
Cylon.robot
|
|
||||||
connection:
|
|
||||||
name: 'opencv', adaptor: 'opencv'
|
|
||||||
|
|
||||||
devices: [
|
|
||||||
{ name: 'window', driver: 'window' }
|
|
||||||
{ name: 'camera', driver: 'camera', camera: 0 }
|
|
||||||
]
|
|
||||||
|
|
||||||
work: (my) ->
|
|
||||||
my.camera.on('cameraReady', ->
|
|
||||||
console.log('THE CAMERA IS READY!')
|
|
||||||
my.camera.on('frameReady', (err, im) ->
|
|
||||||
my.window.show(im, 5000)
|
|
||||||
)
|
|
||||||
my.camera.readFrame()
|
|
||||||
)
|
|
||||||
.start()
|
|
|
@ -1,27 +0,0 @@
|
||||||
var Cylon = require('../..');
|
|
||||||
|
|
||||||
Cylon.robot({
|
|
||||||
connection: {
|
|
||||||
name: 'opencv',
|
|
||||||
adaptor: 'opencv'
|
|
||||||
},
|
|
||||||
devices: [
|
|
||||||
{
|
|
||||||
name: 'window',
|
|
||||||
driver: 'window'
|
|
||||||
}, {
|
|
||||||
name: 'camera',
|
|
||||||
driver: 'camera',
|
|
||||||
camera: 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
work: function(my) {
|
|
||||||
return my.camera.on('cameraReady', function() {
|
|
||||||
console.log('THE CAMERA IS READY!');
|
|
||||||
my.camera.on('frameReady', function(err, im) {
|
|
||||||
return my.window.show(im, 5000);
|
|
||||||
});
|
|
||||||
return my.camera.readFrame();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).start();
|
|
|
@ -1,36 +0,0 @@
|
||||||
# Display Image from Camera
|
|
||||||
|
|
||||||
First, let's import Cylon:
|
|
||||||
|
|
||||||
Cylon = require('../..')
|
|
||||||
|
|
||||||
Now that we have Cylon imported, we can start defining our robot
|
|
||||||
|
|
||||||
Cylon.robot
|
|
||||||
|
|
||||||
Let's define the connections and devices:
|
|
||||||
|
|
||||||
connection:
|
|
||||||
name: 'opencv', adaptor: 'opencv'
|
|
||||||
|
|
||||||
devices: [
|
|
||||||
{ name: 'window', driver: 'window' }
|
|
||||||
{ name: 'camera', driver: 'camera', camera: 0 }
|
|
||||||
]
|
|
||||||
|
|
||||||
Now that Cylon knows about the necessary hardware we're going to be using, we'll
|
|
||||||
tell it what work we want to do:
|
|
||||||
|
|
||||||
work: (my) ->
|
|
||||||
my.camera.on('cameraReady', ->
|
|
||||||
console.log('THE CAMERA IS READY!')
|
|
||||||
my.camera.on('frameReady', (err, im) ->
|
|
||||||
my.window.show(im, 5000)
|
|
||||||
)
|
|
||||||
my.camera.readFrame()
|
|
||||||
)
|
|
||||||
|
|
||||||
Now that our robot knows what work to do, and the work it will be doing that
|
|
||||||
hardware with, we can start it:
|
|
||||||
|
|
||||||
.start()
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -1,61 +0,0 @@
|
||||||
Cylon = require('../..')
|
|
||||||
|
|
||||||
Cylon.robot
|
|
||||||
connection:
|
|
||||||
name: 'opencv', adaptor: 'opencv'
|
|
||||||
|
|
||||||
devices: [
|
|
||||||
{ name: 'window', driver: 'window' }
|
|
||||||
{
|
|
||||||
name: 'camera',
|
|
||||||
driver: 'camera',
|
|
||||||
camera: 0,
|
|
||||||
haarcascade: "#{ __dirname }/haarcascade_frontalface_alt.xml"
|
|
||||||
} # Default camera is 0
|
|
||||||
]
|
|
||||||
|
|
||||||
work: (my) ->
|
|
||||||
# We setup our face detection when the camera is ready to
|
|
||||||
# display images, we use `once` instead of `on` to make sure
|
|
||||||
# other event listeners are only registered once.
|
|
||||||
my.camera.once('cameraReady', ->
|
|
||||||
console.log('The camera is ready!')
|
|
||||||
# We add a listener for the facesDetected event
|
|
||||||
# here, we will get (err, image/frame, faces) params back in
|
|
||||||
# the listener function that we pass.
|
|
||||||
# The faces param is an array conaining any face detected
|
|
||||||
# in the frame (im).
|
|
||||||
my.camera.on('facesDetected', (err, im, faces) ->
|
|
||||||
# We loop through the faces and manipulate the image
|
|
||||||
# to display a square in the coordinates for the detected
|
|
||||||
# faces.
|
|
||||||
for face in faces
|
|
||||||
im.rectangle([face.x, face.y], [face.x + face.width, face.y + face.height], [0,255,0], 2)
|
|
||||||
# The second to last param is the color of the rectangle
|
|
||||||
# as an rgb array e.g. [r,g,b].
|
|
||||||
# Once the image has been updated with rectangles around
|
|
||||||
# the faces detected, we display it in our window.
|
|
||||||
my.window.show(im, 40)
|
|
||||||
|
|
||||||
# After displaying the updated image we trigger another
|
|
||||||
# frame read to ensure the fastest processing possible.
|
|
||||||
# We could also use an interval to try and get a set
|
|
||||||
# amount of processed frames per second, see below.
|
|
||||||
my.camera.readFrame()
|
|
||||||
)
|
|
||||||
# We listen for frameReady event, when triggered
|
|
||||||
# we start the face detection passing the frame
|
|
||||||
# that we just got from the camera feed.
|
|
||||||
my.camera.on('frameReady', (err, im) ->
|
|
||||||
my.camera.detectFaces(im)
|
|
||||||
)
|
|
||||||
|
|
||||||
# Here we could also try to get a set amount of processed FPS
|
|
||||||
# by setting an interval and reading frames every set amount
|
|
||||||
# of time. We could just uncomment the next line, then comment
|
|
||||||
# out the my.camera.readFrame() in the facesDetected listener
|
|
||||||
# above, as well as the one two lines below.
|
|
||||||
#every 150, my.camera.readFrame
|
|
||||||
my.camera.readFrame()
|
|
||||||
)
|
|
||||||
.start()
|
|
|
@ -1,37 +0,0 @@
|
||||||
var Cylon = require('../..');
|
|
||||||
|
|
||||||
Cylon.robot({
|
|
||||||
connection: {
|
|
||||||
name: 'opencv',
|
|
||||||
adaptor: 'opencv'
|
|
||||||
},
|
|
||||||
devices: [
|
|
||||||
{
|
|
||||||
name: 'window',
|
|
||||||
driver: 'window'
|
|
||||||
}, {
|
|
||||||
name: 'camera',
|
|
||||||
driver: 'camera',
|
|
||||||
camera: 1,
|
|
||||||
haarcascade: "" + __dirname + "/haarcascade_frontalface_alt.xml"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
work: function(my) {
|
|
||||||
return my.camera.once('cameraReady', function() {
|
|
||||||
console.log('The camera is ready!');
|
|
||||||
my.camera.on('facesDetected', function(err, im, faces) {
|
|
||||||
var face, _i, _len;
|
|
||||||
for (_i = 0, _len = faces.length; _i < _len; _i++) {
|
|
||||||
face = faces[_i];
|
|
||||||
im.rectangle([face.x, face.y], [face.x + face.width, face.y + face.height], [0, 255, 0], 2);
|
|
||||||
}
|
|
||||||
my.window.show(im, 40);
|
|
||||||
return my.camera.readFrame();
|
|
||||||
});
|
|
||||||
my.camera.on('frameReady', function(err, im) {
|
|
||||||
return my.camera.detectFaces(im);
|
|
||||||
});
|
|
||||||
return my.camera.readFrame();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).start();
|
|
|
@ -1,77 +0,0 @@
|
||||||
# Face Detection
|
|
||||||
|
|
||||||
First, let's import Cylon:
|
|
||||||
|
|
||||||
Cylon = require('../..')
|
|
||||||
|
|
||||||
Now that we have Cylon imported, we can start defining our robot
|
|
||||||
|
|
||||||
Cylon.robot
|
|
||||||
|
|
||||||
Let's define the connections and devices:
|
|
||||||
|
|
||||||
connection:
|
|
||||||
name: 'opencv', adaptor: 'opencv'
|
|
||||||
|
|
||||||
devices: [
|
|
||||||
{ name: 'window', driver: 'window' }
|
|
||||||
{
|
|
||||||
name: 'camera',
|
|
||||||
driver: 'camera',
|
|
||||||
camera: 1,
|
|
||||||
haarcascade: "#{ __dirname }/haarcascade_frontalface_alt.xml"
|
|
||||||
} # Default camera is 0
|
|
||||||
]
|
|
||||||
|
|
||||||
Now that Cylon knows about the necessary hardware we're going to be using, we'll
|
|
||||||
tell it what work we want to do:
|
|
||||||
|
|
||||||
work: (my) ->
|
|
||||||
# We setup our face detection when the camera is ready to
|
|
||||||
# display images, we use `once` instead of `on` to make sure
|
|
||||||
# other event listeners are only registered once.
|
|
||||||
my.camera.once('cameraReady', ->
|
|
||||||
console.log('The camera is ready!')
|
|
||||||
# We add a listener for the facesDetected event
|
|
||||||
# here, we will get (err, image/frame, faces) params back in
|
|
||||||
# the listener function that we pass.
|
|
||||||
# The faces param is an array conaining any face detected
|
|
||||||
# in the frame (im).
|
|
||||||
my.camera.on('facesDetected', (err, im, faces) ->
|
|
||||||
# We loop through the faces and manipulate the image
|
|
||||||
# to display a square in the coordinates for the detected
|
|
||||||
# faces.
|
|
||||||
for face in faces
|
|
||||||
im.rectangle([face.x, face.y], [face.x + face.width, face.y + face.height], [0,255,0], 2)
|
|
||||||
# The second to last param is the color of the rectangle
|
|
||||||
# as an rgb array e.g. [r,g,b].
|
|
||||||
# Once the image has been updated with rectangles around
|
|
||||||
# the faces detected, we display it in our window.
|
|
||||||
my.window.show(im, 40)
|
|
||||||
|
|
||||||
# After displaying the updated image we trigger another
|
|
||||||
# frame read to ensure the fastest processing possible.
|
|
||||||
# We could also use an interval to try and get a set
|
|
||||||
# amount of processed frames per second, see below.
|
|
||||||
my.camera.readFrame()
|
|
||||||
)
|
|
||||||
# We listen for frameReady event, when triggered
|
|
||||||
# we start the face detection passing the frame
|
|
||||||
# that we just got from the camera feed.
|
|
||||||
my.camera.on('frameReady', (err, im) ->
|
|
||||||
my.camera.detectFaces(im)
|
|
||||||
)
|
|
||||||
|
|
||||||
# Here we could also try to get a set amount of processed FPS
|
|
||||||
# by setting an interval and reading frames every set amount
|
|
||||||
# of time. We could just uncomment the next line, then comment
|
|
||||||
# out the my.camera.readFrame() in the facesDetected listener
|
|
||||||
# above as well as the one two lines below.
|
|
||||||
#every 150, my.camera.readFrame
|
|
||||||
my.camera.readFrame()
|
|
||||||
)
|
|
||||||
|
|
||||||
Now that our robot knows what work to do, and the work it will be doing that
|
|
||||||
hardware with, we can start it:
|
|
||||||
|
|
||||||
.start()
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue