What is setNumThreads for?

There is this function: setNumThreads where “OpenCV will try to set the number of threads for the next parallel region.”

Can someone explain me this? First what “parallel region”? How can I mark a parallel region?
And second does this have anything to do with if I decided std::thread in my application? How will it impact (if any)

I read that generally this function should set it to the number of cores available. How does this impact performance?

A simple sample code would be handy too

opencv applies internal parallelization to speed up various functions, and setNumThreads() controls, how many threads to use for this (e.g. set it to 1 for debugging)

no, not at all, it’s for the internal library functions

there’s a tutorial with sample code

Great Thanks! I will read the tutorial and check the sample, to see how it impacts my application.

mm I read the tutorial and the code and it is more a tutorial on the use of parallel_for_ than setNumThreads which is only mentioned once. Interesting though, I am going to practice that this weekend.

Wondering if there is any other resource for setNumThreads