why I am not getting Image??
I am trying to load image, but I always get blank window frame.
this is the header file,
#pragma once
class project
{
public:
project(void);
~project(void);
bool image( char* imgName);
};
this is .cpp file
#include "project.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "opencv2/imgproc/imgproc.hpp"
using namespace cv;
project::project(void)
{
}
project::~project(void)
{
}
bool project::image(char* imgName)
{
Mat imgOriginal = imread(imgName);
imshow("original", imgOriginal);
return 0;
}
this is the main.cpp file
#include "project.h"
#include <iostream>
#include <string>
using namespace std;
int main()
{
project ob1;
ob1.image("2.JPG");
getchar();
}
can someone please guide me where I am getting error. Thank you very much in advance.
you need a call to
cv::waitKey(someMillis);
after each call toimshow()
, else your window will never get updated. (you also should skip thegetchar();
here.Thank you very much. Its work fine.