Java Multi threads with OpenCV 3.3.1

asked 2017-11-29 06:00:35 -0500

arigarcia gravatar image


I have a process for calculate the quantity of colors by width and build a histogram. Work fine!!

When I put this process in 50, 100 or 200 threads, it crash (block) in:

 double[] values = mat.get(w,c)

This statment corresponds to native code following:


If that code will syncronized, it will work fine again!!

How can I solve this problem without synchronization?

edit retag flag offensive close merge delete


you probably should not use anything like mat.get(w,c) at all in your code, this is really slow.

rather use calcHist , than doing your own, slow iterations.

writing slow code, and then trying to multithread it is a bad idea...

berak gravatar imageberak ( 2017-11-29 07:03:05 -0500 )edit