Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在c+;中调用Hough变换时出现OpenCV未指定错误+;_Android_C++_Opencv_Hough Transform_Unspecified - Fatal编程技术网

Android 在c+;中调用Hough变换时出现OpenCV未指定错误+;

Android 在c+;中调用Hough变换时出现OpenCV未指定错误+;,android,c++,opencv,hough-transform,unspecified,Android,C++,Opencv,Hough Transform,Unspecified,我正在开发一个音乐识别Android应用程序,它应该能够使用摄像头实时识别音乐表中的音乐注释 当我尝试使用Hough变换(HoughCircles或HoughLinesP)识别直线或圆时,会出现未指定的错误: E/cv::error(): OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If

我正在开发一个音乐识别Android应用程序,它应该能够使用摄像头实时识别音乐表中的音乐注释

当我尝试使用Hough变换(HoughCircles或HoughLinesP)识别直线或圆时,会出现未指定的错误:

E/cv::error(): OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvWaitKey, file /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/highgui/src/window.cpp, line 567
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 7772 (Thread-411)
我可以尝试另一个版本的OpenCV,但我没有足够的时间来改变一切。我也不熟悉OpenCV,这是我第一次使用它。可能问题是C++文件或报头。< /P> C++文件:

#include "com_ryu_musicreader_OpencvClass.h"

JNIEXPORT void JNICALL Java_com_ryu_musicreader_OpencvClass_musicDetection
(JNIEnv *, jclass, jlong addrRgba){
Mat& frame = *(Mat*)addrRgba;

find_lines(frame);
find_circles(frame);
}

void find_lines(Mat& src){

Mat dst, cdst;
Canny(src, dst, 50, 200, 3);

cvtColor(dst, cdst, COLOR_GRAY2BGR);

vector<Vec4i> lines;
HoughLinesP(dst, lines, 1, CV_PI/180, 50, 50, 10 );

for( size_t i = 0; i < lines.size(); i++ )
{
    Vec4i l = lines[i];
    line( cdst, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0,0,255), 3, 0);
}

imshow("detected lines", cdst);

}

int find_circles(Mat& src){

Mat src_gray;

cvtColor(src, src_gray, COLOR_BGR2GRAY);

GaussianBlur( src_gray, src_gray, Size(9, 9), 2, 2 );

vector<Vec3f> circles;

HoughCircles( src_gray, circles, CV_HOUGH_GRADIENT, 1, src_gray.rows/8, 200, 100, 0, 0 );

for( size_t i = 0; i < circles.size(); i++ )
{
    Point center(cvRound(circles[i][0]), cvRound(circles[i][1]));
    int radius = cvRound(circles[i][2]);
    circle( src, center, 3, Scalar(0,255,0), -1, 8, 0 );
    circle( src, center, radius, Scalar(0,0,255), 3, 8, 0 );
}

namedWindow( "Hough Circle Transform Demo", CV_WINDOW_AUTOSIZE );    
imshow( "Hough Circle Transform Demo", src );

waitKey(0);
return 0;

}
#包括“com_ryu_musicreader_OpencvClass.h”
JNIEXPORT void JNICALL Java\u com\u ryu\u musicreader\u OpencvClass\u musicDetection
(JNINEV*,jclass,jlong addrRgba){
材料和框架=*(材料*)添加RRGBA;
查找_线(帧);
找到_圆(框架);
}
无效查找线(Mat和src){
Mat-dst,cdst;
Canny(src、dst、50、200、3);
CVT颜色(dst、cdst、COLOR_GRY 2BGR);
矢量线;
HoughLinesP(dst、测线1、CV_PI/180、50、50、10);
对于(size_t i=0;i
头文件:

#include <jni.h>
#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>

using namespace cv;
#ifndef _Included_com_ryu_musicreader_OpencvClass
#define _Included_com_ryu_musicreader_OpencvClass
#ifdef __cplusplus
extern "C" {
#endif
void detect(Mat& frame);

void find_lines(Mat& frame);

int find_circles(Mat& frame);

JNIEXPORT void JNICALL Java_com_ryu_musicreader_OpencvClass_musicDetection
(JNIEnv *, jclass, jlong);

#ifdef __cplusplus
}
#endif
#endif
#包括
#包括“opencv2/opencv.hpp”
#包括“opencv2/highgui/highgui.hpp”
#包括“opencv2/imgproc/imgproc.hpp”
#包括
使用名称空间cv;
#ifndef包括了音乐播音员课程
#定义\u包含\u com\u ryu\u音乐阅读器\u OpencvClass
#ifdef_uucplusplus
外部“C”{
#恩迪夫
空隙检测(垫和框架);
无效查找线(垫和框架);
int find_圆(垫和框架);
JNIEXPORT void JNICALL Java\u com\u ryu\u musicreader\u OpencvClass\u musicDetection
(JNIEnv*,jclass,jlong);
#ifdef_uucplusplus
}
#恩迪夫
#恩迪夫
代码很可能有问题,因为我不完全确定Hough变换是如何工作的,所以我尝试使用我在网上找到的一些实现


我真的很感激任何帮助。

我发现我很愚蠢。我不知道这个实现是为了桌面目的,我试着在Android上使用它。我真的应该阅读我正在使用的库中的所有文档。

错误在于
imshow
,而不是hough变换。使用Windows、GTK+2.x或碳纤维支架重建库。如果您在Ubuntu或Debian上,请安装libgtk2.0-dev和pkg-config,然后重新运行cmake或configure脚本)我试图注释除Hough transform函数之外的所有内容,但该函数仍然会崩溃。重建,我对Android不是很有信心(除了编码),我不知道如何用这些参数重建,我有点害怕这样做。有什么简单的指导或建议吗?