Ask Your Question

sandun's profile - activity

2015-06-05 00:02:19 -0500 asked a question C:\Users\A\Desktop\project support\dummy my source\main.cpp|31|error: cannot convert 'cv::Mat' to 'cv::Mat*' for argument '1' to 'void t_b_invertd(cv::Mat*)'|

//http://www.learncpp.com/cpp-tutorial/78-function-pointers/

//http://www.codeguru.com/cpp/cpp/article.php/c17401/C-Tutorial-PointertoMember-Function.htm

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <opencv2/imgproc/imgproc.hpp>
#include <stdio.h>
#include <stdlib.h>
using namespace cv;
using namespace std;

//Global variables
 void t_b_invertd (Mat*);
// void t_b_invertd ( Mat *src_img,  *dst_gray , *img_thresh, *img_final  );
int main( int argc, char** argv )
{

Mat src_my_rgb=imread("C:\\Users\\A\\Desktop\\project support\\dummy my source\\mypic.jpg",CV_LOAD_IMAGE_COLOR);   // Read the file "image.jpg".
Mat *src_my_rgb_ptr=&src_my_rgb;



if(src_my_rgb.empty()){
   printf("The command line arguments are wrong.I am exiting.\n");
            return 1;} //exit program with status 1 to indicate a non normal exit

      // DISPLAY image
       namedWindow( "window", CV_WINDOW_AUTOSIZE ); // Create a window for display.
       imshow( "window", src_my_rgb ); // Show our image inside it.

    t_b_invertd(src_my_rgb);
waitKey(0);                       // Wait for a keystroke in the window
       return 0;
}

void t_b_invertd ( )
{
 Mat *src_img,  *dst_gray , *img_thresh, *img_final;
    cvtColor(*src_img, *dst_gray,CV_RGB2GRAY);


    adaptiveThreshold(*dst_gray, *img_thresh, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY_INV, 105, 1);


    dilate(*img_thresh,  *img_final, 0, Point(-1, -1), 2, 1, 1);



  namedWindow( "thresh holded", WINDOW_AUTOSIZE );


  imshow( "thresh holded", *img_final );

                       // Wait for a keystroke in the window

}
2015-04-07 10:19:08 -0500 commented question please help-no errors but nor output...

Glad if someone can correct the above error

2015-04-07 08:25:16 -0500 commented question please help-no errors but nor output...

Thankx for your kind support.actually i'm very new to opencv and still working to make things know. so sorry for any dismatch or odd here . thankx again for help.

2015-03-24 01:10:55 -0500 asked a question 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(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);
}
2015-03-19 01:57:51 -0500 received badge  Editor (source)
2015-03-19 01:55:59 -0500 asked a question My opencv c++ program struct...but no errors...

terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct null not valid

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

Process returned 255 (0xFF) execution time : 4.016 s

Press any key to continue.

I'm to load and erode an image.

Thankx..