Coder Social home page Coder Social logo

Comments (19)

estherjk avatar estherjk commented on May 22, 2024

@lezabour, I'd be happy to help. Have you been able to use your webcam successfully with other applications on your pi? If not, can you try typing lsusb to see if your webcam is listed?

from face-detection-node-opencv.

lezabour avatar lezabour commented on May 22, 2024

Hi,

Thanks for your help.
Yes, the webcam works perfectly with other app.
I have tried the following:
opencv + python -> face detection / face recognition -> works OK
node.js + mjpg_streamer (or motion) -> works OK
All case webcam works, but with your code it seams no to launch the webcam.

thanks for your help

from face-detection-node-opencv.

estherjk avatar estherjk commented on May 22, 2024

@lezabour, does the camera turn on when running the server? I just want to make sure that the camera at least turns on when you start the server. (The green LED indicator on my webcam turns on when I start the server).

If not, let's double-check that node-opencv is installed correctly. Can you run any of the node-opencv examples? For example, try face-detection-rectangle.js; you may need to create a tmp folder before running it though. You can also try camera.js, which opens a new window with the video feed from your camera (not sure how this will look on your pi though).

And also, out of curiosity... are you attempting to open the page locally on your pi or on a computer on the same network? If the latter, modify the socket variable in client/app.js with the address of your pi. In the code, it's currently set to localhost. I originally created the demo to run locally on my computer.

from face-detection-node-opencv.

lezabour avatar lezabour commented on May 22, 2024

Hi,

Thanks again for your help.
Yes, node-opencv is installed, and work. Not all examples (seems i don't have some requested modules), but for example face-detection-rectangle or face-detection are working well on the "mona lisa" image, image is created on the tmp folder, with the face shown.

I go with my browser on my laptop (not the pi). So as you ask, i just changed the URL in client/apps.js, for 192.168.xx.xx:8080 is now it seems more active!!
It's not solve yet, but this helps ;)
To answer you, no the green led of the camera don't switch on when i turn on the server.
It only do it when i connect with my browser. And i does it only since i change the IP adress in client/apps.js like you said.
But not solve cause:

  1. on turning server On: no green light(camera Off) , but when a connection is active (with my browser on my laptop), camera goes On. From your previous answer i assume that it supposed to turn On as soon as i start the server.
  2. When camera is On, still nothing displaying on the browser (loading...), and after 5-10 secondes, camera goes off, and server goes down...
    Here is a copy of the command line..
    pi@RPI ~/projets/nodejs/face-detection-node-opencv/server $ sudo node server.js
    HTTP server listening on port 8080
    pi@RPI ~/projets/nodejs/face-detection-node-opencv/server $

So we are moving on, almost their, but not yet ;)

thanks again!!

from face-detection-node-opencv.

estherjk avatar estherjk commented on May 22, 2024

Ok, progress!

So, the camera indicator does turn on for me when I start the server on my laptop before I connect to it on the browser. I think it's okay if the camera turns on once you connect though -- images are only read from the camera once there is an active connection anyway.

For the other issues, I wonder if the frame rate might also be too high for the pi? Can you try lowering camFps in server/lib/routes/socket.js? You can also try reducing the camera image size by adjusting camWidth and camHeight. I also don't recommend having more than 1 browser page connected to the server either... this might also impact performance.

from face-detection-node-opencv.

lezabour avatar lezabour commented on May 22, 2024

Hi,

Thanks ;)
No still not working ;( I change the framerate, and dimension.
But framerate was at 10 fps which is low already.. it put it at 5, wich 160*120 size image, but not change, still crach after 5-10 secondes, and not displaying webcam

from face-detection-node-opencv.

estherjk avatar estherjk commented on May 22, 2024

Hm... not sure what the issue is. Which version of OpenCV are you using?

from face-detection-node-opencv.

lezabour avatar lezabour commented on May 22, 2024

2.4.9...

from face-detection-node-opencv.

estherjk avatar estherjk commented on May 22, 2024

@lezabour, I'm hoping to set up a raspberry pi and try it out, to see what the issues might be. It might take me a bit, but hopefully I'll have answers for you soon.

from face-detection-node-opencv.

lezabour avatar lezabour commented on May 22, 2024

Ok no problem
thank you very much for your help!

from face-detection-node-opencv.

estherjk avatar estherjk commented on May 22, 2024

@lezabour, ugh I accidentally deleted your last post. Apologies about that. It certainly is odd that the server goes down without outputting anything. Can you also check the console on the browser? Is anything outputted there?

In any case, I am trying to test this on a pi, but I've been running into issues building opencv 2.4.9 (and node-opencv). It seems like someone else has been running into issues with node-opencv on Raspberry Pi too -- see peterbraden/node-opencv#196.

from face-detection-node-opencv.

lezabour avatar lezabour commented on May 22, 2024

Hey,
Ok here is the post and things i do to install opencv & node opencv
(cf. https://learn.adafruit.com/raspberry-pi-face-recognition-treasure-box/software)

sudo apt-get install build-essential cmake pkg-config python-dev libgtk2.0-dev libgtk2.0 zlib1g-dev libpng-dev libjpeg-dev libtiff-dev libjasper-dev libavcodec-dev swig unzip

sudo apt-get -y install build-essential cmake cmake-curses-gui pkg-config libpng12-0 libpng12-dev libpng++-dev libpng3 libpnglite-dev zlib1g-dbg zlib1g zlib1g-dev pngtools libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools libeigen3-dev

sudo apt-get -y install libjpeg8 libjpeg8-dev libjpeg8-dbg libjpeg-progs ffmpeg libavcodec-dev libavcodec53 libavformat53 libavformat-dev libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev libxine1-ffmpeg libxine-dev libxine1-bin libunicap2 libunicap2-dev swig libv4l-0 libv4l-dev python-numpy libpython2.6 python-dev python2.6-dev libgtk2.0-dev

wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/opencv-2.4.9.zip
unzip opencv-2.4.9.zip

cd opencv-2.4.9
sudo cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_PERF_TESTS=OFF -DBUILD_opencv_gpu=OFF -DBUILD_opencv_ocl=OFF -DBUILD_PYTHON_SUPPORT=ON -DBUILD_EXAMPLES=ON
sudo make (will take 5-7 hours!!)
sudo make install

dependencies

sudo apt-get install python-pip
sudo apt-get install python-dev
sudo pip install picamera
sudo pip install rpio

NODE.JS
wget http://node-arm.herokuapp.com/node_latest_armhf.deb
sudo dpkg -i node_latest_armhf.deb

To make sure it ran correctly, run node -v. It should return the current version.
Running npm -v or npm --version

NODE.JS & OPENCV (NODE-OPENCV)
https://github.com/peterbraden/node-opencv

sudo apt-get install libopencv-dev python-opencv python-dev python-picamera
sudo pip install numpy
npm install opencv

Hope it will help you. With this, i reinstall opencv / node.js / node-opencv , 2 or 3 times on raspberry & raspbarian and every thing works.

Thanks

from face-detection-node-opencv.

estherjk avatar estherjk commented on May 22, 2024

@lezabour thanks for the instructions. Another question though: opencv 2.4.9 is built from source first, but then libopencv-dev is installed from apt-get under the NODE.JS & OPENCV instructions. This installs opencv 2.4.1... you didn't face any issues with having two different versions of opencv on your pi?

from face-detection-node-opencv.

estherjk avatar estherjk commented on May 22, 2024

@lezabour I managed to get OpenCV 2.4.9 installed from source (from the first part of your instructions). I also installed node-opencv without using the extra set of installations listed under NODE.JS & OPENCV.

Unfortunately, performance is very poor. I reduced the frame rate to 1 fps and the image size to 160x120, and it was very slow. It takes awhile for an image to show up. A few frames will process, but then the server eventually goes down with a Segmentation fault error:

drejkim@drejkim-pi ~/face-detection-node-opencv/server $ node server.js 
HTTP server listening on port 8080
GET /favicon.ico 200 145.683 ms - 410
Segmentation fault

Not sure of the best way to resolve this....

from face-detection-node-opencv.

lezabour avatar lezabour commented on May 22, 2024

Hi,

Thank again for taking time to test!
I was able to have a better resolution and fps, but with a lot of delay (around 3-4sec delay)
with small resolution and fps, i have less delay (around 2 sec)
in all case, it goes off after few seconds it goes off,
I don't have the error message like you, it's just goes as it was finish

But i think that the Raspberry is has not enough power to run opencv in node.js
I will try it on the new Raspberry PI 2, which is more powerfull, and i will let you know

Thanks

from face-detection-node-opencv.

estherjk avatar estherjk commented on May 22, 2024

@lezabour I also think it's a performance issue with the pi. I am also curious as to how well it run on the raspberry pi 2.

from face-detection-node-opencv.

lezabour avatar lezabour commented on May 22, 2024

Hi,
I got my PI2, so i could run some test.
The app is running of Pi2, but still have same problem.
Video is not going for a long time (few seconds).
And if it detects a face, it goes off directly.
Now i have the error message when the app is crashing

pi@RPI ~/projets/nodejs/face-detection-node-opencv/server $ node server.js
HTTP server listening on port 8080
Segmentation fault

Anyway, thanks for your help ;)

from face-detection-node-opencv.

estherjk avatar estherjk commented on May 22, 2024

@lezabour sorry to hear the the pi 2 also has the same issue. I guess it is also not powerful enough to run opencv with node and websockets. I'll go ahead and close this issue for now.

from face-detection-node-opencv.

PetrutaB avatar PetrutaB commented on May 22, 2024

Hi! Although this issue was close, I'd like to give some clarifications, thus I've been in the same situation as @lezabour. I was using an RPi 2 with an usual web cam, and I noticed, just like you that the video is not loading. So I've switched to RPi3, decreased the fps to 5 and finally I was able to run the application. Still, after 30s or so, I got Segmentation fault error. I've noticed that it was caused by SoC overheating. So, I've glued some radiators on the SoC and memory to dissipate the heat and now it work better. Still Segmentation fault after some time though... :)

from face-detection-node-opencv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.