TransWikia.com

Ошибка в opencv крашит java приложение

Stack Overflow на русском Asked on September 12, 2020

Ошибка:

# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f8cc6bfeeae, pid=6, tid=105
#
# JRE version: OpenJDK Runtime Environment (11.0.7+10) (build 11.0.7+10-post-Ubuntu-2ubuntu218.04)
# Java VM: OpenJDK 64-Bit Server VM (11.0.7+10-post-Ubuntu-2ubuntu218.04, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C [libc.so.6+0x94eae][thread 34 also had an error]

Код

                Mat fake = fakes.get(x);
                int retVal = 0;
                MatOfKeyPoint keypoints1 = new MatOfKeyPoint();
                MatOfKeyPoint keypoints2 = new MatOfKeyPoint();
                Mat descriptors1 = new Mat();
                Mat descriptors2 = new Mat();
                detector.detectAndCompute(sourceNewImage, new Mat(), keypoints1, descriptors1);
                detector.detectAndCompute(fake, new Mat(), keypoints2, descriptors2);
                MatOfDMatch matches = new MatOfDMatch();
                matcher.match(descriptors1, descriptors2, matches);
                if (descriptors2.cols() == descriptors1.cols()) {
                    DMatch[] match = matches.toArray();
                    double maxDist = 0;
                    double minDist = 100;
                    for (int i = 0; i < descriptors1.rows(); i++) {
                        double dist = match[i].distance;
                        if (dist < minDist) minDist = dist;
                        if (dist > maxDist) maxDist = dist;
                    }
                    for (int i = 0; i < descriptors1.rows(); i++) {
                        if (match[i].distance <= 5) {
                            retVal++;
                        }
                    }
                }

Как мне кажется,при высокой нагрузке эта часть кода начинает использовать очень много ресурсов и крашит приложение. Никаких ошибок catch (Exception e) поймать не получается. В чем может быть проблема?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP