OpenCV Crash when processing in paralelle

asked 2015-06-09 05:08:01 -0500


I use OpenCV (2.4.10) for the detection of the face and eyes in an image.

The treatment is going very well with sequential calls but we begin to make calls in parallel was a crash at the lib (trace PJ).

The concern occurs on linux like wiondows.

Can someone tell me if the lib supports parallelism?

If this is the case, what may come my error ?


edit retag flag offensive close merge delete


I can't read your tiff... anyway what do you mean for parallel calls ? threads, parallel for, ... please provide your code simplified

pklab gravatar imagepklab ( 2015-06-09 06:30:24 -0500 )edit

OpenCV works very well in parallel processing, except with anything related to GUI management ... are you calling "cv::imshow" and "cv::waitKey" in multiple threads ? If so, you should refrain to use such functions in only one thread.

R.Saracchini gravatar imageR.Saracchini ( 2015-06-09 07:24:55 -0500 )edit

private void validateFace(Mat matImage) throws URISyntaxException, WrongFaceException, IOException { int faces = openCvService.detectFace(matImage); if(faces != 1){ throw new WrongFaceException(); }

khalifa gravatar imagekhalifa ( 2015-06-09 07:59:05 -0500 )edit

public int detectFace(Mat matImage) throws URISyntaxException, WrongFaceException, IOException { URL urlCascadeFace = OpenCvService.class.getResource(DETECT_FACE_XML); CascadeClassifier visageDetector = new CascadeClassifier(Paths.get(urlCascadeFace.toURI()).toFile().getPath()); MatOfRect faceDetections = new MatOfRect(); Mat matrice = matImage.clone(); //Detection du visage visageDetector.detectMultiScale(matrice, faceDetections); if (faceDetections.toArray().length > 0) { return faceDetections.toArray().length; } else { throw new WrongFaceException(); } }

khalifa gravatar imagekhalifa ( 2015-06-09 08:01:13 -0500 )edit

Parallel calls: simultaneous calls in in perfoormance test

I use OpenCV in a java program

Load library System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

//Conversion image en BufferedImage InputStream inputStreamImage = new ByteArrayInputStream(bytesImageResize); BufferedImage bImageFromConvert =;

        Mat matImage = retourneByteToMat(bytesImageResize);
khalifa gravatar imagekhalifa ( 2015-06-09 08:21:50 -0500 )edit

did you mean parallel processes (many execution of your executable) ? please edit your question explain it, describe the context providing us yhe error messages and use code formatting.

pklab gravatar imagepklab ( 2015-06-09 13:13:11 -0500 )edit