Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

please use opencv's c++ api, yoo also will only need half the code:

include <opencv2 opencv.hpp=""> // c++ headers

using namespace cv;

include <iostream>

using namespace std;

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

Mat in=imread("E:/Arshad/OpenCv/OpenCv Work/Penguins.jpg"); if ( in.empty() ) { cerr << "image was not found !" << endl; return -1; } namedWindow("Input",CV_WINDOW_AUTOSIZE); imshow("Input",in); Mat out; pyrDown(in, out); namedWindow("doPyramidDown",CV_WINDOW_AUTOSIZE); imshow("doPyramidDown",out); pyrDown(out, out); Canny(out, out, 10, 100, 3); namedWindow("doCanny",CV_WINDOW_AUTOSIZE); imshow("doCanny",out); waitKey(0); }

please use opencv's c++ api, yoo also will only need half the code:

include <opencv2 opencv.hpp="">
#include <opencv2/opencv.hpp> // c++ headers

headers using namespace cv;

cv;

include <iostream>

#include <iostream> using namespace std;

std;

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

argc, char **argv) {

Mat in=imread("E:/Arshad/OpenCv/OpenCv Work/Penguins.jpg"); if ( in.empty() ) { cerr << "image was not found !" << endl; return -1; } namedWindow("Input",CV_WINDOW_AUTOSIZE); imshow("Input",in); Mat out; pyrDown(in, out); namedWindow("doPyramidDown",CV_WINDOW_AUTOSIZE); imshow("doPyramidDown",out); pyrDown(out, out); Canny(out, out, 10, 100, 3); namedWindow("doCanny",CV_WINDOW_AUTOSIZE); imshow("doCanny",out); waitKey(0); }

return 0; }

please use opencv's c++ api, yoo also will only need half the code:

#include <opencv2/opencv.hpp> // c++ headers
using namespace cv;

#include <iostream>
using namespace std;

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

    Mat in=imread("E:/Arshad/OpenCv/OpenCv Work/Penguins.jpg");
    if ( in.empty() )
    { 
        cerr << "image was not found !" << endl;
        return -1; 
    }
    namedWindow("Input",CV_WINDOW_AUTOSIZE);
    imshow("Input",in);
    Mat out;
    pyrDown(in, out);
    namedWindow("doPyramidDown",CV_WINDOW_AUTOSIZE);
    imshow("doPyramidDown",out);
    pyrDown(out, out);
    cvtColor(out, out, CV_BGR2GRAY);  // make it grayscale for canny
    Canny(out, out, 10, 100, 3);
    namedWindow("doCanny",CV_WINDOW_AUTOSIZE);
    imshow("doCanny",out);
    waitKey(0);
    return 0;
}

please use opencv's c++ api, yoo also will only need half the code:

#include <opencv2/opencv.hpp> // c++ headers
using namespace cv;

#include <iostream>
using namespace std;

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

    Mat in=imread("E:/Arshad/OpenCv/OpenCv Work/Penguins.jpg");
    if ( in.empty() )
    { 
        cerr << "image was not found !" << endl;
        return -1; 
    }
    namedWindow("Input",CV_WINDOW_AUTOSIZE);
    imshow("Input",in);
    Mat out;
out;  // no need to pre-allocate or release a cv::Mat manually
    pyrDown(in, out);
    namedWindow("doPyramidDown",CV_WINDOW_AUTOSIZE);
    imshow("doPyramidDown",out);
    pyrDown(out, out);
    cvtColor(out, out, CV_BGR2GRAY);  // make it grayscale for canny
    Canny(out, out, 10, 100, 3);
    namedWindow("doCanny",CV_WINDOW_AUTOSIZE);
    imshow("doCanny",out);
    waitKey(0);
    return 0;
}

please use opencv's c++ api, yoo you also will only need half the code:

#include <opencv2/opencv.hpp> // c++ headers
using namespace cv;

#include <iostream>
using namespace std;

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

    Mat in=imread("E:/Arshad/OpenCv/OpenCv Work/Penguins.jpg");
    if ( in.empty() )
    { 
        cerr << "image was not found !" << endl;
        return -1; 
    }
    namedWindow("Input",CV_WINDOW_AUTOSIZE);
    imshow("Input",in);
    Mat out;  // no need to pre-allocate or release a cv::Mat manually
    pyrDown(in, out);
    namedWindow("doPyramidDown",CV_WINDOW_AUTOSIZE);
    imshow("doPyramidDown",out);
    pyrDown(out, out);
    cvtColor(out, out, CV_BGR2GRAY);  // make it grayscale for canny
    Canny(out, out, 10, 100, 3);
    namedWindow("doCanny",CV_WINDOW_AUTOSIZE);
    imshow("doCanny",out);
    waitKey(0);
    return 0;
}