Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
include
test
Makefile
README.md
deploy
face_detector.hpp
image_proc.cpp
image_proc.hpp
image_proc.nmf
improc_instance.hpp
index.html
instance_factory.hpp
mmcdonne.jpg
processor.hpp
processor_barcode.cpp
processor_cartoon.cpp
processor_diff.cpp
processor_eyetrack.cpp
processor_facedetect.cpp
processor_facedetect.hpp
processor_gblur.cpp
processor_houghline.cpp
processor_id.cpp
processor_invert.cpp
processor_laplacian.cpp
processor_probabilistichoughline.cpp
processor_pulsedetect.cpp
processor_redchannel.cpp
processor_skindetect.cpp
processor_smiley.cpp
processor_sobel.cpp
processor_watershed.cpp
singleton_factory.hpp
smiley_200x200.png
test_display.cpp
test_processor.cpp
url_loader_handler.cpp
url_loader_handler.hpp
video.js
video_img.js
water_coins.jpg

README.md

Image Processing

Image processing using Native Client. The goal of this project is to use the C++ OpenCV image processing library to do realtime image processing of the webcam feed.

Implementation

Rough plan for next few commits:

  • Hidden HTML5 video element sourced from navigator.getUserMedia (webcam).
  • Canvas element samples video every 20ms and draws on the canvas.
  • Send canvas image as ArrayBuffer to Native Client.
  • NaCl echoes image that has been received.
  • Javascript puts echoed image to processed canvas.
  • Start playing with OpenCV image processing.
  • Use strategy pattern on the C++ side to register new image processors.
  • Modify NaCl getVersion interface to return list of available processors.
  • Use returned list of processors to populate js list selector.
  • Get the Pulse Detection filter working.
  • Get the Detecting Barcodes demo working.
  • Simple cartoon filter.
  • Face detection.

Try it out! - you may need to clear the cache to see any updates. To do this open Chrome Developer Tools (Ctrl-Shift-i or F12), then click and hold Reload, choose "Empty Cache and Hard Reload" from the popup menu. Popup menu may only appear if you have a cached page i.e. have previously visited.

Build Setup

UPDATED: Please see setup.txt in parent directory for a step by step setup on a new Ubuntu server.

There are a few steps needed to configure in order to use OpenCV with NaCl. Fortunately, once you become aware of the existence of NaCl Ports they are fairly straight forward.

  1. Install Depo Tools.

  2. Check out the NaCl Ports.

  3. Follow the Install guide for SDL, replacing sdl with opencv and choosing pnacl as the architecture to build. Seems like the original instructions have been deleted, and didn't cover which branch to use in any event. cd to the dir where you've checked out nacl_ports (for me ~/Work/ExternCode/nacl_ports/src ) with depotools then change to the branch that matches NACL_SDK_ROOT

    git checkout pepper_40
    NACL_ARCH=pnacl make opencv

    The build itself took about 15 minutes on my Intel i3 dual core laptop.

  4. Add the opencv libraries and zlib to the build arguments:

    LDFLAGS := -L$(NACL_SDK_ROOT)/lib/pnacl/Release -lppapi_cpp -lppapi -lopencv_core -lz

Updating NaCl and NaCl Ports

NaCl updates on around the same release cycle as the Chrome browser. Chrome itself is backwards compatible but it's still a good idea to keep roughly up to date.

Here we assume that the NaCl SDK has been installed in NACL_ROOT (NACL_SDK_ROOT will be under this), and NaCl ports has been installed in PORTS_ROOT. On my machine these are ~/Work/ExternCode/nacl_sdk and ~/Work/ExternCode/nacl_ports respectively.

  1. Update NaCl SDK
    • cd NACL_ROOT
    • ./naclsdk update
  2. Update NACL_SDK_ROOT environment variable e.g. NACL_ROOT/pepper_41
  3. Update ports
    • cd PORTS_ROOT
    • cd src
    • git checkout -b pepper_41 origin/pepper_41
    • gclient sync
    • (If that fails, cd .. vim .gclient and set managed=False)

LICENSE

BSD