我正在运行Ubuntu 14.04.我试图用openCV 3运行FLANN,但是我收到错误.
通过使用AKAZE和ORB尝试下面的所有内容,但是从我尝试使用ORB的代码.
我使用ORB来查找描述符和关键点.
Ptr<ORB> detector = ORB::create();
std::vector<KeyPoint> keypoints_1, keypoints_2;
Mat descriptors_1, descriptors_2;
detector->detectAndCompute( img_1, noArray(), keypoints_1, descriptors_1 );
detector->detectAndCompute( img_2, noArray(), keypoints_2, descriptors_2 );
Run Code Online (Sandbox Code Playgroud)
使用ORB后,我使用以下代码查找匹配项:
FlannBasedMatcher matcher;
std::vector<DMatch> matches;
matcher.match(descriptors_1, descriptors_2, matches);
Run Code Online (Sandbox Code Playgroud)
代码构建良好和一切.当我运行代码时,我收到此错误:
OpenCV Error: Unsupported format or combination of formats (type=0
) in buildIndex_, file /home/jim/opencv/modules/flann/src/miniflann.cpp, line 315
terminate called after throwing an instance of 'cv::Exception'
what(): /home/jim/opencv/modules/flann/src/miniflann.cpp:315: error: (-210) type=0
in function buildIndex_
Aborted (core dumped)
Run Code Online (Sandbox Code Playgroud)
谁能告诉我为什么?这是OpenCV 3处于BETA状态的问题吗?是否有替代FLANN(BFMatcher除外)
先上代码:
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main( int argc, char** argv )
{
Mat image;
image = imread( "MyPic.jpg", CV_LOAD_IMAGE_GRAYSCALE );
if( !image.data )
{
printf( "No image data \n" );
return -1;
}
namedWindow( "Display Image", CV_WINDOW_AUTOSIZE);
imshow( "Display Image", image );
waitKey(0);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
一个简单的程序,它只加载一个名为 "MyPic.jpg" 的图像,这是我在开放的 CV 网站文档中找到的一个例子(有一些小的变化)。它给了我这两个错误:
‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope
‘CV_WINDOW_AUTOSIZE’ was not declared in this scope
Run Code Online (Sandbox Code Playgroud)
为什么它不起作用?怎么了?
所以我知道这个问题之前已经完成,但大部分时间它仍然是在OpenNI和Libfreenect被淘汰的时候.我的问题是:
1)我想知道现在的状态.2)这两者之间的差异(优点,缺点和其他)3)特别是对于骨架跟踪,这是更好的并提供更多关于骨架的数据(例如在Microsoft SDK中它们为20个关节提供数据,它是否相同这两个,更多,更少?)
我知道这个问题已经被问过很多次了,但我仍然被困住了。我以为我明白了这个错误的含义,但显然我没有明白。
所以,我得到的错误是
a nonstatic member reference must be relative to a specific object
Run Code Online (Sandbox Code Playgroud)
我的代码是:
class theTranslator {
public:
ros::NodeHandle nh;
ros::Publisher pub = nh.advertise<sensor_msgs::Image>("camera/depth/image_raw", 100);
static void getMessage(const sensor_msgs::Image::ConstPtr& recMmsg) {
ROS_INFO( "I heard message" );
pub.publish(recMmsg); //*** ERROR IS HERE ***
}
};
Run Code Online (Sandbox Code Playgroud)
既然pub与 属于同一类getMessage(),那么它不应该起作用吗?如何使static成员函数使用同一类的变量成员?
PS这是在ROS(机器人操作系统)中完成的,但我相信这是一个C++错误(与ROS无关)。
我看到一些代码有括号,没有""if或"for"或"do"或任何东西,只有评论.
像这样
//一些评论
{
int a = 5;
//和更多代码
}
这是什么?
注意:我注意到在使用我的IDE(代码:: blocks)时,左边有" - ",当你单击它时,它会隐藏括号中的所有代码.这是括号中唯一没有声明的用法吗?