I have passed an image from one function/method to another several times before. I have seen this question at SO also but i don't know why i am getting a segmentation fault when i am trying to pass an image from main()
to another function in the same file. I have already tried to display the image to make sure that the image is getting loaded correctly.
using namespace cv;
void checkFunction(Mat image)
{
imshow("myimage", image);
}
void main()
{
Mat img = imread("myImage.png", 1);
imshow("display image", img);
checkFunction(img);
waitKey(0);
}