1 | initial version |
please use opencv's c++ api, yoo also will only need half the code:
using namespace cv;
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); }
2 | No.2 Revision |
please use opencv's c++ api, yoo also will only need half the code:
#include <opencv2/opencv.hpp>
// c++ 3 | No.3 Revision |
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;
}
4 | No.4 Revision |
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;
}
5 | No.5 Revision |
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;
}