Skip to content

a vision service classifier that can be used to filter on camera stream from large bodies of water

License

Notifications You must be signed in to change notification settings

viamrobotics/ocean-prefilter

Repository files navigation

This module implements the rdk:service:vision API in an ocean-prefilter model for your machine to find objects of interest in large bodies of water.

When you configure a machine with this module, the module:

  • Locates the horizon, crops the image to only include the water, and then divides the water into patches.
  • Turns the resulting patches into histograms, which it interprets as probability distrubutions for their color/intensity values.
  • Conducts a Kolmogorov-Smirnov test on the histograms from before and after images and determines if the scenes are consistent or if a new element has appeared.

Strong motion of the waves or bobbing up-and-down of the boat can trigger the pre-filter. This vision service only returns one label classification called TRIGGER with a confidence of 1.0.

Requirements

To compile this module yourself, follow these steps on your Raspberry Pi:

  1. Download and install openCV
  2. Install the following necessary libraries:
sudo apt-get install libjpeg-dev

git clone https://github.com/hybridgroup/gocv.git
cd gocv
sudo make install_raspi # or just sudo make install

git clone https://github.com/viamrobotics/ocean-prefilter
make ocean-prefilter

Configure your ocean-prefilter vision service

Note

Before configuring your vision service, you must create a machine.

Navigate to the CONFIGURE tab of your machine's page in the Viam app. Click the + icon next to your machine part in the left-hand menu and select Service. Select the vision type, then search for and select the ocean-prefilter model. Click Add module, then enter a name or use the suggested name for your service and click Create.

Click the {} (Switch to Advanced) button in the top right of the service panel to edit the service's attributes directly with JSON. Copy and paste the following attribute template into your vision service's attributes field:

  {
      "camera_name": "my_cam",
      "threshold": 0.25,
      "max_frequency_hz": 5,
      "excluded_region": [xmin, ymin, xmax, ymax]
  }

Note

For more information, see Configure a Machine.

Attributes

Name Type Inclusion Description Value
camera_name string Required Links the pre-filter to a specific camera and continuously monitors the camera stream for changes or triggers in the background. The name of your camera component.
threshold int Optional Determines the sensitivity of the pre-filter trigger. This enables the pre-filter to detect significant motion such as boat or wave movements, and identifies objects like other boats, buoys, or any deviations from typical water patterns. 0 to 1
Default: 0.25
max_frequency_hz int Optional Determines the frequency that the vision service monitors the background camera stream for changes. If your scene changes very slowly set this below 1. 1 to 10
Default: 10
excluded_region object Optional Specifies areas within the cameras view to ignore. This is useful for excluding static parts of the camera stream, like parts of the boat. A list of coordinates in frame.

About

a vision service classifier that can be used to filter on camera stream from large bodies of water

Resources

License

Stars

Watchers

Forks

Packages