SDK ML Utils

class HOGDescriptor
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