Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

please help-no errors but nor output...

//http://opencv-srf.blogspot.com/2013/06/load-display-image.html //http://opencv-srf.blogspot.com/2013/06/load-display-image.html ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

include "opencv2/imgproc/imgproc.hpp"//erosion step ekedi add kala.

include "opencv2/highgui/highgui.hpp"

//#include "opencv2/imgcodecs.hpp"

include <iostream>

include <stdlib.h>

include <stdio.h>

using namespace std; using namespace cv;

//http://docs.opencv.org/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.html--erosion site eka. //global variables for erosion;unusable nam delete karanna-dialation ekka conflict vela tiyenna puluvan.. Mat src, erosion_dst; //for erosion. int erosion_elem=0; int erosion_size=0; int const max_elem=2; int const max_kernel_size=21; /function Headers-(for erosion)/ void Erosion(int,void* );

/*Function main/

int main( int, char** argv ) { //load image--erosion. src=imread(argv[1]); if(src.empty()){ return -1;} //create windows-erosion. namedWindow( "Erosion Demo", WINDOW_AUTOSIZE ); /// Default start Erosion( 0, 0 );

waitKey(0); //return 0;//oneda danne na.

/*simple load image-- from web site./

Mat img = imread("MyPic.JPG", CV_LOAD_IMAGE_UNCHANGED); //read the image data in the file "MyPic.JPG" and store it in 'img'

if (img.empty()) //check whether the image is loaded or not { cout << "Error : Image cannot be loaded..!!" << endl; //system("pause"); //wait for a key press return -1; }

namedWindow("MyWindow", CV_WINDOW_AUTOSIZE); //create a window with the name "MyWindow" imshow("MyWindow", img); //display the image which is stored in the 'img' in the "MyWindow" window

waitKey(0); //wait infinite time for a keypress

 destroyWindow("MyWindow"); //destroy the window with the name, "MyWindow"

return 0;

}

//erosion function. //http://docs.opencv.org/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.html void Erosion(int,void*){ int erosion_type=0; erosion_type = MORPH_RECT;//pahatha dekata venas kara balanna. //erosion_type = MORPH_CROSS; //erosion_type = MORPH_ELLIPSE;

Mat element=getStructuringElement(erosion_type,Size(2erosion_size+1,2erosion_size+1),Point(erosion_size,erosion_size)); //Apply the Erosion operation. erode(src,erosion_dst,element); imshow("Erosion Demo",erosion_dst); }

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

please help-no errors but nor output...

 //http://opencv-srf.blogspot.com/2013/06/load-display-image.html
//http://opencv-srf.blogspot.com/2013/06/load-display-image.html
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

include #include "opencv2/imgproc/imgproc.hpp"//erosion step ekedi add kala.

include "opencv2/highgui/highgui.hpp"

kala. #include "opencv2/highgui/highgui.hpp" //#include "opencv2/imgcodecs.hpp"

include <iostream>

include <stdlib.h>

include <stdio.h>

"opencv2/imgcodecs.hpp" #include <iostream> #include <stdlib.h> #include <stdio.h> using namespace std; using namespace cv;

cv; //http://docs.opencv.org/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.html--erosion site eka. //global variables for erosion;unusable nam delete karanna-dialation ekka conflict vela tiyenna puluvan.. Mat src, erosion_dst; //for erosion. int erosion_elem=0; int erosion_size=0; int const max_elem=2; int const max_kernel_size=21; /function /*function Headers-(for erosion)/ erosion)*/ void Erosion(int,void* );

/*Function main/

); /**Function main*/ int main( int, char** argv ) { //load image--erosion. src=imread(argv[1]); if(src.empty()){ return -1;} //create windows-erosion. namedWindow( "Erosion Demo", WINDOW_AUTOSIZE ); /// Default start Erosion( 0, 0 );

); waitKey(0); //return 0;//oneda danne na.

/*simple na. /**simple load image-- from web site./

site.*/ Mat img = imread("MyPic.JPG", CV_LOAD_IMAGE_UNCHANGED); //read the image data in the file "MyPic.JPG" and store it in 'img'

'img' if (img.empty()) //check whether the image is loaded or not { cout << "Error : Image cannot be loaded..!!" << endl; //system("pause"); //wait for a key press return -1; }

} namedWindow("MyWindow", CV_WINDOW_AUTOSIZE); //create a window with the name "MyWindow" imshow("MyWindow", img); //display the image which is stored in the 'img' in the "MyWindow" window

window waitKey(0); //wait infinite time for a keypress

keypress

     destroyWindow("MyWindow"); //destroy the window with the name, "MyWindow"

return 0;

}

0; } //erosion function. //http://docs.opencv.org/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.html void Erosion(int,void*){ int erosion_type=0; erosion_type = MORPH_RECT;//pahatha dekata venas kara balanna. //erosion_type = MORPH_CROSS; //erosion_type = MORPH_ELLIPSE;

MORPH_ELLIPSE; Mat element=getStructuringElement(erosion_type,Size(2erosion_size+1,2erosion_size+1),Point(erosion_size,erosion_size)); element=getStructuringElement(erosion_type,Size(2*erosion_size+1,2*erosion_size+1),Point(erosion_size,erosion_size)); //Apply the Erosion operation. erode(src,erosion_dst,element); imshow("Erosion Demo",erosion_dst); }

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}