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*)'|

asked 2015-06-05 00:02:19 -0500

sandun gravatar image

updated 2015-06-05 01:07:57 -0500

berak gravatar image

//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

}
edit retag flag offensive close merge delete

Comments

1

cv::Mat is a refcounted smartpointer around the pixels already. please try to avoid using pointers to cv::Mat in general.

berak gravatar imageberak ( 2015-06-05 01:10:29 -0500 )edit