#include<iostream>
#include<stdlib.h>
#include<opencv2/opencv.hpp>
#include<opencv/highgui.h>
#include<stdio.h>
using namespace cv;
using namespace std;
int main(int argc,char** argv)
{Mat image;
printf("program1");
image=imread("images.jpg");
namedWindow("image");
if(image.empty())
{
printf("empty image");
}
if(!image.empty())
{
printf("image not empty ");
imshow("image",image);
}
waitKey(0);
return 0;
}
this is my first program in image processing using opencv in linux (ubuntu). I am able to load the image correcly with no errors. the problem I'm facing is the 2 messages " program 1" and "image not empty" is pronted only after I press some key.That is the image is being loaded and displayed properly and waits for user input but the two statements don't execute.
It is as if, the print statements are being executed only after return statement is executed. I code in a text editor (gedit) and use cmake to complie and execute . the output statements are supposed to be printed in the terminal.
Please let me know what my problem could be and how I could rectify it.