From eed2ab18cdb6a75b33e3028aa1e0e7f12f04e251 Mon Sep 17 00:00:00 2001 From: Bellaktris Date: Tue, 24 Jun 2014 03:19:03 +0400 Subject: [PATCH] minor fixes in ximpgroc/doc/* + fixes gcc & clang build problem --- .../ximpgroc/prediction/prediction.rst | 2 +- doc/tutorials/ximpgroc/training/training.rst | 4 ++-- modules/ximpgroc/CMakeLists.txt | 4 ++-- .../doc/structured_edge_detection/index.rst | 18 ++++++++---------- .../ximpgroc/src/structured_edge_detection.cpp | 7 ++++--- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/doc/tutorials/ximpgroc/prediction/prediction.rst b/doc/tutorials/ximpgroc/prediction/prediction.rst index 3cdf3ca0f..e2bf2219a 100644 --- a/doc/tutorials/ximpgroc/prediction/prediction.rst +++ b/doc/tutorials/ximpgroc/prediction/prediction.rst @@ -5,7 +5,7 @@ Structured forests for fast edge detection Introduction ------------ -Today most digital images and imaging devices use 8 bits per channel thus limiting the dynamic range of the device to two orders of magnitude (actually 256 levels), while human eye can adapt to lighting conditions varying by ten orders of magnitude. When we take photographs of a real world scene bright regions may be overexposed, while the dark ones may be underexposed, so we can’t capture all details using a single exposure. HDR imaging works with images that use more that 8 bits per channel (usually 32-bit float values), allowing much wider dynamic range. +Today most digital images and imaging devices use 8 bits per channel thus limiting the dynamic range of the device to two orders of magnitude (actually 256 levels), while human eye can adapt to lighting conditions varying by ten orders of magnitude. When we take photographs of a real world scene bright regions may be overexposed, while the dark ones may be underexposed, so we can't capture all details using a single exposure. HDR imaging works with images that use more that 8 bits per channel (usually 32-bit float values), allowing much wider dynamic range. There are different ways to obtain HDR images, but the most common one is to use photographs of the scene taken with different exposure values. To combine this exposures it is useful to know your camera’s response function and there are algorithms to estimate it. After the HDR image has been blended it has to be converted back to 8-bit to view it on usual displays. This process is called tonemapping. Additional complexities arise when objects of the scene or camera move between shots, since images with different exposures should be registered and aligned. diff --git a/doc/tutorials/ximpgroc/training/training.rst b/doc/tutorials/ximpgroc/training/training.rst index efec4de03..20a1cfc27 100644 --- a/doc/tutorials/ximpgroc/training/training.rst +++ b/doc/tutorials/ximpgroc/training/training.rst @@ -42,7 +42,7 @@ Training pipeline 5. Rename models/forest/modelFinal.mat to models/forest/modelFinal.mat.backup -6. Open edgesChns.m and comment lines 26--41. Add after commented lines the following:: +6. Open edgesChns.m and comment lines 26--41. Add after commented lines the following: :: shrink=opts.shrink; chns = single(getFeatures( im2double(I) )); @@ -112,4 +112,4 @@ Just use expanded constructor with above defined class NewRFFeatureGetter .. code-block:: cpp cv::StructuredEdgeDetection pDollar - = cv::createStructuredEdgeDetection( modelName, makePtr() ); \ No newline at end of file + = cv::createStructuredEdgeDetection( modelName, makePtr() ); diff --git a/modules/ximpgroc/CMakeLists.txt b/modules/ximpgroc/CMakeLists.txt index 047a3ed0a..2a53cd7af 100644 --- a/modules/ximpgroc/CMakeLists.txt +++ b/modules/ximpgroc/CMakeLists.txt @@ -1,3 +1,3 @@ set(the_description "Advanced edge-detection algorithms") -ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef) -ocv_define_module(ximpgroc opencv_core opencv_imgproc OPTIONAL opencv_highgui) \ No newline at end of file +ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wshadow) +ocv_define_module(ximpgroc opencv_core opencv_imgproc OPTIONAL opencv_highgui) diff --git a/modules/ximpgroc/doc/structured_edge_detection/index.rst b/modules/ximpgroc/doc/structured_edge_detection/index.rst index 565b99e61..cfb2c5330 100644 --- a/modules/ximpgroc/doc/structured_edge_detection/index.rst +++ b/modules/ximpgroc/doc/structured_edge_detection/index.rst @@ -3,7 +3,8 @@ Structured forests for fast edge detection .. highlight:: cpp -... +This module contains implementations of modern structured edge detection algorithms, +i.e. algorithms which somehow takes into account pixel affinities in natural images. StructuredEdgeDetection ----------------------- @@ -40,12 +41,12 @@ StructuredEdgeDetection::detectEdges ++++++++++++++++++++++++++++++++++++ .. ocv:function:: void detectEdges(const Mat src, Mat dst) -The function detects edges in src and draw them to dst. The algorithm underlies this function -is much more robust to texture presence, than common approaches, e.g. Sobel + The function detects edges in src and draw them to dst. The algorithm underlies this function + is much more robust to texture presence, than common approaches, e.g. Sobel - :param src : source image (RGB, float, in [0;1]) to detect edges - :param dst : destination image (grayscale, float, in [0;1]) - where edges are drawn + :param src: source image (RGB, float, in [0;1]) to detect edges + :param dst: destination image (grayscale, float, in [0;1]) + where edges are drawn .. seealso:: @@ -56,14 +57,11 @@ createStructuredEdgeDetection +++++++++++++++++++++++++++++ .. ocv:function:: Ptr createStructuredEdgeDetection(String model) -The only available constructor + The only available constructor :param model: model file name -Literature ----------- - .. [Dollar2013] Dollár P., Zitnick C. L., "Structured forests for fast edge detection", IEEE International Conference on Computer Vision (ICCV), 2013, pp. 1841-1848. `DOI `_ diff --git a/modules/ximpgroc/src/structured_edge_detection.cpp b/modules/ximpgroc/src/structured_edge_detection.cpp index 0e19b74e8..d315cb3ff 100644 --- a/modules/ximpgroc/src/structured_edge_detection.cpp +++ b/modules/ximpgroc/src/structured_edge_detection.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include "opencv2/ximpgroc/structured_edge_detection.hpp" @@ -217,7 +218,7 @@ static void gradientHist(const cv::Mat &src, cv::Mat &magnitude, cv::Mat &histog for (int j = 0; j < src.cols*nchannels; j += nchannels) { - float fMagn = -1e-5, fdx, fdy; + float fMagn = -1e-5, fdx = 0, fdy = 0; for (int k = 0; k < nchannels; ++k) { float cMagn = CV_SQR( pDx[j + k] ) + CV_SQR( pDy[j + k] ); @@ -229,7 +230,7 @@ static void gradientHist(const cv::Mat &src, cv::Mat &magnitude, cv::Mat &histog } } - pMagnitude[j/nchannels] = std::sqrtf(fMagn); + pMagnitude[j/nchannels] = sqrtf(fMagn); float angle = cv::fastAtan2(fdy, fdx) / 180.0f - 1.0f * (fdy < 0); if (std::fabs(fdx) + std::fabs(fdy) < 1e-5) @@ -691,4 +692,4 @@ Ptr createStructuredEdgeDetection(const String &model, return makePtr(model, howToGetFeatures); } -} \ No newline at end of file +}