Module: centerRadiusCNN

Executive Summary

This module implements any convolutional neural for image processing. More precisely, the module uploads a trained model and reads it using the OpenCV library. This module is then used on an image in order to extract a radius and center.

Note

This module currently is set to only compile on a macOS system because of lack of testing ability on other platforms.

Module Assumptions and Limitations

The module’s assumptions are limited to the model it uploads. The training and performance of this module is not protected by this implementation. This assumption is seen in the pixelNoise variable where the user sets the performance of the net.

Message Connection Descriptions

The following table lists all the module input and output messages. The module msg variable name is set by the user from python. The msg type contains a link to the message structure definition, while the description provides information on what this message is used for.

Module I/O Messages

Msg Variable Name

Msg Type

Description

imageInMsgName

cameraImageMsg

Input image message. This message either comes from the camera module or the viz interface if no noise is added.

opnavCirclesOutMsgName

circlesOpNavMsg

Circle found in the image.

User Guide

The module is set easily using the path to the module and message names:

1
2
3
moduleConfig.opnavCirclesOutMsgName = "circles"
moduleConfig.pathToNetwork = path + "/../position_net2_trained_11-14.onnx"
moduleConfig.pixelNoise = [5,5,5]

class CenterRadiusCNN : public SysModel
#include <centerRadiusCNN.h>

The CNN based center radius visual tracking module.

Public Functions

CenterRadiusCNN()

The constructor for the CenterRadiusCNN module. It also sets some default values at its creation.

~CenterRadiusCNN()

This is the destructor

void UpdateState(uint64_t CurrentSimNanos)

This module reads an OpNav image and extracts circle information from its content using OpenCV’s HoughCircle Transform. It performs a greyscale, a bur, and a threshold on the image to facilitate circle-finding.

Return

void

Parameters
  • CurrentSimNanos: The clock time at which the function was called (nanoseconds)

void SelfInit()

Selfinit performs the first stage of initialization for this module. It’s primary function is to create messages that will be written to.

Return

void

void CrossInit()

CrossInit performs the second stage of initialization for this module. It’s primary function is to link the input messages that were created elsewhere.

Return

void

void Reset(uint64_t CurrentSimNanos)

This method performs a complete reset of the module. Local module variables that retain time varying states between function calls are reset to their default values.

Return

void

Parameters
  • CurrentSimNanos: The clock time at which the function was called (nanoseconds)

Public Members

std::string filename

Filename for module to read an image directly.

std::string opnavCirclesOutMsgName

The name of the CirclesOpnavMsg output message.

std::string imageInMsgName

The name of the ImageFswMsg output message.

std::string pathToNetwork

Path to the trained CNN.

uint64_t sensorTimeTag

[ns] Current time tag for sensor out

int32_t saveImages

[-] 1 to save images to file for debugging

double pixelNoise[3]

[-] Pixel Noise for the estimate

Private Members

uint64_t OutputBufferCount

[-] Count on the number of output message buffers

int32_t opnavCirclesOutMsgID

ID for the outgoing message.

int32_t imageInMsgID

ID for the outgoing message.

cv::dnn::Net positionNet2

Network for evaluation of centers.