Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Celebrating as our community reaches 100,000 members! Thank you!
Labels (1)
avatar
Master Guru

Open Source Computer Vision with TensorFlow, Apache MiniFi, Apache NiFi, OpenCV, Apache Tika and Pyt...

In preparation for this talk, I am releasing some articles detailing how to work with images. In this one I use my custom Web Camera processor to ingest web camera images via Apache NiFi on an OSX laptop equipped with two webcameras.

This will let you ingest as many images as you need for security, motion detection or fun.

Custom Processor:

https://github.com/tspannhw/GetWebCamera

My processor is a thin wrapper on an awesome Java library: http://webcam-capture.sarxos.pl/

See: https://github.com/sarxos/webcam-capture/blob/master/webcam-capture/src/example/java/TakePictureExam...

To use the processor, you can clone my github project or download the prebuilt NAR and install to your nifi/lib directory and restart your NiFi server.

It is easy to use. Add the processor to your workflow at the start to ingest images from your webcam.

64898-getcamaddp.png

The processor takes two properties: imagefilename and camername. The Imagefilename is the name you want the newly created image to be. The cameraname is the name of the camera if you have more than one. You can put in a partial name to match. For my OSX machine, I have the built-in one and one in my display. When I am working in locked mode I want it to grab the Display version so I enter the text Display.

64897-getcamproperties.png

When combining with the custom TensorFlow processor it's really nice workflow.

https://community.hortonworks.com/articles/178498/integrating-tensorflow-16-image-labelling-with-hdf...

64902-tensorflowplusimage.png

64903-visionthingwebflow.png

The Easiest Java 8 Code Ever. Wrap Any Of Your Java Goodness and make it a processor today!

64899-webcamcodesnippet.png

Even easier to test. When you use the maven archetype it builds the full directory, a valid empty processor and a unit test.

64900-webcamunittest.png

Apache NiFi builds the documentation for me. Add some comments in your code and blammo.

64901-getwebcamdocs.png

Another awesome option is to use the MiniFi C++ Agent https://github.com/apache/nifi-minifi-cpp/blob/master/PROCESSORS.md#getusbcamera to ingest your webcam images.

Example Image

64904-webcamimage.png

Installable Release

https://github.com/tspannhw/GetWebCamera/releases/tag/1.0

References

2,608 Views