diff --git a/include/opencv/cv.h b/include/opencv/cv.h index 64e16bd0f3fdf7003b1029070b6b0298325a7714..f44129d61589f7f9b6537ab1dd4d157011e1bb19 100644 --- a/include/opencv/cv.h +++ b/include/opencv/cv.h @@ -62,10 +62,6 @@ #if defined(__cplusplus) #include "opencv2/core/internal.hpp" - -namespace cv { -namespace flann = cvflann; -} #endif //__cplusplus #endif __OPENCV_OLD_CV_H_ diff --git a/include/opencv/cv.hpp b/include/opencv/cv.hpp index 1162ff9477b28db31bf296620fa92c5721636a38..8422f20bee726909cf461723eb88424b2bc8dab6 100644 --- a/include/opencv/cv.hpp +++ b/include/opencv/cv.hpp @@ -43,6 +43,10 @@ #ifndef __OPENCV_OLD_CV_HPP__ #define __OPENCV_OLD_CV_HPP__ +#if defined(__GNUC__) +#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module" +#endif + #include #endif diff --git a/include/opencv/cvaux.h b/include/opencv/cvaux.h index 6ae7061a151fdadba8093917cfdd7d77b84ecb3d..733da1ffe57bda927be06ffdce50f66ca1fd127a 100644 --- a/include/opencv/cvaux.h +++ b/include/opencv/cvaux.h @@ -42,8 +42,9 @@ #ifndef __OPENCV_OLD_AUX_H__ #define __OPENCV_OLD_AUX_H__ -#pragma warning("This is a deprecated opencv header provided for compatibility. Please \ -include a header from a corresponding opencv module") +#if defined(__GNUC__) +#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module" +#endif #include "opencv2/core/core_c.h" #include "opencv2/core/core.hpp" diff --git a/include/opencv/cvaux.hpp b/include/opencv/cvaux.hpp index 64b56ac3e9a9f1fee16d542910427660683886eb..ceecab917b7f718b6bad3edddf9133556010530e 100644 --- a/include/opencv/cvaux.hpp +++ b/include/opencv/cvaux.hpp @@ -42,6 +42,10 @@ #ifndef __OPENCV_OLD_AUX_HPP__ #define __OPENCV_OLD_AUX_HPP__ +#if defined(__GNUC__) +#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module" +#endif + #include #endif diff --git a/include/opencv/cxcore.h b/include/opencv/cxcore.h index ca3102385e054acec79854bb1f959c405a362192..af016537129208c879d38a47cec6e953089beee6 100644 --- a/include/opencv/cxcore.h +++ b/include/opencv/cxcore.h @@ -43,6 +43,10 @@ #ifndef __OPENCV_OLD_CXCORE_H__ #define __OPENCV_OLD_CXCORE_H__ +#if defined(__GNUC__) +#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module" +#endif + #include "opencv2/core/core_c.h" #include "opencv2/core/core.hpp" diff --git a/modules/core/include/opencv2/core/flann.hpp b/modules/core/include/opencv2/core/flann.hpp index 715cc6267e36d05befbff02dc04dd7c7de620a7b..8a8fa470c8a9e5b2635a21f4e6f40086da57c06d 100644 --- a/modules/core/include/opencv2/core/flann.hpp +++ b/modules/core/include/opencv2/core/flann.hpp @@ -52,7 +52,7 @@ namespace cvflann namespace cv { -namespace cvflann { +namespace flann { /* Nearest neighbor index algorithms */ enum flann_algorithm_t { diff --git a/modules/core/src/flann.cpp b/modules/core/src/flann.cpp index 46f961022a48b8cf3bab3df9d6de0df8ede0449c..2a2c1435b8af47620319944093594e1f44d4423e 100644 --- a/modules/core/src/flann.cpp +++ b/modules/core/src/flann.cpp @@ -38,7 +38,7 @@ namespace cv { -namespace cvflann { +namespace flann { ::cvflann::Index* LinearIndexParams::createIndex(const Mat& dataset) const { diff --git a/modules/features2d/include/opencv2/features2d/features2d.hpp b/modules/features2d/include/opencv2/features2d/features2d.hpp index 2157aa248bc30cca50599b93515bf9420d71a303..b7170dd00ced214a66543ab9edde9684e475018c 100644 --- a/modules/features2d/include/opencv2/features2d/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d/features2d.hpp @@ -1077,7 +1077,7 @@ protected: CvMat* m_pca_hr_eigenvectors; // PCA eigenvectors for large patches OneWayDescriptor* m_pca_descriptors; // an array of PCA descriptors - cv::cvflann::Index* m_pca_descriptors_tree; + cv::flann::Index* m_pca_descriptors_tree; CvMat* m_pca_descriptors_matrix; CvAffinePose* m_poses; // array of poses diff --git a/modules/features2d/src/oneway.cpp b/modules/features2d/src/oneway.cpp index 1bf253ca16e8f5bdb88aaa23989b19f5ab1f2d98..eaf76ca7cc4f226182f4445a76756dbde6a1f19b 100644 --- a/modules/features2d/src/oneway.cpp +++ b/modules/features2d/src/oneway.cpp @@ -149,7 +149,7 @@ namespace cv{ std::vector& desc_idxs, std::vector& pose_idxs, std::vector& distances, CvMat* avg = 0, CvMat* eigenvalues = 0); - void FindOneWayDescriptor(cv::cvflann::Index* m_pca_descriptors_tree, CvSize patch_size, int m_pca_dim_low, int m_pose_count, IplImage* patch, int& desc_idx, int& pose_idx, float& distance, + void FindOneWayDescriptor(cv::flann::Index* m_pca_descriptors_tree, CvSize patch_size, int m_pca_dim_low, int m_pose_count, IplImage* patch, int& desc_idx, int& pose_idx, float& distance, CvMat* avg = 0, CvMat* eigenvalues = 0); void FindOneWayDescriptorEx(int desc_count, const OneWayDescriptor* descriptors, IplImage* patch, @@ -163,7 +163,7 @@ namespace cv{ std::vector& distances, std::vector& scales, CvMat* avg, CvMat* eigenvectors); - void FindOneWayDescriptorEx(cv::cvflann::Index* m_pca_descriptors_tree, CvSize patch_size, int m_pca_dim_low, int m_pose_count, IplImage* patch, + void FindOneWayDescriptorEx(cv::flann::Index* m_pca_descriptors_tree, CvSize patch_size, int m_pca_dim_low, int m_pose_count, IplImage* patch, float scale_min, float scale_max, float scale_step, int& desc_idx, int& pose_idx, float& distance, float& scale, CvMat* avg, CvMat* eigenvectors); @@ -800,7 +800,7 @@ namespace cv{ #if defined(_KDTREE) - void FindOneWayDescriptor(cv::cvflann::Index* m_pca_descriptors_tree, CvSize patch_size, int m_pca_dim_low, int m_pose_count, IplImage* patch, int& desc_idx, int& pose_idx, float& distance, + void FindOneWayDescriptor(cv::flann::Index* m_pca_descriptors_tree, CvSize patch_size, int m_pca_dim_low, int m_pose_count, IplImage* patch, int& desc_idx, int& pose_idx, float& distance, CvMat* avg, CvMat* eigenvectors) { desc_idx = -1; @@ -875,7 +875,7 @@ namespace cv{ object_ptr[i] = pca_coeffs->data.fl[i]; } - m_pca_descriptors_tree->knnSearch(m_object, m_indices, m_dists, 1, cv::cvflann::SearchParams(-1) ); + m_pca_descriptors_tree->knnSearch(m_object, m_indices, m_dists, 1, cv::flann::SearchParams(-1) ); desc_idx = ((int*)(m_indices.ptr(0)))[0] / m_pose_count; pose_idx = ((int*)(m_indices.ptr(0)))[0] % m_pose_count; @@ -1109,7 +1109,7 @@ namespace cv{ } #if defined(_KDTREE) - void FindOneWayDescriptorEx(cv::cvflann::Index* m_pca_descriptors_tree, CvSize patch_size, int m_pca_dim_low, + void FindOneWayDescriptorEx(cv::flann::Index* m_pca_descriptors_tree, CvSize patch_size, int m_pca_dim_low, int m_pose_count, IplImage* patch, float scale_min, float scale_max, float scale_step, int& desc_idx, int& pose_idx, float& distance, float& scale, @@ -1660,7 +1660,7 @@ namespace cv{ //::cvflann::KDTreeIndexParams params; //params.trees = 1; //m_pca_descriptors_tree = new KDTree(pca_descriptors_mat); - m_pca_descriptors_tree = new cv::cvflann::Index(pca_descriptors_mat,cv::cvflann::KDTreeIndexParams(1)); + m_pca_descriptors_tree = new cv::flann::Index(pca_descriptors_mat,cv::flann::KDTreeIndexParams(1)); //cvReleaseMat(&m_pca_descriptors_matrix); //m_pca_descriptors_tree->buildIndex(); } diff --git a/samples/c/find_obj.cpp b/samples/c/find_obj.cpp index 74bcbc901b9908c24bc65523f032f670cb133b24..8faa31dd9ecbac60003166be9600ea60f7e925ce 100644 --- a/samples/c/find_obj.cpp +++ b/samples/c/find_obj.cpp @@ -138,8 +138,8 @@ flannFindPairs( const CvSeq*, const CvSeq* objectDescriptors, // find nearest neighbors using FLANN cv::Mat m_indices(objectDescriptors->total, 2, CV_32S); cv::Mat m_dists(objectDescriptors->total, 2, CV_32F); - cv::cvflann::Index flann_index(m_image, cv::cvflann::KDTreeIndexParams(4)); // using 4 randomized kdtrees - flann_index.knnSearch(m_object, m_indices, m_dists, 2, cv::cvflann::SearchParams(64) ); // maximum number of leafs checked + cv::flann::Index flann_index(m_image, cv::flann::KDTreeIndexParams(4)); // using 4 randomized kdtrees + flann_index.knnSearch(m_object, m_indices, m_dists, 2, cv::flann::SearchParams(64) ); // maximum number of leafs checked int* indices_ptr = m_indices.ptr(0); float* dists_ptr = m_dists.ptr(0); diff --git a/samples/c/one_way_sample.cpp b/samples/c/one_way_sample.cpp index 7ec851ee25745b9ed3a2e686723ae0c61d3c6320..010f05bb8cfc233f9e407a4e35c90f99a376baaa 100644 --- a/samples/c/one_way_sample.cpp +++ b/samples/c/one_way_sample.cpp @@ -54,12 +54,26 @@ int main(int argc, char** argv) printf("Reading the images...\n"); IplImage* img1 = cvLoadImage(img1_name.c_str(), CV_LOAD_IMAGE_GRAYSCALE); IplImage* img2 = cvLoadImage(img2_name.c_str(), CV_LOAD_IMAGE_GRAYSCALE); - + // extract keypoints from the first image - vector keypoints1; SURF surf_extractor(5.0e3); + vector keypoints1; +#if 1 + Mat _img1(img1); + vector corners; + + goodFeaturesToTrack(_img1, corners, 200, 0.01, 20); + for(size_t i = 0; i < corners.size(); i++) + { + KeyPoint p; + p.pt = corners[i]; + keypoints1.push_back(p); + } +#else // printf("Extracting keypoints\n"); surf_extractor(img1, Mat(), keypoints1); +#endif + printf("Extracted %d keypoints...\n", (int)keypoints1.size()); printf("Training one way descriptors..."); diff --git a/tests/cv/src/anearestneighbors.cpp b/tests/cv/src/anearestneighbors.cpp index a346d220bfc25948b0925163f1f73be8549e9aaa..5bc9904d2f8469f9e53ae4f9f7619d7ff2b121bb 100644 --- a/tests/cv/src/anearestneighbors.cpp +++ b/tests/cv/src/anearestneighbors.cpp @@ -47,7 +47,7 @@ #include using namespace cv; -using namespace cv::cvflann; +using namespace cv::flann; //-------------------------------------------------------------------------------- class NearestNeighborTest : public CvTest