假设我有一个灰度(8 位)图像并假设我有一个从同一图像创建的完整图像。图像分辨率为720x576. 根据 SURF 算法,每个八度音阶由 4 个盒式滤波器组成,它们由它们一侧的像素数定义。
第一个八度使用带有9x9, 15x15, 21x21 and 27x27像素的过滤器。
第二个八度使用带15x15, 27x27, 39x39 and 51x51像素的过滤器。
第三个八度使用带27x27, 51x51, 75x75 and 99x99像素的过滤器。如果图像足够大并且我猜720x576 足够大(对吗??!!),则添加第四个八度音程,51x51, 99x99, 147x147 and 195x195. 这些八度音程彼此部分重叠以提高插值结果的质量。
// so, we have:
//
// 9x9 15x15 21x21 27x27
// 15x15 27x27 39x39 51x51
// 27x27 51x51 75x75 99x99
// 51x51 99x99 147x147 195x195
Run Code Online (Sandbox Code Playgroud)
问题是:每个过滤器中的值是
什么?我应该对这些值进行硬编码,还是应该计算它们?
如何准确地(在数字上)将过滤器应用于积分图像?
此外,计算黑森州行列式我发现了两个近似:
det(HessianApprox) = DxxDyy ? (0.9Dxy)^2和det(HessianApprox) = DxxDyy …
我正在使用SURF/FLANN探测器,我正在寻找将图像,点,描述符保存到文件中,这样我就可以比较这个图像,然后将它指向第二个图像并指向我但是当我得到以下错误时试着写:
In file included from detectFlannPoints.cpp:4:0:
/usr/local/include/opencv2/features2d/features2d.hpp:112:17: note: void cv::write(cv::FileStorage&, const string&, const std::vector<cv::KeyPoint>&)
/usr/local/include/opencv2/features2d/features2d.hpp:112:17: note: candidate expects 3 arguments, 4 provided
Run Code Online (Sandbox Code Playgroud)
这是我用来编写的代码:
FileStorage fs("Keypoints.yml", FileStorage::WRITE);
write(fs, "templateImageOne", keypoints_1, tempDescriptors_1);
fs.release();
Run Code Online (Sandbox Code Playgroud)
我不确定在哪里可以指定额外的参数(tempDescriptors_1),因为它可以正常删除这个arg.
代码立即高于写代码:
//Detect the keypoints using SURF Detector
int minHessian = 400;
SurfFeatureDetector detector( minHessian );
std::vector<KeyPoint> keypoints_1;
detector.detect( img_1, keypoints_1 );
//-- Step 2: Calculate descriptors (feature vectors)
SurfDescriptorExtractor extractor;
Mat tempDescriptors_1;
extractor.compute( img_1, keypoints_1, tempDescriptors_1 );
//-- Draw keypoints
Mat img_keypoints_1;
drawKeypoints( img_1, keypoints_1, img_keypoints_1, …Run Code Online (Sandbox Code Playgroud) 这是gpu冲浪代码:
#include <iostream>
#include <iomanip>
#include "opencv2/contrib/contrib.hpp"
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <opencv2/imgproc/imgproc_c.h>
#include "opencv2/gpu/gpu.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
using namespace std;
using namespace cv;
using namespace cv::gpu;
void help()
{
cout << "\nThis program demonstrates using SURF_GPU features detector, descriptor extractor and BruteForceMatcher_GPU" << endl;
cout << "\nUsage:\n\tmatcher_simple_gpu <image1> <image2>" << endl;
}
int main(int argc, char* argv[])
{
GpuMat img1(imread("C:\\OpenCV2.3\\opencv2.3\\bin\\Debug\\tsucuba_left.png", CV_LOAD_IMAGE_GRAYSCALE));
SURF_GPU surf;
// detecting keypoints & computing descriptors
GpuMat keypoints1GPU, keypoints2GPU;
GpuMat descriptors1GPU, descriptors2GPU;
surf(img1, …Run Code Online (Sandbox Code Playgroud) 我需要在objc iOS中实现SURF算法.我搜索了openCV,并尝试实现以下示例
这些例子不起作用,我需要让它们中的任何一个工作,所以至少我可以放心,是的,SURF也可以在iOS上运行.我试图从头开始构建,但我完全融入了短路.
我试图在jonmarimba的例子中使用openCV 2.4.2.
并尝试使用X5 4.3的iOS5.1.1
我正在尝试使用OpenCV进行对象检测作业.但有些东西让我感到困惑.像camshift和kalman滤波器这样的跟踪和预测算法可以完成跟踪任务,而SURF匹配方法也可以做到这一点.
我不太明白这两种方法之间的区别.我已经完成了一些基于feature2d(使用了SURF)和OpenCV教程的motion_analysis_and_object_tracking(使用camshift)的编码.看起来他们只是一个目的的两种手段.我是对的还是我错过了一些概念?
将camshift跟踪与SURF特征匹配相结合是一种好方法吗?也许可以应用更多的东西,比如轮廓匹配?
opencv object-detection surf feature-detection video-tracking
我正在通过特征检测算法,很多事情似乎都不清楚.对于图像处理的初学者来说,原始论文很难理解.如果这些得到回答,我们将很高兴
这些问题可能看起来太微不足道了,但请帮助..
我的错误代码是:
错误LNK2019:函数_main中引用的未解析的外部符号"public:__thiscall cv :: SURF :: SURF(double,int,int,bool,bool)"(?? 0SURF @ cv @@ QAE @ NHH_N0 @ Z)
我不知道如何解决它.
我的代码是:
#include <opencv\cv.h>
#include <opencv\highgui.h>
#include <iostream>
#include <conio.h>
#include <opencv2\nonfree\features2d.hpp>
#include <opencv2\legacy\legacy.hpp>
#include <opencv2\core\core.hpp>
#include <stdio.h>
using namespace cv;
using namespace std;
int main()
{
Mat img_1 = imread("kmu1.jpg", CV_LOAD_IMAGE_GRAYSCALE);
Mat img_2 = imread("all.jpg", CV_LOAD_IMAGE_GRAYSCALE);
if(!img_1.data || !img_2.data)
{
cout << "could not open or find the image" << endl;
return -1;
}
int minHessian = 400;
SURF surf( …Run Code Online (Sandbox Code Playgroud) 我是OpenCV的新手.我正试图在iOS上的OpenCV中使用FLANN/SURF在图像之间绘制功能匹配.我正在关注这个例子:
这是我的代码,稍加一些修改(将示例中的代码包装在一个函数中,该函数返回一个UIImage作为结果并从bundle中读取起始图像):
UIImage* SURFRecognition::test()
{
UIImage *img1 = [UIImage imageNamed:@"wallet"];
UIImage *img2 = [UIImage imageNamed:@"wallet2"];
Mat img_1;
Mat img_2;
UIImageToMat(img1, img_1);
UIImageToMat(img2, img_2);
if( !img_1.data || !img_2.data )
{
std::cout<< " --(!) Error reading images " << std::endl;
}
//-- Step 1: Detect the keypoints using SURF Detector
int minHessian = 400;
SurfFeatureDetector detector( minHessian );
std::vector<KeyPoint> keypoints_1, keypoints_2;
detector.detect( img_1, keypoints_1 );
detector.detect( img_2, keypoints_2 );
//-- Step 2: Calculate descriptors (feature vectors)
SurfDescriptorExtractor extractor;
Mat descriptors_1, descriptors_2; …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 SIFT 和 SURF。
在我的笔记本电脑上,我有 OpenCV 版本 = 4.5.1.48,还添加了版本 4.5.1.48 的 OpenCV-contrib-python
我在遵循文档后收到错误 SIFT 在遵循文档后完美工作,但 SURF 不起作用并给我错误以下代码
代码1
surf = cv.xfeatures2d.SURF_create()
AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d'
Run Code Online (Sandbox Code Playgroud)
代码2
surf = cv2.SURF_create()
AttributeError: module 'cv2.cv2' has no attribute 'SURF_create'
Run Code Online (Sandbox Code Playgroud)
在阅读了 Stack Overflow 上的许多答案后,我更改了 OpenCV 的版本并做了很多事情,但没有任何效果对我有用
我也读到专利即将到期,但在我的案例中没有任何效果,请告诉我我是否在某个地方错了
我试图通过为每个帧调用SURF函数来在视频中找到一个对象...这是SURF函数{
void Identify_SURF_Frame (Mat img_object , Mat img_scene , CvRect in_box)
{
//-- Step 1: Detect the keypoints using SURF Detector
int minHessian = 1;
SurfFeatureDetector detector( minHessian , 15 , 3 );
std::vector<KeyPoint> keypoints_object, keypoints_scene;
detector.detect( img_object, keypoints_object );
detector.detect( img_scene, keypoints_scene );
//-- Step 2: Calculate descriptors (feature vectors)
SurfDescriptorExtractor extractor;
Mat descriptors_object, descriptors_scene;
extractor.compute( img_object, keypoints_object, descriptors_object );
extractor.compute( img_scene, keypoints_scene, descriptors_scene );
//-- Step 3: Matching descriptor vectors using FLANN matcher
//FlannBasedMatcher matcher;
BruteForceMatcher < L2 …Run Code Online (Sandbox Code Playgroud) 我正在尝试计算我的程序从图像中检测关键点所需的时间。如果在我的 C++ 程序中我执行两次(使用相同的图像),则两者之间存在巨大差异。第一次大约用 600-800 毫秒,第二次只用 100-200 毫秒。
有谁知道发生了什么事?
这是我获取时间的代码:
struct timeval t1, t2;
Ptr<SURF> detector = SURF::create(400);
gettimeofday(&t1, 0x0);
detector->detect( imagen1, keypoints_1 );
gettimeofday(&t2, 0x0);
int milliSeconds = Utils::calculateDiff(t1, t2);
Run Code Online (Sandbox Code Playgroud)
这是我计算差异的代码:
static int calculateDiff(timeval t1, timeval t2)
{
return (t2.tv_sec - t1.tv_sec) * 1000 + (t2.tv_usec - t1.tv_usec)/1000;
}
Run Code Online (Sandbox Code Playgroud)
这是一个示例:
我想更改以下两个用opencv 2.3编写的命令.
fea_det=cv2.FeatureDetector_create("SIFT")
des_ext=cv2.DescriptorExtractor_create("SIFT")
Run Code Online (Sandbox Code Playgroud)
在opencv 3中,我知道有一个创建SIFT的命令,所以
fea_det=cv2.xfeatures2d.SIFT_create()
Run Code Online (Sandbox Code Playgroud)
但是我应该为des_ext使用什么?我问cv2.DescriptorExtractor_create("SIFT")opencv 3 中" " 的等效代码是什么?