Commit c2903700 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #918 from LaurentBerger:ImprovePaillou

parents 1050104e 7360642d
...@@ -51,8 +51,8 @@ namespace ximgproc { ...@@ -51,8 +51,8 @@ namespace ximgproc {
* *
* For more details about this implementation, please see @cite paillou1997detecting * For more details about this implementation, please see @cite paillou1997detecting
* *
* @param op Source 8-bit or 16bit image, 1-channel or 3-channel image. * @param op Source CV_8U(S) or CV_16U(S), 1-channel or 3-channels image.
* @param _dst result CV_32F image with same numeber of channel than op. * @param _dst result CV_32F image with same number of channel than op.
* @param omega double see paper * @param omega double see paper
* @param alpha double see paper * @param alpha double see paper
* *
......
...@@ -47,8 +47,8 @@ using namespace cv::ximgproc; ...@@ -47,8 +47,8 @@ using namespace cv::ximgproc;
using namespace std; using namespace std;
int aa = 100, ww = 10; int aa = 100, ww = 10;
Mat dx, dy;
UMat img; Ptr<Mat> img;
const char* window_name = "Gradient Modulus"; const char* window_name = "Gradient Modulus";
static void DisplayImage(Mat x,string s) static void DisplayImage(Mat x,string s)
...@@ -77,8 +77,8 @@ static void PaillouFilter(int, void*) ...@@ -77,8 +77,8 @@ static void PaillouFilter(int, void*)
Mat dst; Mat dst;
double a=aa/100.0,w=ww/100.0; double a=aa/100.0,w=ww/100.0;
Mat rx,ry; Mat rx,ry;
GradientPaillouX(img,rx,a,w); GradientPaillouX(*img.get(),rx,a,w);
GradientPaillouY(img,ry,a,w); GradientPaillouY(*img.get(),ry,a,w);
DisplayImage(rx, "Gx"); DisplayImage(rx, "Gx");
DisplayImage(ry, "Gy"); DisplayImage(ry, "Gy");
add(rx.mul(rx),ry.mul(ry),dst); add(rx.mul(rx),ry.mul(ry),dst);
...@@ -89,13 +89,15 @@ static void PaillouFilter(int, void*) ...@@ -89,13 +89,15 @@ static void PaillouFilter(int, void*)
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
if (argc==2) Mat *m=new Mat;
imread(argv[1]).copyTo(img); if (argc == 2)
if (img.empty()) *m = imread(argv[1]);
if (m->empty())
{ {
cout << "File not found or empty image\n"; cout << "File not found or empty image\n";
} }
imshow("Original",img); img = Ptr<Mat>(m);
imshow("Original",*img.get());
namedWindow( window_name, WINDOW_AUTOSIZE ); namedWindow( window_name, WINDOW_AUTOSIZE );
/// Create a Trackbar for user to enter threshold /// Create a Trackbar for user to enter threshold
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment