Comparar commits
163 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 440a72c38e | |||
| 865962c845 | |||
| a347ab682e | |||
| f1d629bfb3 | |||
| 507ecbf832 | |||
| f0461db126 | |||
| 3c6028e0e3 | |||
| 95b2585838 | |||
| 289c519362 | |||
| 1d542bc056 | |||
| 76f3847321 | |||
| 8e55b380cd | |||
| 0efbd11d0c | |||
| b8ce5d0def | |||
| 053a693c9a | |||
| 64f933f2a9 | |||
| b17fceca72 | |||
| e5be89c813 | |||
| fd25b58e43 | |||
| ebd1f6e4e8 | |||
| e88d2d6b8a | |||
| daca1a14cb | |||
| 11db468dcf | |||
| 55cbf0a37f | |||
| 77279a33c0 | |||
| 6225a3c0f0 | |||
| f2ec2cd3ed | |||
| c3d3f0f4b4 | |||
| 0840e0b2e2 | |||
| 4ca165635e | |||
| a8e5ac4b6b | |||
| 24f255a161 | |||
| 0bb7fe9918 | |||
| 0cb436e930 | |||
| 3a7469fe52 | |||
| e1e1267bc3 | |||
| 32a1b76852 | |||
| a320ff9af0 | |||
| 521139a76e | |||
| 454fd1188a | |||
| 0de039956e | |||
| bb1fa037f3 | |||
| 84e5f255df | |||
| 4f7968e567 | |||
| a197586673 | |||
| e64b558bbd | |||
| c057d411a5 | |||
| fb55cec501 | |||
| be92fe5e65 | |||
| 642f111f9d | |||
| 8d6180bcaf | |||
| 63891ae4fa | |||
| 22bdf646b1 | |||
| 3b3c591517 | |||
| abf5e9948c | |||
| d2e8b1969f | |||
| e3280ddc1e | |||
| a94bc32d5f | |||
| 7be98efacf | |||
| b73ccb67fa | |||
| 3efe469ea0 | |||
| 8b899d073a | |||
| 2d0e747a4d | |||
| 644f6797d3 | |||
| f90cea5ffd | |||
| 4f56834420 | |||
| ab686c5445 | |||
| dcf7462b13 | |||
| 7d43360b72 | |||
| 20fa7a1c51 | |||
| 0ab26f913c | |||
| c4aac1d201 | |||
| 6df8bbbb9b | |||
| 33146b15e0 | |||
| c50cdf35a4 | |||
| fa6e6b4da1 | |||
| b6468cff4e | |||
| e33afd97ef | |||
| a9717c7dc0 | |||
| b5fe027703 | |||
| 3a1477c527 | |||
| e4c0ddd4e4 | |||
| d71b0ae7b3 | |||
| ac6c685b56 | |||
| 56fd1824d3 | |||
| ceb4d1f5e0 | |||
| c4cc2d45b8 | |||
| 391eb01ca6 | |||
| 3b5311cf42 | |||
| 298cc5adf3 | |||
| e9cbf158d5 | |||
| d4579e6d4c | |||
| d1ffdb056f | |||
| f7bd72f1ae | |||
| 03e444071c | |||
| 7468d0e5fe | |||
| 849e8a7beb | |||
| 7e564d504e | |||
| 0d43626aa0 | |||
| 809b5eba50 | |||
| 26484a1ed2 | |||
| ad9623c2f6 | |||
| a640b94dc7 | |||
| ef423a2be9 | |||
| b4489cfb77 | |||
| 6a6fb0ea7e | |||
| cb7a49b4f1 | |||
| 037cfb8c9c | |||
| 624194e334 | |||
| e1f4182a3e | |||
| f74971be01 | |||
| 8037d68386 | |||
| 55b2aa2476 | |||
| 0b6aab7b2b | |||
| 06e984c8f6 | |||
| 1faf584392 | |||
| e8cc061187 | |||
| 48ab05f624 | |||
| 946e1fc344 | |||
| c01ae532a6 | |||
| f855b2a332 | |||
| 97ffde101f | |||
| ce126ba9c8 | |||
| 6412013e41 | |||
| 9bf1f8bfdc | |||
| 8bfb1630cc | |||
| dbebe54425 | |||
| 279c3709f7 | |||
| 447c949d09 | |||
| 82694e5082 | |||
| 7272c1a9b5 | |||
| 0ff2d8dc83 | |||
| cc16770900 | |||
| 83ef8576dc | |||
| e1db78e6d9 | |||
| 5c1243329d | |||
| 1adb8409b9 | |||
| 7b6fad7606 | |||
| ec160560fc | |||
| 8d618a523a | |||
| 48996e2448 | |||
| 7532b9e332 | |||
| 8f8181b539 | |||
| 62293f5ecb | |||
| 9f88205143 | |||
| 4d1ea2867b | |||
| a0308135cb | |||
| b73174c00f | |||
| efbae5b61b | |||
| c4a1c7161f | |||
| 6168713d5f | |||
| 5f4ef5af30 | |||
| d154496199 | |||
| 0c7d496c0d | |||
| 8468ea4385 | |||
| 19526c294b | |||
| 2d1c374918 | |||
| be208afaae | |||
| c13aa6a945 | |||
| 765ee8d68b | |||
| 118da26a80 | |||
| 43b376e5e4 | |||
| 1f41b20438 |
Arquivo normal → Arquivo executável
+3
@@ -2,3 +2,6 @@ build
|
||||
.lock-wscript
|
||||
.DS_Store
|
||||
node_modules
|
||||
npm-debug.log
|
||||
out*.jpg
|
||||
examples/*.avi
|
||||
|
||||
Arquivo normal → Arquivo executável
+5
-10
@@ -1,16 +1,11 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.6
|
||||
- "0.6"
|
||||
- "0.8"
|
||||
- "0.10"
|
||||
|
||||
before_install:
|
||||
- sudo apt-get update
|
||||
- sudo apt-get upgrade
|
||||
- sudo apt-get install libavformat-dev
|
||||
- sudo apt-get install ffmpeg
|
||||
- sudo apt-get install libcv2.1
|
||||
- sudo apt-get install libcvaux2.1
|
||||
- sudo apt-get install libhighgui2.1
|
||||
- sudo apt-get install libcv-dev
|
||||
- sudo apt-get install libcvaux-dev
|
||||
- sudo apt-get install libcv-dev
|
||||
- sudo apt-get install libopencv-dev
|
||||
- sudo apt-get install libhighgui-dev
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
Copyright 2012 Peter Braden and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
Arquivo normal → Arquivo executável
+135
-17
@@ -3,11 +3,13 @@
|
||||
[](http://travis-ci.org/peterbraden/node-opencv)
|
||||
|
||||
|
||||
[OpenCV](http://opencv.willowgarage.com/wiki/) bindings for Node.js
|
||||
[OpenCV](http://opencv.willowgarage.com/wiki/) bindings for Node.js. OpenCV is the defacto computer vision library - by interfacing with it natively in node, we get powerful real time vision in js.
|
||||
|
||||
People are using node-opencv to fly control quadrocoptors, detect faces from webcam images and annotate video streams. If you're using it for something cool, I'd love to hear about it!
|
||||
|
||||
## Install
|
||||
|
||||
You'll need OpenCV installed. I'm using v2.2 because I couldn't get 2.3 to compile, but it should theoretically work with 2.3
|
||||
You'll need OpenCV 2.3.1 installed.
|
||||
|
||||
Then:
|
||||
|
||||
@@ -18,7 +20,7 @@ Then:
|
||||
Or to build the repo:
|
||||
|
||||
|
||||
node-waf configure && node-waf build
|
||||
node-gyp rebuild
|
||||
|
||||
|
||||
## Examples
|
||||
@@ -27,13 +29,12 @@ Or to build the repo:
|
||||
|
||||
|
||||
cv.readImage("./examples/test.jpg", function(err, im){
|
||||
im.detectObject("./examples/haarcascade_frontalface_alt.xml", {}, function(err, faces){
|
||||
im.detectObject(cv.FACE_CASCADE, {}, function(err, faces){
|
||||
for (var i=0;i<faces.length; i++){
|
||||
var x = faces[i]
|
||||
im.ellipse(x.x + x.width/2, x.y + x.height/2, x.width/2, x.height/2);
|
||||
}
|
||||
im.save('./out.jpg');
|
||||
|
||||
im.save('./out.jpg');
|
||||
});
|
||||
})
|
||||
|
||||
@@ -48,7 +49,11 @@ base datastructure in OpenCV. Things like images are just matrices of pixels.
|
||||
|
||||
#### Creation
|
||||
|
||||
new Matrix(width, height)
|
||||
new Matrix(rows, cols)
|
||||
|
||||
Or if you're thinking of a Matrix as an image:
|
||||
|
||||
new Matrix(height, width)
|
||||
|
||||
Or you can use opencv to read in image files. Supported formats are in the OpenCV docs, but jpgs etc are supported.
|
||||
|
||||
@@ -60,18 +65,33 @@ Or you can use opencv to read in image files. Supported formats are in the OpenC
|
||||
...
|
||||
})
|
||||
|
||||
If you need to pipe data into an image, you can use an imagestream:
|
||||
If you need to pipe data into an image, you can use an ImageDataStream:
|
||||
|
||||
var s = new cv.ImageDataStream()
|
||||
|
||||
s.on('load', function(matrix){
|
||||
...
|
||||
})
|
||||
|
||||
fs.createReadStream('./examples/test.jpg').pipe(s);
|
||||
|
||||
If however, you have a series of images, and you wish to stream them into a
|
||||
stream of Matrices, you can use an ImageStream. Thus:
|
||||
|
||||
var s = new cv.ImageStream()
|
||||
|
||||
s.on('load', function(matrix){
|
||||
...
|
||||
})
|
||||
s.on('data', function(matrix){
|
||||
...
|
||||
})
|
||||
|
||||
fs.createReadStream('./examples/test.jpg').pipe(s);
|
||||
ardrone.createPngStream().pipe(s);
|
||||
|
||||
Note: Each 'data' event into the ImageStream should be a complete image buffer.
|
||||
|
||||
|
||||
|
||||
#### Accessing Data
|
||||
|
||||
#### Accessors
|
||||
|
||||
var mat = new cv.Matrix.Eye(4,4); // Create identity matrix
|
||||
|
||||
mat.get(0,0) // 1
|
||||
@@ -80,9 +100,28 @@ If you need to pipe data into an image, you can use an imagestream:
|
||||
mat.col(4) // [0,0,0,1]
|
||||
|
||||
|
||||
##### Save
|
||||
|
||||
mat.save('./pic.jpg')
|
||||
|
||||
or:
|
||||
|
||||
var buff = mat.toBuffer()
|
||||
|
||||
|
||||
#### Image Processing
|
||||
|
||||
im.convertGrayscale()
|
||||
im.canny(5, 300)
|
||||
im.houghLinesP()
|
||||
|
||||
|
||||
|
||||
#### Simple Drawing
|
||||
|
||||
im.ellipse(x, y)
|
||||
im.line([x1,y1], [x2, y2])
|
||||
|
||||
|
||||
#### Object Detection
|
||||
|
||||
@@ -93,10 +132,89 @@ detection. This can be used for face detection etc.
|
||||
|
||||
mat.detectObject(haar_cascade_xml, opts, function(err, matches){})
|
||||
|
||||
For convenience in face recognition, cv.FACE_CASCADE is a cascade that can be used for frontal face recognition.
|
||||
|
||||
Also:
|
||||
|
||||
mat.goodFeaturesToTrack
|
||||
|
||||
|
||||
#### Contours
|
||||
|
||||
## WIP
|
||||
mat.findCountours
|
||||
mat.drawContour
|
||||
mat.drawAllContours
|
||||
|
||||
This is a WIP. I've never written C++ before so the code may be _interesting_ - if
|
||||
I'm doing stuff wrong please feel free to correct me.
|
||||
### Using Contours
|
||||
|
||||
`findContours` returns a `Contours` collection object, not a native array. This object provides
|
||||
functions for accessing, computing with, and altering the contours contained in it.
|
||||
See [relevant source code](src/Contours.cc) and [examples](examples/)
|
||||
|
||||
var contours = im.findContours;
|
||||
|
||||
# Count of contours in the Contours object
|
||||
contours.size();
|
||||
|
||||
# Count of corners(verticies) of contour `index`
|
||||
contours.cornerCount(index);
|
||||
|
||||
# Access vertex data of contours
|
||||
for(var c = 0; c < contours.size(); ++c) {
|
||||
console.log("Contour " + c);
|
||||
for(var i = 0; i < contours.cornerCount(c); ++i) {
|
||||
var point = contours.point(c, i);
|
||||
console.log("(" + point.x + "," + point.y + ")");"
|
||||
}
|
||||
}
|
||||
|
||||
# Computations of contour `index`
|
||||
contours.area(index);
|
||||
contours.arcLength(index, isClosed);
|
||||
contours.boundingRect(index);
|
||||
contours.minAreaRect(index);
|
||||
contours.isConvex(index);
|
||||
|
||||
# Destructively alter contour `index`
|
||||
contours.approxPolyDP(index, epsilon, isClosed);
|
||||
contours.convexHull(index, clockwise);
|
||||
|
||||
## MIT License
|
||||
The library is distributed under the MIT License - if for some reason that
|
||||
doesn't work for you please get in touch.
|
||||
|
||||
## Changelog
|
||||
|
||||
#### 0.0.13
|
||||
|
||||
- V Early support for face recognition - API is _likely_ to change. Have fun!
|
||||
- *API Change*: VideoCapture.read now calls callback(err, im) instead of callback(im)
|
||||
|
||||
#### 0.0.12
|
||||
- Matrix clone()
|
||||
- NamedWindow Support
|
||||
|
||||
#### 0.0.11
|
||||
|
||||
- Bug Fixes
|
||||
- ImageStream becomes ImageDataStream, and new ImageStream allows multiple images to be
|
||||
streamed as matrices, for example, with an object detection stream.
|
||||
- @ryansouza improved documentation
|
||||
- Correcting matrix constructor (thanks @gluxon)
|
||||
- @Michael Smith expanded Contours functionality.
|
||||
|
||||
Thanks all!
|
||||
|
||||
#### 0.0.10
|
||||
|
||||
- Bug Fixes
|
||||
- @Contra added code that allows thickness and color args for ellipse
|
||||
- Camshift Support
|
||||
- @jtlebi added bindings for erode, gaussianBlur, arcLength, approxPolyDP, isConvex, cornerCount
|
||||
- @gluxon added bindings for inRange
|
||||
|
||||
Thanks everyone!
|
||||
|
||||
#### 0.0.9
|
||||
|
||||
- toBuffer can now take a callback and be run async (re #21)
|
||||
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
|
||||
im.calcHistograms(function(err, hist){})
|
||||
|
||||
im.calcHistograms(mask, function(err, hist){})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Face recognition TODO
|
||||
|
||||
|
||||
// Load Database
|
||||
// TODO<
|
||||
|
||||
|
||||
|
||||
cv.loadImage('test.jpg', function(err, im){
|
||||
im.detectObject("front-face.xml", {}, function(err, faces){
|
||||
_.each(faces, function(v){
|
||||
|
||||
// TODO {
|
||||
|
||||
var section = im.slice(v.x, v.y, v.x + v.width, v.y + v.height);
|
||||
section.convertGrayscale()
|
||||
section.resize(WID, HEIGHT);
|
||||
section.equaliseHistogram();
|
||||
|
||||
// } TODO
|
||||
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----
|
||||
|
||||
|
||||
http://www.athile.net/library/wiki/index.php?title=Library/V8/Tutorial#Wrapping_a_Javascript_function_as_a_std::function.3C.3E
|
||||
|
||||
https://www.cloudkick.com/blog/2010/aug/23/writing-nodejs-native-extensions/
|
||||
Arquivo executável
+40
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"targets": [{
|
||||
"target_name": "opencv"
|
||||
, "sources": [
|
||||
"src/init.cc"
|
||||
, "src/Matrix.cc"
|
||||
, "src/OpenCV.cc"
|
||||
, "src/CascadeClassifierWrap.cc"
|
||||
, "src/Contours.cc"
|
||||
, "src/Point.cc"
|
||||
, "src/VideoCaptureWrap.cc"
|
||||
, "src/CamShift.cc"
|
||||
, "src/HighGUI.cc"
|
||||
, "src/FaceRecognizer.cc"
|
||||
]
|
||||
, 'libraries': [
|
||||
'<!@(pkg-config --libs opencv)'
|
||||
]
|
||||
, 'cflags': [
|
||||
'<!@(pkg-config --cflags --libs "opencv >= 2.3.1" )'
|
||||
, '-Wall'
|
||||
]
|
||||
, 'cflags!' : [ '-fno-exceptions']
|
||||
, 'cflags_cc!': [ '-fno-rtti', '-fno-exceptions']
|
||||
, "conditions": [
|
||||
['OS=="mac"', {
|
||||
# cflags on OS X are stupid and have to be defined like this
|
||||
'xcode_settings': {
|
||||
'OTHER_CFLAGS': [
|
||||
'<!@(pkg-config --cflags opencv)'
|
||||
]
|
||||
, "GCC_ENABLE_CPP_RTTI": "YES"
|
||||
, "GCC_ENABLE_CPP_EXCEPTIONS": "YES"
|
||||
}
|
||||
}]
|
||||
|
||||
]
|
||||
}]
|
||||
}
|
||||
|
||||
Arquivo executável
+15452
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
Arquivo executável
+33158
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff