Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some additions (examples, libuv, videocapture) #8

Merged
merged 4 commits into from
Jun 22, 2012

Conversation

alvarezgarcia
Copy link
Contributor

I've cloned your code 2 months ago, and added some new features (methods) to your Matrix class:

ConvertGrayscale
ConvertHSVscale
Copy
AddWeighted
Canny contour detector
Dilate

I've created a new class called Contour, which allows you to work with OpenCV contour objects.

I fixed the VideoCapture class, and added the read method, which is async (using libuv), and returns new Matrix object.

Finally, I've added new examples (some of them based on OpenCV 2 Computer Vision Application Programming Cookbook)

@peterbraden
Copy link
Owner

This is awesome.

Can you repull master? I'm getting merge conflicts and I can't test your branch until I manage to get my opencv install supporting videocapture.

Thanks!

@alvarezgarcia
Copy link
Contributor Author

Of course, this night I will merge my fixes with your last code, tomorrow I will send you again a pull request :D.

@indiejoseph
Copy link

talvarez, i can't build on Mac OS X Lion, It's work after i modified Contours.h replaced "vector" with "std::vector".

@alvarezgarcia
Copy link
Contributor Author

@indiejoseph Oh, thanks!, I was using only Linux.. I will add this change and send the pull request (I am working on the merge right now)

Conflicts:
	src/Matrix.cc
	src/Matrix.h
@alvarezgarcia
Copy link
Contributor Author

Well, I think that now is merged, try and tell me.

@peterbraden
Copy link
Owner

Thanks for merging!

I'm getting a build failure:

In file included from ../src/init.cc:6:
../src/Contours.h:7: error: ISO C++ forbids declaration of ‘vector’ with no type
../src/Contours.h:7: error: expected ‘;’ before ‘<’ token
In file included from ../src/Matrix.cc:1:
../src/Contours.h:7: error: ISO C++ forbids declaration of ‘vector’ with no type
../src/Contours.h:7: error: expected ‘;’ before ‘<’ token
../src/VideoCaptureWrap.cc: In function ‘void AsyncRead(uv_work_t*)’:
../src/VideoCaptureWrap.cc:90: error: ‘class cv::VideoCapture’ has no member named ‘read’
../src/Matrix.cc: In static member function ‘static v8::Handlev8::Value Matrix::Bla(const v8::Arguments&)’:
../src/Matrix.cc:411: warning: unused variable ‘buf’
../src/Matrix.cc:412: warning: unused variable ‘len’
../src/Matrix.cc:405: warning: unused variable ‘i’
../src/Matrix.cc:407: warning: unused variable ‘div’
../src/Matrix.cc: In static member function ‘static v8::Handlev8::Value Matrix::Split(const v8::Arguments&)’:
../src/Matrix.cc:444: warning: unused variable ‘self’
../src/Matrix.cc: In static member function ‘static v8::Handlev8::Value Matrix::FindContours(const v8::Arguments&)’:
../src/Matrix.cc:486: error: ‘class Contour’ has no member named ‘contours’
../src/Matrix.cc: In static member function ‘static v8::Handlev8::Value Matrix::DrawContour(const v8::Arguments&)’:
../src/Matrix.cc:508: error: ‘class Contour’ has no member named ‘contours’
../src/Matrix.cc: In static member function ‘static v8::Handlev8::Value Matrix::DrawAllContours(const v8::Arguments&)’:
../src/Matrix.cc:528: error: ‘class Contour’ has no member named ‘contours’
Waf: Leaving directory `/home/peterbraden/repositories/node-opencv/build'

I can't look into this right now, but perhaps later this week I can help debug? Or if you know what is happening?

@alvarezgarcia
Copy link
Contributor Author

Mmh I will take a look at this, I am using OpenCV-2.2, and Linux.
Are you using the same version of OpenCV, if not.. I will update to your version.

Well, at least I've using your last code (and it's not conflicting in merge), this errors are simple to solve (I think ahaha).

@peterbraden
Copy link
Owner

Hmm, looks like I currently have 2.0 installed on linux, I've been cycling between versions because they each have their own quirks.

@alvarezgarcia
Copy link
Contributor Author

Well, I suppose that certain methods ddn't exist in that version (2.0), in fact C++ API changed a lot since that version.
I will download the last OpenCV and fix my work, so the code will be up to date, what do you think?.

The code is working here with 2.2 version of OpenCV, but the OpenCV that you are using, is old.

@peterbraden
Copy link
Owner

You're right, I wonder if it's possible to wrap the whole contour class in a preprocessor check to see if the opencv version is greater than 2.2?

@peterbraden
Copy link
Owner

Regardless, I'll try and update.

@alvarezgarcia
Copy link
Contributor Author

Ok, first I will download the last (2.4) and fix the code to work with the fixes, I will send you again the pull request.
I've got a question, if it's greater than 2.2 (in 2.2 is working), what do you want the code to do?

(Maybe is more comfortable a way to chat, cause this messages are slow hahaha)

@clarle
Copy link

clarle commented Jun 20, 2012

I'm planning on possibly doing some contribution to this library as well, and I think it was mentioned in a previous issue, but OpenCV 2.4.1 does not work with it, the latest that works seems to be 2.3.1a. 2.3.1a also fails on some tests on the version in NPM, but works fine on master.

@talvarez, I'm getting the same build errors as peterbraden with 2.3.1a, but I haven't taken a good look at the code yet.

@alvarezgarcia
Copy link
Contributor Author

@clarle Ok... I will upgrade to 2.3.1 (the code I proppose for the Pull Request is working perfect with 2.2) and check if it's working.

@peterbraden
Copy link
Owner

Although I'd like the library to work with as many versions of OpenCV as possible, perhaps it would be best if we picked a specific version and worked to that.

The test suite is currently using 2.1 with travis CI - if we can update that to a more recent version then maybe we can all get on a single version.

@clarle
Copy link

clarle commented Jun 20, 2012

I propose 2.3.1a, simply because it's the latest one that works with the current master. I'm not sure why the most recent one fails on 2.4, but I don't know if it's worth spending the time to investigate the matter.

@alvarezgarcia
Copy link
Contributor Author

It's ok with 2.3.1 for me, I will upgrade to it in these days
(probably weekend) and correct the code (As you can see I want to
merge with your code Peter AHAHA)

@peterbraden
Copy link
Owner

I'm excited to merge your changes! It's great that we're settling on aversion now, so we can all be on the same page. I'm gonna try and grab some time and change the tests over to that build (if you guys know of any apt packages for that it'd be great!)

@alvarezgarcia
Copy link
Contributor Author

AndHERE IS... the final (I think) merge, is working properly with 2.3.1a.
In addition it is a new function that draws rectangles, I have to specify the std namespace because it was failing at compile (because of vector type).

And the proof that is working with 2.3.1 is the ldd command output :P:

sebastian@localhost:~/node-opencv$ ldd build/Release/opencv.node
linux-gate.so.1 => (0xb7fc6000)
libopencv_core.so.2.3 => /usr/lib/libopencv_core.so.2.3 (0xb7dab000)
libopencv_imgproc.so.2.3 => /usr/lib/libopencv_imgproc.so.2.3 (0xb7b42000)
libopencv_highgui.so.2.3 => /usr/lib/libopencv_highgui.so.2.3 (0xb7ab5000)
libopencv_ml.so.2.3 => /usr/lib/libopencv_ml.so.2.3 (0xb7a3a000)
libopencv_video.so.2.3 => /usr/lib/libopencv_video.so.2.3 (0xb79fa000)
libopencv_features2d.so.2.3 => /usr/lib/libopencv_features2d.so.2.3 (0xb7919000)
libopencv_calib3d.so.2.3 => /usr/lib/libopencv_calib3d.so.2.3 (0xb7878000)
libopencv_objdetect.so.2.3 => /usr/lib/libopencv_objdetect.so.2.3 (0xb781e000)
libopencv_contrib.so.2.3 => /usr/lib/libopencv_contrib.so.2.3 (0xb77c2000)
libopencv_legacy.so.2.3 => /usr/lib/libopencv_legacy.so.2.3 (0xb7709000)
libopencv_flann.so.2.3 => /usr/lib/libopencv_flann.so.2.3 (0xb76a3000)

@peterbraden
Copy link
Owner

I haven't got it installed yet, so I'm gonna take your word and just pull this in.

This is probably gonna break the travis CI tests, and I'd like to fix them, so if you have any idea how best to install 2.3 in the .travis.yml then please let me know.

Thanks for the patch!

peterbraden added a commit that referenced this pull request Jun 22, 2012
Some additions (examples, libuv, videocapture)
@peterbraden peterbraden merged commit 62293f5 into peterbraden:master Jun 22, 2012
@alvarezgarcia
Copy link
Contributor Author

Well, I never used Travis.. and in fact, I am trying now to figure out how
to use it.
I am investigating it, right now.

Thanks for apply the patch, I will be adding more functions and types for
my fork, but if you want we can in some point develop the same project (of
course yours because it was the first), I think that you base code was very
good, and easy to expand it with more classes.

Tell me what do you think.

Regards and sorry for my really bad English ahahah, I am from Argentina
so.. Spanish is my native language.

@clarle
Copy link

clarle commented Jun 22, 2012

Hm, it builds for me now, but it fails some tests:

clarence@QXQ:~/github/talvarez-cv$ npm test

> opencv@0.0.4 test /home/clarence/github/talvarez-cv
> node test/unit.js

·········✗····✗✗·✗OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /home/clarence/opencv-2.3.1/modules/core/src/array.cpp, line 2482
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/clarence/opencv-2.3.1/modules/core/src/array.cpp:2482: error: (-206) Unrecognized or unsupported array type in function cvGetMat

Aborted (core dumped)

@alvarezgarcia
Copy link
Contributor Author

Erm.. so strange, and the samples of the examples dir?

@clarle
Copy link

clarle commented Jun 22, 2012

All of the examples seem to work. They're very cool by the way. :)

I don't know why the old tests are failing though. I'll take a look.

@alvarezgarcia
Copy link
Contributor Author

I have to admit, that I did not remember the test dir, and tested the API
developing examples (some are the same of the OpenCV books).
I completely forget the unit test, but I will look it, in addition I pulled
5 minutes ago the node-opencv of Peter (the recently merged) in another
machine, compiled it and.. look this:

[sebastian@myhost node-opencv]$ ldd build/Release/opencv.node
linux-gate.so.1 => (0xb7782000)
libopencv_core.so.2.4 => /usr/lib/libopencv_core.so.2.4 (0xb752b000)
libopencv_imgproc.so.2.4 => /usr/lib/libopencv_imgproc.so.2.4
(0xb72c6000)
libopencv_highgui.so.2.4 => /usr/lib/libopencv_highgui.so.2.4
(0xb7237000)
libopencv_ml.so.2.4 => /usr/lib/libopencv_ml.so.2.4 (0xb71b8000)
libopencv_video.so.2.4 => /usr/lib/libopencv_video.so.2.4
(0xb7189000)
libopencv_features2d.so.2.4 => /usr/lib/libopencv_features2d.so.2.4
(0xb70fd000)
libopencv_calib3d.so.2.4 => /usr/lib/libopencv_calib3d.so.2.4
(0xb7057000)
libopencv_objdetect.so.2.4 => /usr/lib/libopencv_objdetect.so.2.4
(0xb6fd1000)
libopencv_contrib.so.2.4 => /usr/lib/libopencv_contrib.so.2.4
(0xb6f03000)
libopencv_legacy.so.2.4 => /usr/lib/libopencv_legacy.so.2.4
(0xb6dd2000)
libopencv_flann.so.2.4 => /usr/lib/libopencv_flann.so.2.4
(0xb6d66000)

So.. is working with 2.4, but.. in my developmente pc (my house) totally
no.. :S

@peterbraden
Copy link
Owner

@talvarez I'd love to keep pulling your stuff in - this is really good. As soon as I can get some time, I'll try and update open-cv and help out. Your English is great!

The travis stuff is pretty simple. We just need to get the opencv build steps into a reproducable script in the travis.yml file.

@jhurliman
Copy link
Contributor

Awesome work with all of this :-). +1

@peterbraden
Copy link
Owner

Just wanted to give everyone the heads up that I'm continuing to work on the waf binding, and as the build is fairly machine specific I don't want to break it for everyone. If the build stops working for you please let me know with the error message. Still haven't got the tests running but I'm working on it.

@alvarezgarcia
Copy link
Contributor Author

Ok you will be informed :P, but.. I think that, maybe, we have to join efforts (maybe conversation helps) in order to develop the API faster, and of course become famous AHAHA

@peterbraden
Copy link
Owner

Any of you guys at nodeconf this week? @talvarez we should totally chat some time - you have my gchat right?

@alvarezgarcia
Copy link
Contributor Author

Ehm Nodeconf is in California and.. I live in Buenos Aires, Argentina.
There is a new site of OpenCV http://opencv.org/ :D. and a really nice Q&A site, take a look http://answers.opencv.org

I've added you @peterbraden to my GChat.. but, you didn't accepted me :(.

@peterbraden
Copy link
Owner

@talvarez I've not seen the invitation - can you try again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants