Merged the trunk r8345:8376

This commit is contained in:
Andrey Kamaev
2012-05-18 13:18:37 +00:00
parent 70166820ea
commit e1c4fd9e1f
52 changed files with 1750 additions and 622 deletions

View File

@@ -2324,6 +2324,7 @@ The class provides the following features for all derived classes:
Here is example of SIFT use in your application via Algorithm interface: ::
#include "opencv2/opencv.hpp"
#include "opencv2/nonfree/nonfree.hpp"
...
@@ -2334,22 +2335,22 @@ Here is example of SIFT use in your application via Algorithm interface: ::
FileStorage fs("sift_params.xml", FileStorage::READ);
if( fs.isOpened() ) // if we have file with parameters, read them
{
sift.read(fs["sift_params"]);
sift->read(fs["sift_params"]);
fs.release();
}
else // else modify the parameters and store them; user can later edit the file to use different parameters
{
sift.set("contrastThreshold", 0.01f); // lower the contrast threshold, compared to the default value
sift->set("contrastThreshold", 0.01f); // lower the contrast threshold, compared to the default value
{
WriteStructContext ws(fs, "sift_params", CV_NODE_MAP);
sift.write(fs);
sift->write(fs);
}
}
Mat image = imread("myimage.png", 0), descriptors;
vector<KeyPoint> keypoints;
sift(image, noArray(), keypoints, descriptors);
(*sift)(image, noArray(), keypoints, descriptors);
Algorithm::get

View File

@@ -2897,8 +2897,16 @@ cvKMeans2( const CvArr* _samples, int cluster_count, CvArr* _labels,
namespace cv
{
Mat Mat::reshape(int, int, const int*) const
Mat Mat::reshape(int _cn, int _newndims, const int* _newsz) const
{
if(_newndims == dims)
{
if(_newsz == 0)
return reshape(_cn);
if(_newndims == 2)
return reshape(_cn, _newsz[0]);
}
CV_Error(CV_StsNotImplemented, "");
// TBD
return Mat();

View File

@@ -861,3 +861,14 @@ TEST(Core_IOArray, submat_create)
EXPECT_THROW( OutputArray_create1(A.row(0)), cv::Exception );
EXPECT_THROW( OutputArray_create2(A.row(0)), cv::Exception );
}
TEST(Core_Mat, reshape_1942)
{
cv::Mat A = (cv::Mat_<float>(2,3) << 3.4884074, 1.4159607, 0.78737736, 2.3456569, -0.88010466, 0.3009364);
int cn = 0;
ASSERT_NO_THROW(
cv::Mat_<float> M = A.reshape(3);
cn = M.channels();
);
ASSERT_EQ(1, cn);
}