Giter Club home page Giter Club logo

tinkervision's Introduction

tinkervision

Vision library for Tinkerforge RedBrick developed at FH-Bielefeld/Campus Minden. http://www.tinkerforge.com/de/doc/Hardware/Bricks/RED_Brick.html

Tinkervision consists of

  • a core component that manages camera input, conversion of frames between several supported formats, execution of external computer vision algorithms, and gives access to their results.
  • Some basic example cv-algorithms provided as modules that are loadable by the core component.

The library is intended to be loaded as part of the Tinkerforge red-brick-apid, though it can be used independently as well. However, the functionality and interface was designed for the former usage.

Requirements

The library is being developed and tested on Ubuntu 15.10, which comes with g++-4.9.2. Earlier versions of g++ may fail, though 4.8 might be fine. It is also tested to build and run on the target platform, the Tinkerforge Red Brick, which operates a version of Linux Sunxi, also with g++-4.9.2

Building and installing

The repository comes with a script to install required libraries and several Makefiles to build the core component, the modules and tests.

  1. Executing python install_required.py should install the missing libraries of the core component.
  2. make or DEBUG=1 make builds the library.
  3. make install installs necessary headers and the lib under /usr/include and /usr/lib.

Building the modules

There is a top-level makefile in src/modules which builds all modules, with the exception of the streamer module. This requires additional external libraries, which can be installed with a script found in this repository. Each module can also be build and installed individually with the corresponding makefile. To build and install all:

  1. cd src/modules
  2. make && sudo make install
  3. cd streamer
  4. sudo python install_required.py
  5. make && sudo make install

Usage

The library provides a C-interface, which can be used directly, as demonstrated in the test files in src/test/. However, it is intended to be run as part of the Tinkerforge red-brick-apid on the Tinkerforge Red-Brick. Currently, the supported image is 1.7.

Usage on the Tinkerforge Red-Brick

To use the library, an extended version of the red-brick-apid is needed. On the Red Brick:

  1. mkdir /home/tf/Software && cd /home/tf/Software
  2. git clone https://github.com/philkroos/tinkervision
  3. git clone https://github.com/philkroos/red-brick-apid

Build and install Tinkervision and the provided modules, as described above. To build the custom version of red-brick-apid:

  1. cd /home/tf/Software/red-brick-apid
  2. git checkout tinkervision && cd src
  3. WITH_VISION=yes python build_pkg.py
  4. sudo dpkg -i redapid-2.0.2+vision_armhf.deb

The next step is to test the library bindings. This repository comes with some scripts which call into the generated Python-API. In general, all languages supported by Tinkerforge should work, but only the Python bindings have been tested yet for Tinkervision. In any case, it should work both directly on the Red-Brick and on a PC which can access the device:

  1. mkdir /home/tf/TinkervisionTest
  2. cd /home/tf/TinkervisionTest
  3. git clone https://github.com/philkroos/tinkervision
  4. git clone https://github.com/philkroos/generators
  5. cd generators && git checkout tinkervision
  6. mkdir /home/tf/Tinkervision/Test/tinkervision/src/test/red-brick/scripts/tinkerforge
  7. cd python && WITH_TINKERVISION=1 python generate_python_bindings.py
  8. cp ip_connection bindings/brick_red.py /home/tf/TinkervisionTest/tinkervision/src/test/red-brick/scripts/tinkerforge
  9. cd /home/tf/TinkervisionTest/tinkervision/src/test/red-brick/scripts
  10. touch tinkerforge/__init__.py

Then you should be able to execute the scripts, but you need the UID of your Red-Brick, which can be found e.g. with the Tinkerforge brickv. main.py and rb_setup.py are utilities. The other files are tests which can be executed like:

  • ./main.py <uid> colormotion

If execution fails there may be another instance of ip_connection or brick_red.py in the system, probably from an installation of brickv. The easiest solution would be to remove all system-wide installed tinkerforge packages then, as well as the egg from Pythons site-packages.

Note

The library searches for loadable modules in two paths:

  1. /usr/lib/tinkervision is fixed
  2. The subdirectory lib in a custom path, which is configured at compile time:
    • USER_PREFIX=/home/me/vision/ make The default prefix is /home/<current-user>/tv/. The makefile tries to create a valid directory structure.

The provided modules will be installed to the system folder by default, but if PRE is set during make install, they'll be installed to the user folder: PRE=~/tv/lib make install installs the module to the pre-configured library path.

tinkervision's People

Contributors

philkroos avatar

Watchers

 avatar

Forkers

loremipsum1988

tinkervision's Issues

Allow setting a framerate.

  • Replace the set_execution_latency with sth. like set_execution_rate(rate).

Grab a frame only if at least 'rate' ms have passed since the last grabbing.

Fix V4L2Camera

See b1ae35a.
In test/stream, 'libv4l2: error dequeuing buf: Resource temporarily unavailable' is thrown after a few seconds. This also happened in other tests (e.g. gesture), so no relation to stream.

Remove the need for sleep after calling certain api-functions.

This is e.g. due to the asynchronous initialization method which returns id's for modules not yet persisted in the execution loop.
Probably the handling of allocated/managed modules has to be reworked. How can the excessive locking be avoided? Synchronicity? Ringbuffer?

Add complete Demos.

E.g. reimplement the balltracking thing and check for the motiontracking/streaming app.
Also some smaller modules like snapshotting and filtering, all using multiple language bindings if possible.

Crash when calling quit.

Actually this happens when the application terminates after having called quit already. Commit dev:b8804f6, test colormatch.

Break the current modules down into smaller modules.

Colortracking: Maybe split into color finding module and filter, limiting the resultset.
Motiontracking: Same
Streamer: Split into conversion and streaming? Possible?

In general, focus on smaller parts and let these be composed into larger modules in form of scenes.

Implement a Plugin-API.

The whole software currently leans to be extended to a Pluginsystem. This would limit the possible interfaces, i.e. some standard methods would have to be defined aka set_parameter(name : string, value : double). That should be doable and still be usable in the context of the TF-API-generators. It should also be possible to use a similar approach to allow modules aka plugins to be written in other languages - provided an according wrapperplugin is available. This could be generated by adopting the TF-generators software?

Add method to "get_result_when_available"

Corner case?: When adding a module and immediately requesting the result, this can fail because the module has not been given time to be executed yet. See current test for the Snapshot module.

Basic (Python?) testframework

A test unit to check the basic functionality continually, i.e. using ctypes, check for stability and consistency in the functionality promised by the api functions and the returned error messages.

E.g.
start() # -> 505 if no module loaded
preselect_framesize(0, 0) # -> 0, currently, to be improved; but:
start_idle() # -> 550, given the wrong settings above.

And so on.

More thorough documentation.

In particular, differentiate between public API and internal; mark experimental features as such on both sides.

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.