SDK ML Utils

class Metavision::HOGDescriptor

Class wrapping the OpenCV HogDescriptor module. It implements a border coping mechanism as well.

Public Functions

inline HOGDescriptor(const cv::Size &windowSize, const cv::Size &blocksize, const cv::Size &blockstride, const cv::Size &cellsize, int nbins)

Construct an HOGDescriptor object.

Parameters
  • windowSize – Size of the area to compute the HOG on.

  • blocksize – Size of the individual block to compute the HOG (corresponds to squares, e.g. a value of 16 uses 16x16 squares).

  • blockstride – Space between two consecutive blocks. Using this parameter as less as the blocksize one could compute on overlapping blocks for instance.

  • cellsize – Size of the cells to compute gradient on. Must be less than blocksize.

  • nbins – Number of orientations chosen to discretize the HOG.

inline void compute_description(const cv::Mat &img_to_describe, const cv::Rect &roi, std::vector<float> &descriptor)

Computes a Histogram Of Gradient (HOG)

Parameters
  • img_to_describe[in] Image representing the scene

  • roi[in] Region Of Interest where the object is

  • descriptor[out] Description of the object

struct Metavision::ProducerConsumerSynchronization

Synchronizes one producer with a consumer.

The producer checks if the consumer is ready (previous work is finished), it prepares the data for the consumer, and signals the consumer.

On its side, the consumer waits for data to be computed and applies a function as soon as the data is ready

Public Functions

inline ProducerConsumerSynchronization()

Creates a ProducerConsumerSynchronization object.

inline void data_is_ready()

Sets data available for the consumer.

Warning

This function should be called by the producer only

inline void producer_wait(std::atomic<bool> &done)

Waits for the consumer to be ready (should be called only by the producer)

Parameters

done – Boolean to release the condition. If done become True, the producer exits the function

template<typename L>
inline void consumer_wait(std::atomic<bool> &done, L &&lambda_function)

Waits for data to be computed.

Parameters
  • done – Boolean to release the condition. If done become True, the producer exits the function

  • lambda_function – Function to be called on data provided by the producer

inline void notify()

Notifies either producer or consumer to wake it up.

inline cv::Mat Metavision::RectTools::subwindow(const cv::Mat &in, const cv::Rect &window, int borderType = cv::BORDER_CONSTANT)

Extracts a copy of the subimage and adds border if parts of the subimage are missing.

Parameters
  • in – Input image from which the subimage is extracted

  • window – Description of the subimage bounds

  • borderType – Method to generate the borders

Returns

A copy of the subimage with its borders if required

Warning

doxygenfunction: Cannot find function “Metavision::Utils::intersection” in doxygen xml output for project “SDKml” from directory: /data/work/_build/generated/doc_build/ml/doxygen/xml

Warning

doxygenfunction: Cannot find function “Metavision::Utils::intersection_over_union” in doxygen xml output for project “SDKml” from directory: /data/work/_build/generated/doc_build/ml/doxygen/xml

Warning

doxygenfunction: Cannot find function “Metavision::Utils::compute_similarity_iou_using_classid” in doxygen xml output for project “SDKml” from directory: /data/work/_build/generated/doc_build/ml/doxygen/xml

Warning

doxygenfunction: Cannot find function “Metavision::Utils::compute_similarity_iou_using_classid_and_similarity_matrix” in doxygen xml output for project “SDKml” from directory: /data/work/_build/generated/doc_build/ml/doxygen/xml