pull/229/head
cbalint13 10 years ago
commit 89a2302685
  1. 2
      modules/adas/tools/fcw_detect/CMakeLists.txt
  2. 2
      modules/adas/tools/fcw_train/CMakeLists.txt
  3. 10
      modules/line_descriptor/src/binary_descriptor.cpp
  4. 6
      modules/matlab/include/opencv2/matlab/bridge.hpp
  5. 2
      modules/optflow/src/motempl.cpp
  6. 4
      modules/rgbd/src/depth_to_3d.h
  7. 1
      modules/tracking/src/TrackingFunctionPF.hpp
  8. 140
      modules/xfeatures2d/src/lucid.cpp
  9. 12
      modules/xfeatures2d/src/sift.cpp
  10. 8
      modules/xfeatures2d/test/test_features2d.cpp
  11. 2
      modules/xphoto/src/gcgraph.hpp

@ -13,7 +13,7 @@ endif()
project(${the_target})
ocv_include_directories("${OpenCV_SOURCE_DIR}/include/opencv")
ocv_include_modules(${OPENCV_${the_target}_DEPS})
ocv_include_modules_recurse(${OPENCV_${the_target}_DEPS})
file(GLOB ${the_target}_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

@ -13,7 +13,7 @@ endif()
project(${the_target})
ocv_include_directories("${OpenCV_SOURCE_DIR}/include/opencv")
ocv_include_modules(${OPENCV_${the_target}_DEPS})
ocv_include_modules_recurse(${OPENCV_${the_target}_DEPS})
file(GLOB ${the_target}_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

@ -756,7 +756,7 @@ int BinaryDescriptor::OctaveKeyLines( cv::Mat& image, ScaleLines &keyLines )
/* some variables' declarations */
float rho1, rho2, tempValue;
float direction, near, length;
float direction, diffNear, length;
unsigned int octaveID, lineIDInOctave;
/*more than one octave image, organize lines in scale space.
@ -784,8 +784,8 @@ int BinaryDescriptor::OctaveKeyLines( cv::Mat& image, ScaleLines &keyLines )
/*nearThreshold depends on the distance of the image coordinate origin to current line.
*so nearThreshold = rho1 * nearThresholdRatio, where nearThresholdRatio = 1-cos(10*pi/180) = 0.0152*/
tempValue = (float) ( rho1 * 0.0152 );
float nearThreshold = ( tempValue > 6 ) ? ( tempValue ) : 6;
nearThreshold = ( nearThreshold < 12 ) ? nearThreshold : 12;
float diffNearThreshold = ( tempValue > 6 ) ? ( tempValue ) : 6;
diffNearThreshold = ( diffNearThreshold < 12 ) ? diffNearThreshold : 12;
/* compute scaled lenght of current line */
dx = fabs( edLineVec_[octaveCount]->lineEndpoints_[lineCurId][0] - edLineVec_[octaveCount]->lineEndpoints_[lineCurId][2] ); //x1-x2
@ -831,10 +831,10 @@ int BinaryDescriptor::OctaveKeyLines( cv::Mat& image, ScaleLines &keyLines )
/* get known term from equation to be compared */
rho2 = (float) ( scale[octaveID] * fabs( edLineVec_[octaveID]->lineEquations_[lineIDInOctave][2] ) );
/* compute difference between known ters */
near = fabs( rho1 - rho2 );
diffNear = fabs( rho1 - rho2 );
/* two lines are not close in the image */
if( near > nearThreshold )
if( diffNear > diffNearThreshold )
{
continue;
}

@ -85,6 +85,7 @@ typedef cv::Ptr<AlignMTB> Ptr_AlignMTB;
typedef cv::Ptr<CalibrateDebevec> Ptr_CalibrateDebevec;
typedef cv::Ptr<CalibrateRobertson> Ptr_CalibrateRobertson;
typedef cv::Ptr<DenseOpticalFlow> Ptr_DenseOpticalFlow;
typedef cv::Ptr<DualTVL1OpticalFlow> Ptr_DualTVL1OpticalFlow;
typedef cv::Ptr<MergeDebevec> Ptr_MergeDebevec;
typedef cv::Ptr<MergeMertens> Ptr_MergeMertens;
typedef cv::Ptr<MergeRobertson> Ptr_MergeRobertson;
@ -468,6 +469,11 @@ public:
Ptr_DenseOpticalFlow toPtrDenseOpticalFlow() { return Ptr_DenseOpticalFlow(); }
operator Ptr_DenseOpticalFlow() { return toPtrDenseOpticalFlow(); }
// --------------------------- Ptr_DualTVL1OpticalFlow -------------------
Bridge& operator=(const Ptr_DualTVL1OpticalFlow& ) { return *this; }
Ptr_DualTVL1OpticalFlow toPtrDualTVL1OpticalFlow() { return Ptr_DualTVL1OpticalFlow(); }
operator Ptr_DualTVL1OpticalFlow() { return toPtrDualTVL1OpticalFlow(); }
// --------------------------- Ptr_MergeDebevec -----------------------
Bridge& operator=(const Ptr_MergeDebevec& ) { return *this; }
Ptr_MergeDebevec toPtrMergeDebevec() { return Ptr_MergeDebevec(); }

@ -212,7 +212,7 @@ void calcMotionGradient( InputArray _mhi, OutputArray _mask,
float* orient_row = orient.ptr<float>(y);
uchar* mask_row = mask.ptr<uchar>(y);
fastAtan2(dY_max_row, dX_min_row, orient_row, size.width, true);
hal::fastAtan2(dY_max_row, dX_min_row, orient_row, size.width, true);
// make orientation zero where the gradient is very small
for( x = 0; x < size.width; x++ )

@ -81,7 +81,7 @@ convertDepthToFloat(const cv::Mat& depth, const cv::Mat& mask, float scale, cv::
v_mat((int)n_points, 0) = (float)v;
T depth_i = depth.at<T>(v, u);
if (cvIsNaN(depth_i) || (depth_i == std::numeric_limits<T>::min()) || (depth_i == std::numeric_limits<T>::max()))
if (cvIsNaN((float)depth_i) || (depth_i == std::numeric_limits<T>::min()) || (depth_i == std::numeric_limits<T>::max()))
z_mat((int)n_points, 0) = std::numeric_limits<float>::quiet_NaN();
else
z_mat((int)n_points, 0) = depth_i * scale;
@ -111,7 +111,7 @@ convertDepthToFloat(const cv::Mat& depth, float scale, const cv::Mat &uv_mat, cv
{
T depth_i = depth.at < T > ((int)(*uv_iter)[1], (int)(*uv_iter)[0]);
if (cvIsNaN(depth_i) || (depth_i == std::numeric_limits < T > ::min())
if (cvIsNaN((float)depth_i) || (depth_i == std::numeric_limits < T > ::min())
|| (depth_i == std::numeric_limits < T > ::max()))
*z_mat_iter = std::numeric_limits<float>::quiet_NaN();
else

@ -9,6 +9,7 @@ namespace cv{
public:
TrackingFunctionPF(const Mat& chosenRect);
void update(const Mat& image);
int getDims() const { return 4; }
double calc(const double* x) const;
void correctParams(double* pt)const;
private:

@ -0,0 +1,140 @@
// This implementation of, and any deviation from, the original algorithm as
// proposed by Ziegler et al. is not endorsed by Ziegler et al. nor does it
// claim to represent their definition of locally uniform comparison image
// descriptor. The original LUCID algorithm as proposed by Ziegler et al. remains
// the property of its respective authors. This implementation is an adaptation of
// said algorithm and contributed to OpenCV by Str3iber.
// References:
// Ziegler, Andrew, Eric Christiansen, David Kriegman, and Serge J. Belongie.
// "Locally uniform comparison image descriptor." In Advances in Neural Information
// Processing Systems, pp. 1-9. 2012.
/*
By downloading, copying, installing or using the software you agree to this license.
If you do not agree to this license, do not download, install,
copy or use the software.
License Agreement
For Open Source Computer Vision Library
(3-clause BSD License)
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the names of the copyright holders nor the names of the contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
This software is provided by the copyright holders and contributors "as is" and
any express or implied warranties, including, but not limited to, the implied
warranties of merchantability and fitness for a particular purpose are disclaimed.
In no event shall copyright holders or contributors be liable for any direct,
indirect, incidental, special, exemplary, or consequential damages
(including, but not limited to, procurement of substitute goods or services;
loss of use, data, or profits; or business interruption) however caused
and on any theory of liability, whether in contract, strict liability,
or tort (including negligence or otherwise) arising in any way out of
the use of this software, even if advised of the possibility of such damage.
*/
#include "precomp.hpp"
namespace cv {
namespace xfeatures2d {
/*!
LUCID implementation
*/
class LUCIDImpl : public LUCID {
public:
/** Constructor
* @param lucid_kernel kernel for descriptor construction, where 1=3x3, 2=5x5, 3=7x7 and so forth
* @param blur_kernel kernel for blurring image prior to descriptor construction, where 1=3x3, 2=5x5, 3=7x7 and so forth
*/
LUCIDImpl(const int lucid_kernel = 1, const int blur_kernel = 2);
/** returns the descriptor length */
virtual int descriptorSize() const;
/** returns the descriptor type */
virtual int descriptorType() const;
/** returns the default norm type */
virtual int defaultNorm() const;
virtual void compute(InputArray _src, std::vector<KeyPoint> &keypoints, OutputArray _desc);
protected:
int l_kernel, b_kernel;
};
Ptr<LUCID> LUCID::create(const int lucid_kernel, const int blur_kernel) {
return makePtr<LUCIDImpl>(lucid_kernel, blur_kernel);
}
LUCIDImpl::LUCIDImpl(const int lucid_kernel, const int blur_kernel) {
l_kernel = lucid_kernel;
b_kernel = blur_kernel*2+1;
}
int LUCIDImpl::descriptorSize() const {
return (l_kernel*2+1)*(l_kernel*2+1)*3;
}
int LUCIDImpl::descriptorType() const {
return CV_8UC1;
}
int LUCIDImpl::defaultNorm() const {
return NORM_HAMMING;
}
// gliese581h suggested filling a cv::Mat with descriptors to enable BFmatcher compatibility
// speed-ups and enhancements by gliese581h
void LUCIDImpl::compute(InputArray _src, std::vector<KeyPoint> &keypoints, OutputArray _desc) {
if (_src.getMat().empty())
return;
Mat_<Vec3b> src;
blur(_src.getMat(), src, cv::Size(b_kernel, b_kernel));
int x, y, j, d, p, m = (l_kernel*2+1)*(l_kernel*2+1)*3, width = src.cols, height = src.rows, r, c;
Mat_<uchar> desc(static_cast<int>(keypoints.size()), m);
for (std::size_t i = 0; i < keypoints.size(); ++i) {
x = static_cast<int>(keypoints[i].pt.x)-l_kernel, y = static_cast<int>(keypoints[i].pt.y)-l_kernel, d = x+2*l_kernel, p = y+2*l_kernel, j = x, r = static_cast<int>(i), c = 0;
while (x <= d) {
Vec3b &pix = src((y < 0 ? height+y : y >= height ? y-height : y), (x < 0 ? width+x : x >= width ? x-width : x));
desc(r, c++) = pix[0];
desc(r, c++) = pix[1];
desc(r, c++) = pix[2];
++x;
if (x > d) {
if (y < p) {
++y;
x = j;
}
else
break;
}
}
}
if (_desc.needed())
sort(desc, _desc, SORT_EVERY_ROW | SORT_ASCENDING);
}
}
} // END NAMESPACE CV

@ -337,9 +337,9 @@ static float calcOrientationHist( const Mat& img, Point pt, int radius,
len = k;
// compute gradient values, orientations and the weights over the pixel neighborhood
exp(W, W, len);
fastAtan2(Y, X, Ori, len, true);
magnitude(X, Y, Mag, len);
hal::exp(W, W, len);
hal::fastAtan2(Y, X, Ori, len, true);
hal::magnitude(X, Y, Mag, len);
for( k = 0; k < len; k++ )
{
@ -620,9 +620,9 @@ static void calcSIFTDescriptor( const Mat& img, Point2f ptf, float ori, float sc
}
len = k;
fastAtan2(Y, X, Ori, len, true);
magnitude(X, Y, Mag, len);
exp(W, W, len);
hal::fastAtan2(Y, X, Ori, len, true);
hal::magnitude(X, Y, Mag, len);
hal::exp(W, W, len);
for( k = 0; k < len; k++ )
{

@ -1032,6 +1032,14 @@ TEST( Features2d_DescriptorExtractor_BRIEF, regression )
test.safe_run();
}
TEST( Features2d_DescriptorExtractor_LUCID, regression )
{
CV_DescriptorExtractorTest<Hamming> test( "descriptor-lucid", 1,
LUCID::create(1, 2) );
test.safe_run();
}
/*#if CV_SSE2
TEST( Features2d_DescriptorExtractor_Calonder_uchar, regression )

@ -254,7 +254,7 @@ TWeight GCGraph<TWeight>::maxFlow()
minWeight = MIN(minWeight, weight);
CV_Assert( minWeight > 0 );
}
weight = abs( TWeight(v->weight) );
weight = std::abs( TWeight(v->weight) );
minWeight = MIN(minWeight, weight);
CV_Assert( minWeight > 0 );
}

Loading…
Cancel
Save