Thibaut Mattio
Thibaut Mattio

Reputation: 832

Does TBB support OpenCV types?

I am building an image processing pipeline using OpenCV3 and TBB. When passing the image in a flow graph, it is being altered.

Here is a sample result of the image when passing through a inverse filter:

enter image description here

enter image description here

I wrote a unit test that passes images through a graph and compare the output to the original image:

https://gist.github.com/des0ps/74528673d271e3131c2ea2a2adaf5c8c

This test sometimes passes, and sometimes doesn't.

What is happening here and generally speaking, are cv::Mat supported by TBB?

Upvotes: 0

Views: 243

Answers (1)

Aleksei Fedotov
Aleksei Fedotov

Reputation: 404

It seems that the test does not ensure that images being checked are corresponding images, i.e. the left image has the same sequence number as the right one. This is possible since there are no restrictions on how fast threads pass the images through the graph. Try to use 'key_matching' buffering policy for join_node.

By the way, TBB is a template library. It means that its structures and algorithms could be instantiated with any type specified as an argument for a template parameter (of course if that type satisfies requirements of the structure/algorithm in question). For example, source_node requires that its output type be DefaultConstructible, that is its instances are created by calling class default constructor. Such requirements are automatically checked by compiler.

Upvotes: 3

Related Questions