Merged the trunk r8517:8524

This commit is contained in:
Andrey Kamaev 2012-05-31 10:53:28 +00:00
parent 9ad470ba5c
commit daad7900e2
9 changed files with 293 additions and 213 deletions

View File

@ -11,8 +11,44 @@ if(BUILD_DOCS AND HAVE_SPHINX)
project(opencv_docs)
file(GLOB_RECURSE OPENCV_FILES_REF ../modules/*.rst)
file(GLOB_RECURSE OPENCV_FILES_REF_PICT ../modules/*.png ../modules/*.jpg)
set(OPENCV2_BASE_MODULES core imgproc highgui video calib3d features2d objdetect ml flann gpu photo stitching nonfree contrib legacy)
# build lists of modules to be documented
set(OPENCV2_MODULES "")
set(OPENCV_MODULES "")
foreach(mod ${OPENCV_MODULES_BUILD} ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MODULES_DISABLED_AUTO} ${OPENCV_MODULES_DISABLED_FORCE})
string(REGEX REPLACE "^opencv_" "" mod "${mod}")
if("${OPENCV_MODULE_opencv_${mod}_LOCATION}" STREQUAL "${OpenCV_SOURCE_DIR}/modules/${mod}")
list(APPEND OPENCV2_MODULES ${mod})
else()
list(APPEND OPENCV_MODULES ${mod})
endif()
endforeach()
list(REMOVE_ITEM OPENCV2_MODULES ${OPENCV2_BASE_MODULES})
ocv_list_sort(OPENCV2_MODULES)
ocv_list_sort(OPENCV_MODULES)
# build lists of documentation files and generate table of contents for reference manual
set(OPENCV_FILES_REF "")
set(OPENCV_FILES_REF_PICT "")
set(OPENCV_REFMAN_TOC "")
foreach(mod ${OPENCV2_BASE_MODULES} ${OPENCV2_MODULES} ${OPENCV_MODULES})
file(GLOB_RECURSE _OPENCV_FILES_REF "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc/*.rst")
file(GLOB_RECURSE _OPENCV_FILES_REF_PICT "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc/*.png" "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc/*.jpg")
list(APPEND OPENCV_FILES_REF ${_OPENCV_FILES_REF})
list(APPEND OPENCV_FILES_REF_PICT ${_OPENCV_FILES_REF_PICT})
set(toc_file "${OPENCV_MODULE_opencv_${mod}_LOCATION}/doc/${mod}.rst")
if(EXISTS "${toc_file}")
file(RELATIVE_PATH toc_file "${OpenCV_SOURCE_DIR}/modules" "${toc_file}")
set(OPENCV_REFMAN_TOC "${OPENCV_REFMAN_TOC} ${toc_file}\r\n")
endif()
endforeach()
configure_file("${OpenCV_SOURCE_DIR}/modules/refman.rst.in" "${OpenCV_SOURCE_DIR}/modules/refman.rst" IMMEDIATE @ONLY)
file(GLOB_RECURSE OPENCV_FILES_UG user_guide/*.rst)
file(GLOB_RECURSE OPENCV_FILES_TUT tutorials/*.rst)
file(GLOB_RECURSE OPENCV_FILES_TUT_PICT tutorials/*.png tutorials/*.jpg)

View File

@ -778,36 +778,35 @@ void ORB::operator()( InputArray _image, InputArray _mask, vector<KeyPoint>& _ke
{
if( level < firstLevel )
{
resize(image, imagePyramid[level], sz, scale, scale, INTER_LINEAR);
resize(image, imagePyramid[level], sz, 0, 0, INTER_LINEAR);
if (!mask.empty())
resize(mask, maskPyramid[level], sz, scale, scale, INTER_LINEAR);
copyMakeBorder(imagePyramid[level], temp, border, border, border, border,
BORDER_REFLECT_101+BORDER_ISOLATED);
resize(mask, maskPyramid[level], sz, 0, 0, INTER_LINEAR);
}
else
{
resize(imagePyramid[level-1], imagePyramid[level], sz,
1./scaleFactor, 1./scaleFactor, INTER_LINEAR);
resize(imagePyramid[level-1], imagePyramid[level], sz, 0, 0, INTER_LINEAR);
if (!mask.empty())
resize(maskPyramid[level-1], maskPyramid[level], sz,
1./scaleFactor, 1./scaleFactor, INTER_LINEAR);
{
resize(maskPyramid[level-1], maskPyramid[level], sz, 0, 0, INTER_LINEAR);
threshold(maskPyramid[level], maskPyramid[level], 254, 0, THRESH_TOZERO);
}
}
copyMakeBorder(imagePyramid[level], temp, border, border, border, border,
BORDER_REFLECT_101+BORDER_ISOLATED);
}
if (!mask.empty())
copyMakeBorder(maskPyramid[level], masktemp, border, border, border, border,
BORDER_CONSTANT+BORDER_ISOLATED);
}
else
{
copyMakeBorder(image, temp, border, border, border, border,
BORDER_REFLECT_101);
image.copyTo(imagePyramid[level]);
if( !mask.empty() )
mask.copyTo(maskPyramid[level]);
}
if( !mask.empty() )
copyMakeBorder(maskPyramid[level], masktemp, border, border, border, border,
copyMakeBorder(mask, masktemp, border, border, border, border,
BORDER_CONSTANT+BORDER_ISOLATED);
}
}
// Pre-compute the keypoints (we keep the best over all scales, so this has to be done beforehand
vector < vector<KeyPoint> > allKeypoints;

View File

@ -1091,3 +1091,51 @@ TEST( Features2d_DescriptorMatcher_FlannBased, regression )
CV_DescriptorMatcherTest test( "descriptor-matcher-flann-based", new FlannBasedMatcher, 0.04f );
test.safe_run();
}
TEST(Features2D_ORB, _1996)
{
cv::Ptr<cv::FeatureDetector> fd = cv::FeatureDetector::create("ORB");
cv::Ptr<cv::DescriptorExtractor> de = cv::DescriptorExtractor::create("ORB");
Mat image = cv::imread(string(cvtest::TS::ptr()->get_data_path()) + "shared/lena.jpg");
ASSERT_FALSE(image.empty());
Mat roi(image.size(), CV_8UC1, Scalar(0));
Point poly[] = {Point(100, 20), Point(300, 50), Point(400, 200), Point(10, 500)};
fillConvexPoly(roi, poly, int(sizeof(poly) / sizeof(poly[0])), Scalar(255));
std::vector<cv::KeyPoint> keypoints;
fd->detect(image, keypoints, roi);
cv::Mat descriptors;
de->compute(image, keypoints, descriptors);
//image.setTo(Scalar(255,255,255), roi);
int roiViolations = 0;
for(std::vector<cv::KeyPoint>::const_iterator kp = keypoints.begin(); kp != keypoints.end(); ++kp)
{
int x = cvRound(kp->pt.x);
int y = cvRound(kp->pt.y);
ASSERT_LE(0, x);
ASSERT_LE(0, y);
ASSERT_GT(image.cols, x);
ASSERT_GT(image.rows, y);
// if (!roi.at<uchar>(y,x))
// {
// roiViolations++;
// circle(image, kp->pt, 3, Scalar(0,0,255));
// }
}
// if(roiViolations)
// {
// imshow("img", image);
// waitKey();
// }
ASSERT_EQ(0, roiViolations);
}

View File

@ -10,6 +10,7 @@ Creates a trackbar and attaches it to the specified window.
.. ocv:function:: int createTrackbar( const string& trackbarname, const string& winname, int* value, int count, TrackbarCallback onChange=0, void* userdata=0)
.. ocv:cfunction:: int cvCreateTrackbar( const char* trackbar_name, const char* window_name, int* value, int count, CvTrackbarCallback on_change=NULL )
.. ocv:pyoldfunction:: cv.CreateTrackbar(trackbarName, windowName, value, count, onChange) -> None
:param trackbarname: Name of the created trackbar.
@ -41,6 +42,7 @@ Returns the trackbar position.
.. ocv:pyfunction:: cv2.getTrackbarPos(trackbarname, winname) -> retval
.. ocv:cfunction:: int cvGetTrackbarPos( const char* trackbar_name, const char* window_name )
.. ocv:pyoldfunction:: cv.GetTrackbarPos(trackbarName, windowName) -> retval
:param trackbarname: Name of the trackbar.
@ -62,6 +64,7 @@ Displays an image in the specified window.
.. ocv:pyfunction:: cv2.imshow(winname, mat) -> None
.. ocv:cfunction:: void cvShowImage( const char* name, const CvArr* image )
.. ocv:pyoldfunction:: cv.ShowImage(name, image) -> None
:param winname: Name of the window.
@ -86,6 +89,7 @@ Creates a window.
.. ocv:pyfunction:: cv2.namedWindow(winname[, flags]) -> None
.. ocv:cfunction:: int cvNamedWindow( const char* name, int flags=CV_WINDOW_AUTOSIZE )
.. ocv:pyoldfunction:: cv.NamedWindow(name, flags=CV_WINDOW_AUTOSIZE)-> None
:param name: Name of the window in the window caption that may be used as a window identifier.
@ -120,6 +124,7 @@ Destroys a window.
.. ocv:pyfunction:: cv2.destroyWindow(winname) -> None
.. ocv:cfunction:: void cvDestroyWindow( const char* name )
.. ocv:pyoldfunction:: cv.DestroyWindow(name)-> None
:param winname: Name of the window to be destroyed.
@ -136,6 +141,7 @@ Destroys all of the HighGUI windows.
.. ocv:pyfunction:: cv2.destroyAllWindows() -> None
.. ocv:cfunction:: void cvDestroyAllWindows()
.. ocv:pyoldfunction:: cv.DestroyAllWindows()-> None
The function ``destroyAllWindows`` destroys all of the opened HighGUI windows.
@ -145,10 +151,15 @@ MoveWindow
----------
Moves window to the specified position
.. ocv:function:: void moveWindow( const string& winname, int x, int y )
.. ocv:pyfunction:: cv2.moveWindow(winname, x, y) -> None
.. ocv:cfunction:: void cvMoveWindow( const char* name, int x, int y )
.. ocv:pyoldfunction:: cv.MoveWindow(name, x, y)-> None
:param name: Window name
:param winname: Window name
:param x: The new x-coordinate of the window
@ -159,10 +170,15 @@ ResizeWindow
------------
Resizes window to the specified size
.. ocv:function:: void resizeWindow( const string& winname, int width, int height )
.. ocv:pyfunction:: cv2.resizeWindow(winname, width, height) -> None
.. ocv:cfunction:: void cvResizeWindow( const char* name, int width, int height )
.. ocv:pyoldfunction:: cv.ResizeWindow(name, width, height)-> None
:param name: Window name
:param winname: Window name
:param width: The new window width
@ -179,14 +195,17 @@ SetMouseCallback
----------------
Sets mouse handler for the specified window
.. ocv:function:: void setMouseCallback( const string& winname, MouseCallback onMouse, void* userdata=0 )
.. ocv:cfunction:: void cvSetMouseCallback( const char* window_name, CvMouseCallback on_mouse, void* param=NULL )
.. ocv:pyoldfunction:: cv.SetMouseCallback(windowName, onMouse, param=None) -> None
:param window_name: Window name
:param winname: Window name
:param on_mouse: Mouse callback. See OpenCV samples, such as http://code.opencv.org/svn/opencv/trunk/opencv/samples/cpp/ffilldemo.cpp, on how to specify and use the callback.
:param onMouse: Mouse callback. See OpenCV samples, such as http://code.opencv.org/svn/opencv/trunk/opencv/samples/cpp/ffilldemo.cpp, on how to specify and use the callback.
:param param: The optional parameter passed to the callback.
:param userdata: The optional parameter passed to the callback.
setTrackbarPos
@ -198,6 +217,7 @@ Sets the trackbar position.
.. ocv:pyfunction:: cv2.setTrackbarPos(trackbarname, winname, pos) -> None
.. ocv:cfunction:: void cvSetTrackbarPos( const char* trackbar_name, const char* window_name, int pos )
.. ocv:pyoldfunction:: cv.SetTrackbarPos(trackbarName, windowName, pos)-> None
:param trackbarname: Name of the trackbar.
@ -221,6 +241,7 @@ Waits for a pressed key.
.. ocv:pyfunction:: cv2.waitKey([delay]) -> retval
.. ocv:cfunction:: int cvWaitKey( int delay=0 )
.. ocv:pyoldfunction:: cv.WaitKey(delay=0)-> int
:param delay: Delay in milliseconds. 0 is the special value that means "forever".

View File

@ -3353,6 +3353,10 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
if( code == CV_BGR2HSV || code == CV_RGB2HSV ||
code == CV_BGR2HSV_FULL || code == CV_RGB2HSV_FULL )
{
#ifdef HAVE_TEGRA_OPTIMIZATION
if(tegra::cvtRGB2HSV(src, dst, bidx, hrange))
break;
#endif
if( depth == CV_8U )
CvtColorLoop(src, dst, RGB2HSV_b(scn, bidx, hrange));
else

View File

@ -2999,19 +2999,6 @@ void cv::warpPerspective( InputArray _src, OutputArray _dst, InputArray _M0,
invert(matM, matM);
#ifdef HAVE_TEGRA_OPTIMIZATION
// if (borderType == BORDER_REPLICATE)
// {
// if( tegra::warpPerspective(src, dst, M, interpolation, borderType, borderValue) )
// return;
// }
// else
// {
// double warp_mat[9];
// Mat warp_m(3, 3, CV_64F, warp_mat);
// M0.convertTo(warp_m, warp_m.type());
// if( tegra::warpPerspective(src, dst, warp_mat, interpolation, borderType, borderValue) )
// return;
// }
if( tegra::warpPerspective(src, dst, M, interpolation, borderType, borderValue) )
return;
#endif

View File

@ -1,24 +0,0 @@
############################
OpenCV API Reference
############################
.. toctree::
:maxdepth: 2
core/doc/intro.rst
core/doc/core.rst
imgproc/doc/imgproc.rst
highgui/doc/highgui.rst
video/doc/video.rst
calib3d/doc/calib3d.rst
features2d/doc/features2d.rst
objdetect/doc/objdetect.rst
ml/doc/ml.rst
flann/doc/flann.rst
gpu/doc/gpu.rst
photo/doc/photo.rst
stitching/doc/stitching.rst
nonfree/doc/nonfree.rst
contrib/doc/contrib.rst
legacy/doc/legacy.rst

9
modules/refman.rst.in Normal file
View File

@ -0,0 +1,9 @@
############################
OpenCV API Reference
############################
.. toctree::
:maxdepth: 2
core/doc/intro.rst
@OPENCV_REFMAN_TOC@