| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e0fef2b commit b8b7ca7
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -295,6 +295,15 @@ enum InterpolationFlags{ | |||
| 295 | 295 | WARP_INVERSE_MAP = 16 | |
| 296 | 296 | }; | |
| 297 | 297 | ||
| 298 | + /** \brief Specify the polar mapping mode | ||
| 299 | + @sa warpPolar | ||
| 300 | + */ | ||
| 301 | + enum WarpPolarMode | ||
| 302 | + { | ||
| 303 | + WARP_POLAR_LINEAR = 0, ///< Remaps an image to/from polar space. | ||
| 304 | + WARP_POLAR_LOG = 256 ///< Remaps an image to/from semilog-polar space. | ||
| 305 | + }; | ||
| 306 | + | ||
| 298 | 307 | enum InterpolationMasks { | |
| 299 | 308 | INTER_BITS = 5, | |
| 300 | 309 | INTER_BITS2 = INTER_BITS * 2, | |
@@ -2546,7 +2555,10 @@ An example using the cv::linearPolar and cv::logPolar operations | |||
| 2546 | 2555 | ||
| 2547 | 2556 | /** @brief Remaps an image to semilog-polar coordinates space. | |
| 2548 | 2557 | ||
| 2549 | - Transform the source image using the following transformation (See @ref polar_remaps_reference_image "Polar remaps reference image"): | ||
| 2558 | + @deprecated This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags+WARP_POLAR_LOG); | ||
| 2559 | + | ||
| 2560 | + @internal | ||
| 2561 | + Transform the source image using the following transformation (See @ref polar_remaps_reference_image "Polar remaps reference image d)"): | ||
| 2550 | 2562 | \f[\begin{array}{l} | |
| 2551 | 2563 | dst( \rho , \phi ) = src(x,y) \\ | |
| 2552 | 2564 | dst.size() \leftarrow src.size() | |
@@ -2556,13 +2568,13 @@ where | |||
| 2556 | 2568 | \f[\begin{array}{l} | |
| 2557 | 2569 | I = (dx,dy) = (x - center.x,y - center.y) \\ | |
| 2558 | 2570 | \rho = M \cdot log_e(\texttt{magnitude} (I)) ,\\ | |
| 2559 | - \phi = Ky \cdot \texttt{angle} (I)_{0..360 deg} \\ | ||
| 2571 | + \phi = Kangle \cdot \texttt{angle} (I) \\ | ||
| 2560 | 2572 | \end{array}\f] | |
| 2561 | 2573 | ||
| 2562 | 2574 | and | |
| 2563 | 2575 | \f[\begin{array}{l} | |
| 2564 | 2576 | M = src.cols / log_e(maxRadius) \\ | |
| 2565 | - Ky = src.rows / 360 \\ | ||
| 2577 | + Kangle = src.rows / 2\Pi \\ | ||
| 2566 | 2578 | \end{array}\f] | |
| 2567 | 2579 | ||
| 2568 | 2580 | The function emulates the human "foveal" vision and can be used for fast scale and | |
@@ -2576,16 +2588,19 @@ rotation-invariant template matching, for object tracking and so forth. | |||
| 2576 | 2588 | @note | |
| 2577 | 2589 | - The function can not operate in-place. | |
| 2578 | 2590 | - To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees. | |
| 2591 | + | ||
| 2592 | + @sa cv::linearPolar | ||
| 2593 | + @endinternal | ||
| 2579 | 2594 | */ | |
| 2580 | 2595 | CV_EXPORTS_W void logPolar( InputArray src, OutputArray dst, | |
| 2581 | 2596 | Point2f center, double M, int flags ); | |
| 2582 | 2597 | ||
| 2583 | 2598 | /** @brief Remaps an image to polar coordinates space. | |
| 2584 | 2599 | ||
| 2585 | - @anchor polar_remaps_reference_image | ||
| 2586 | -  | ||
| 2600 | + @deprecated This function produces same result as cv::warpPolar(src, dst, src.size(), center, maxRadius, flags) | ||
| 2587 | 2601 | ||
| 2588 | - Transform the source image using the following transformation: | ||
| 2602 | + @internal | ||
| 2603 | + Transform the source image using the following transformation (See @ref polar_remaps_reference_image "Polar remaps reference image c)"): | ||
| 2589 | 2604 | \f[\begin{array}{l} | |
| 2590 | 2605 | dst( \rho , \phi ) = src(x,y) \\ | |
| 2591 | 2606 | dst.size() \leftarrow src.size() | |
@@ -2594,14 +2609,14 @@ Transform the source image using the following transformation: | |||
| 2594 | 2609 | where | |
| 2595 | 2610 | \f[\begin{array}{l} | |
| 2596 | 2611 | I = (dx,dy) = (x - center.x,y - center.y) \\ | |
| 2597 | - \rho = Kx \cdot \texttt{magnitude} (I) ,\\ | ||
| 2598 | - \phi = Ky \cdot \texttt{angle} (I)_{0..360 deg} | ||
| 2612 | + \rho = Kmag \cdot \texttt{magnitude} (I) ,\\ | ||
| 2613 | + \phi = angle \cdot \texttt{angle} (I) | ||
| 2599 | 2614 | \end{array}\f] | |
| 2600 | 2615 | ||
| 2601 | 2616 | and | |
| 2602 | 2617 | \f[\begin{array}{l} | |
| 2603 | 2618 | Kx = src.cols / maxRadius \\ | |
| 2604 | - Ky = src.rows / 360 | ||
| 2619 | + Ky = src.rows / 2\Pi | ||
| 2605 | 2620 | \end{array}\f] | |
| 2606 | 2621 | ||
| 2607 | 2622 | ||
@@ -2615,10 +2630,104 @@ and | |||
| 2615 | 2630 | - The function can not operate in-place. | |
| 2616 | 2631 | - To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees. | |
| 2617 | 2632 | ||
| 2633 | + @sa cv::logPolar | ||
| 2634 | + @endinternal | ||
| 2618 | 2635 | */ | |
| 2619 | 2636 | CV_EXPORTS_W void linearPolar( InputArray src, OutputArray dst, | |
| 2620 | 2637 | Point2f center, double maxRadius, int flags ); | |
| 2621 | 2638 | ||
| 2639 | + | ||
| 2640 | + /** \brief Remaps an image to polar or semilog-polar coordinates space | ||
| 2641 | + | ||
| 2642 | + @anchor polar_remaps_reference_image | ||
| 2643 | +  | ||
| 2644 | + | ||
| 2645 | + Transform the source image using the following transformation: | ||
| 2646 | + \f[ | ||
| 2647 | + dst(\rho , \phi ) = src(x,y) | ||
| 2648 | + \f] | ||
| 2649 | + | ||
| 2650 | + where | ||
| 2651 | + \f[ | ||
| 2652 | + \begin{array}{l} | ||
| 2653 | + \vec{I} = (x - center.x, \;y - center.y) \\ | ||
| 2654 | + \phi = Kangle \cdot \texttt{angle} (\vec{I}) \\ | ||
| 2655 | + \rho = \left\{\begin{matrix} | ||
| 2656 | + Klin \cdot \texttt{magnitude} (\vec{I}) & default \\ | ||
| 2657 | + Klog \cdot log_e(\texttt{magnitude} (\vec{I})) & if \; semilog \\ | ||
| 2658 | + \end{matrix}\right. | ||
| 2659 | + \end{array} | ||
| 2660 | + \f] | ||
| 2661 | + | ||
| 2662 | + and | ||
| 2663 | + \f[ | ||
| 2664 | + \begin{array}{l} | ||
| 2665 | + Kangle = dsize.height / 2\Pi \\ | ||
| 2666 | + Klin = dsize.width / maxRadius \\ | ||
| 2667 | + Klog = dsize.width / log_e(maxRadius) \\ | ||
| 2668 | + \end{array} | ||
| 2669 | + \f] | ||
| 2670 | + | ||
| 2671 | + | ||
| 2672 | + \par Linear vs semilog mapping | ||
| 2673 | + | ||
| 2674 | + Polar mapping can be linear or semi-log. Add one of #WarpPolarMode to `flags` to specify the polar mapping mode. | ||
| 2675 | + | ||
| 2676 | + Linear is the default mode. | ||
| 2677 | + | ||
| 2678 | + The semilog mapping emulates the human "foveal" vision that permit very high acuity on the line of sight (central vision) | ||
| 2679 | + in contrast to peripheral vision where acuity is minor. | ||
| 2680 | + | ||
| 2681 | + \par Option on `dsize`: | ||
| 2682 | + | ||
| 2683 | + - if both values in `dsize <=0 ` (default), | ||
| 2684 | + the destination image will have (almost) same area of source bounding circle: | ||
| 2685 | + \f[\begin{array}{l} | ||
| 2686 | + dsize.area \leftarrow (maxRadius^2 \cdot \Pi) \\ | ||
| 2687 | + dsize.width = \texttt{cvRound}(maxRadius) \\ | ||
| 2688 | + dsize.height = \texttt{cvRound}(maxRadius \cdot \Pi) \\ | ||
| 2689 | + \end{array}\f] | ||
| 2690 | + | ||
| 2691 | + | ||
| 2692 | + - if only `dsize.height <= 0`, | ||
| 2693 | + the destination image area will be proportional to the bounding circle area but scaled by `Kx * Kx`: | ||
| 2694 | + \f[\begin{array}{l} | ||
| 2695 | + dsize.height = \texttt{cvRound}(dsize.width \cdot \Pi) \\ | ||
| 2696 | + \end{array} | ||
| 2697 | + \f] | ||
| 2698 | + | ||
| 2699 | + - if both values in `dsize > 0 `, | ||
| 2700 | + the destination image will have the given size therefore the area of the bounding circle will be scaled to `dsize`. | ||
| 2701 | + | ||
| 2702 | + | ||
| 2703 | + \par Reverse mapping | ||
| 2704 | + | ||
| 2705 | + You can get reverse mapping adding #WARP_INVERSE_MAP to `flags` | ||
| 2706 | + \snippet polar_transforms.cpp InverseMap | ||
| 2707 | + | ||
| 2708 | + In addiction, to calculate the original coordinate from a polar mapped coordinate \f$(rho, phi)->(x, y)\f$: | ||
| 2709 | + \snippet polar_transforms.cpp InverseCoordinate | ||
| 2710 | + | ||
| 2711 | + @param src Source image. | ||
| 2712 | + @param dst Destination image. It will have same type as src. | ||
| 2713 | + @param dsize The destination image size (see description for valid options). | ||
| 2714 | + @param center The transformation center. | ||
| 2715 | + @param maxRadius The radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too. | ||
| 2716 | + @param flags A combination of interpolation methods, #InterpolationFlags + #WarpPolarMode. | ||
| 2717 | + - Add #WARP_POLAR_LINEAR to select linear polar mapping (default) | ||
| 2718 | + - Add #WARP_POLAR_LOG to select semilog polar mapping | ||
| 2719 | + - Add #WARP_INVERSE_MAP for reverse mapping. | ||
| 2720 | + @note | ||
| 2721 | + - The function can not operate in-place. | ||
| 2722 | + - To calculate magnitude and angle in degrees #cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees. | ||
| 2723 | + - This function uses #remap. Due to current implementation limitations the size of an input and output images should be less than 32767x32767. | ||
| 2724 | + | ||
| 2725 | + @sa cv::remap | ||
| 2726 | + */ | ||
| 2727 | + CV_EXPORTS_W void warpPolar(InputArray src, OutputArray dst, Size dsize, | ||
| 2728 | + Point2f center, double maxRadius, int flags); | ||
| 2729 | + | ||
| 2730 | + | ||
| 2622 | 2731 | //! @} imgproc_transform | |
| 2623 | 2732 | ||
| 2624 | 2733 | //! @addtogroup imgproc_misc | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -260,14 +260,14 @@ CVAPI(void) cvConvertMaps( const CvArr* mapx, const CvArr* mapy, | |||
| 260 | 260 | CvArr* mapxy, CvArr* mapalpha ); | |
| 261 | 261 | ||
| 262 | 262 | /** @brief Performs forward or inverse log-polar image transform | |
| 263 | - @see cv::logPolar | ||
| 263 | + @see cv::warpPolar | ||
| 264 | 264 | */ | |
| 265 | 265 | CVAPI(void) cvLogPolar( const CvArr* src, CvArr* dst, | |
| 266 | 266 | CvPoint2D32f center, double M, | |
| 267 | 267 | int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS)); | |
| 268 | 268 | ||
| 269 | 269 | /** Performs forward or inverse linear-polar image transform | |
| 270 | - @see cv::linearPolar | ||
| 270 | + @see cv::warpPolar | ||
| 271 | 271 | */ | |
| 272 | 272 | CVAPI(void) cvLinearPolar( const CvArr* src, CvArr* dst, | |
| 273 | 273 | CvPoint2D32f center, double maxRadius, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -204,7 +204,7 @@ OCL_PERF_TEST_P(RemapFixture, Remap, | |||
| 204 | 204 | const RemapParams params = GetParam(); | |
| 205 | 205 | const Size srcSize = get<0>(params); | |
| 206 | 206 | const int type = get<1>(params), interpolation = get<2>(params), borderMode = BORDER_CONSTANT; | |
| 207 | - const double eps = CV_MAT_DEPTH(type) <= CV_32S ? 1 : 1e-4; | ||
| 207 | + //const double eps = CV_MAT_DEPTH(type) <= CV_32S ? 1 : 1e-4; | ||
| 208 | 208 | ||
| 209 | 209 | checkDeviceMaxMemoryAllocSize(srcSize, type); | |
| 210 | 210 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments