Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $ cmake -D OPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules -D BUILD_opencv_re

19. **opencv_xfeatures2d**: Extra 2D Features Framework containing experimental and non-free 2D feature algorithms.

20. **opencv_ximgproc**: Extended Image Processing: Structured Forests / Domain Transform Filter / Guided Filter / Adaptive Manifold Filter / Joint Bilateral Filter / Superpixels.
20. **opencv_ximgproc**: Extended Image Processing: Structured Forests / Domain Transform Filter / Guided Filter / Adaptive Manifold Filter / Joint Bilateral Filter / Superpixels / Radon transform.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Radon transform is within "Domain Transform" category, not sure it must be mentioned as separate.
  • There is also the Hough Transform present here in ximgproc (Hough is spacial case of Radon).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should I do then? The outputs of hough and radon are similar. But the way they are implemented is different. Should I remove "Radon transform" from README.md ?


21. **opencv_xobjdetect**: Integral Channel Features Detector Framework.

Expand Down
3 changes: 2 additions & 1 deletion modules/ximgproc/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Extended Image Processing
=========================

1. Structured Forests
1. Structured Forests
2. Domain Transform Filter
3. Guided Filter
4. Adaptive Manifold Filter
5. Joint Bilateral Filter
6. Superpixels
7. Graph segmentation
8. Selective search from segmentation
9. Radon Transform
7 changes: 7 additions & 0 deletions modules/ximgproc/doc/ximgproc.bib
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,11 @@ @inproceedings{zhang2014100+
pages={2830--2837},
year={2014},
organization={IEEE}

@phdthesis{7910dc8d5b654c90ac4bc94c67d06f01,
title = "The Radon Transform - Theory and Implementation",
author = "Toft, {Peter Aundal} and Sørensen, {John Aasted}",
year = "1996",
month = "11",
publisher = "Technical University of Denmark (DTU)",
}
15 changes: 8 additions & 7 deletions modules/ximgproc/include/opencv2/ximgproc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
* 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.
Expand All @@ -48,6 +48,7 @@
#include "ximgproc/weighted_median_filter.hpp"
#include "ximgproc/slic.hpp"
#include "ximgproc/lsc.hpp"
#include "ximgproc/radon_transform.hpp"

/** @defgroup ximgproc Extended Image Processing
@{
Expand Down
111 changes: 111 additions & 0 deletions modules/ximgproc/include/opencv2/ximgproc/radon_transform.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/****************************************************************************************
* 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) *
* *
* Copyright (C) 2000-2016, Intel Corporation, all rights reserved. *
* Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. *
* Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved. *
* Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. *
* Copyright (C) 2015-2016, OpenCV Foundation, all rights reserved. *
* Copyright (C) 2015-2016, Itseez Inc., all rights reserved. *
* Third party copyrights are property of their respective owners. *
* *
* 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. *
****************************************************************************************/

/**
* @author {aravind | [email protected]}
* Created on Sun, Feb 14 2016
*/

/**
* Implementation of "The Radon Transform - Theory and Implementation"
* by "Toft, {Peter Aundal} and Sørensen, {John Aasted}"
*
* Online publication: http://petertoft.dk/PhD/
*
*/

#ifndef __OPENCV_RADON_TRANSFORM_HPP__
#define __OPENCV_RADON_TRANSFORM_HPP__
#ifdef __cplusplus

#include "opencv2/core.hpp"

namespace cv {
namespace ximgproc {

/**
* Flags for range of angles
* AR_x_y : theta lies in [x, y] ( both x and y inclusive )
*/

enum RadonAngleRange { AR_1_45 = 1,
AR_46_89 = 2,
AR_90 = 4,
AR_91_135 = 8,
AR_136_179 = 16,
AR_180 = 32
};

/**
* Specifies binary operations
* The enum specifies four binary operations,
* viz. Minimum, Maximum, Average and sum
* of the Radon transformed images.
*/

enum RadonOp { RT_MIN = 1,
RT_MAX = 2,
RT_AVE = 4,
RT_SUM = 8
};

/**
* [radonTransform Computes the Radon transform of the given image]
* @param src [Input source image]
* @param dst [Output image]
* @param angleRange [One of the enums, RadonAngleRange, defaults to 63 ( 1 to 180 degrees)]
* @param operation [One of the enums, RadonOp, defaults to RT_SUM ( SUM OPERATION )]
* @param opDst [Output image of the operation perfomed, defaults to noArray()]
*/
CV_EXPORTS void radonTransform( InputArray src,
OutputArray dst,
int angleRange = 63,
int operation = RT_SUM,
OutputArray opDst = noArray()
);
}
}

#endif // __cplusplus
#endif // __OPENCV_RADON_TRANSFORM_HPP__
Binary file added modules/ximgproc/samples/radon_input.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
152 changes: 152 additions & 0 deletions modules/ximgproc/samples/radon_transform.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
/****************************************************************************************
* 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) *
* *
* Copyright (C) 2000-2016, Intel Corporation, all rights reserved. *
* Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. *
* Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved. *
* Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. *
* Copyright (C) 2015-2016, OpenCV Foundation, all rights reserved. *
* Copyright (C) 2015-2016, Itseez Inc., all rights reserved. *
* Third party copyrights are property of their respective owners. *
* *
* 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. *
****************************************************************************************/

/**
* @author {aravind | [email protected]}
* Created on Mon, Feb 15 2016
*/

/**
*
* C++ Sample program for Radon transform
*
*/

// Necessary headers
#include <math.h>
#include <stdlib.h>
#include <string>
#include <iostream>

#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/core/utility.hpp>

#include <opencv2/ximgproc.hpp>

using namespace cv::ximgproc;
using namespace cv;
using namespace std;

static void help ( const char **argv ) {
std::cout << std::endl \
<< "This program demonstrates the usage of Radon transform." \
<< std::endl << std::endl << "USAGE: " << std::endl \
<< argv[0] << " <filename> <angle-range-option> <operation>" \
<< std::endl << std::endl;

std::cout << "Default for <angle-range-option> computes for " \
<< "all angles between 1 and 180 degrees." \
<< " ( @see cv::ximgproc::RadonAngleRange )" << std::endl \
<< "Default for <operation> is RT_SUM." \
<< " ( @see cv::ximgproc::RadonOp )" << std::endl \
<< std::endl; \

}

static bool argParser( int argc, const char **argv,
cv::Mat & img,
int & radonAngleRange,
int & radonOperation ) {
if (argc > 4) {
std::cout << "Incorrect arguments" << std::endl;
return false;
}

const char *filename = argc >= 2 ? argv[1]
: "./radon_input.jpg";
img = imread(filename, 0);
if( img.empty() ) {
std::cout << "Unable to load image: " << filename << std::endl;
return false;
}

radonAngleRange = ( argc >= 3 ) ? atoi(argv[2]) : 63; // 1 to 180 degrees
radonOperation = ( argc >= 4 ) ? atoi(argv[3]) : RT_SUM; // Sum up elements

return true;
}

int main( int argc, const char ** argv ) {

cv::Mat img;
int radonAngleRange, radonOperation;

// Display help
help( argv );

if( !argParser( argc, argv, img, radonAngleRange, radonOperation) ) {
return -1;
}

cv::Mat radonTr, operImg;

// Computing the Radon transform with appropriate params
radonTransform( img, radonTr, radonAngleRange, radonOperation, operImg );

// Mat for displaying the Radon transform
cv::Mat radonTrDisp;

double minVal, maxVal;
minMaxLoc(radonTr, &minVal, &maxVal);

// Normalizing radonTr so as to display as a CV_8U image
radonTr -= minVal;
radonTr.convertTo( radonTrDisp, CV_8U, 255.0/(maxVal-minVal) );

// Normalizing operImg so as to display as a CV_8U image
minMaxLoc(operImg, &minVal, &maxVal);
operImg -= minVal;
operImg.convertTo(operImg, CV_8U, 255.0/(maxVal-minVal));

// Displaying the images
cv::imshow("Input", img);
cv::imshow("Radon transform", radonTrDisp);
cv::imshow("Operation(image)", operImg);

cv::waitKey(0);
cv::destroyAllWindows();

return 0;
}
Loading