identifier 'imshow' and 'waitkey' is undefined
Hi,
I am trying to open the camera through opencv using 'uwp c++ blank template' in vs 2015. but i am getting error identifier 'imshow' is undefined and identifier 'waitkey' is undefined . i also install nuget package .which package did i exactly missing. code below
#include "pch.h"
#include<opencv2\opencv.hpp>
#include "MainPage.xaml.h"
using namespace OpenCam_22aug;
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
using namespace cv;
MainPage::MainPage()
{
InitializeComponent();
}
int main(int argc, char** argv)
{
VideoCapture cap;
// open the default camera, use something different from 0 otherwise;
// Check VideoCapture documentation.
if (!cap.open(0))
return 0;
for (;;)
{
Mat frame;
cap >> frame;
if (frame.empty()) break; // end of video stream
imshow("this is you, smile! :)", frame);
if (waitKey(1) == 27) break; // stop capturing by pressing ESC
}
// the camera will be closed automatically upon exit
// cap.close();
return 0;
}
Please use icon with 101010 to for format your code
May be imshow in not defined in your system. What is your operating system and compiler opencv version?
my os is windows 10 and i am using nuget package manager to install opencv package it is v0.0.2-alpha and what is '101010' i am not getting can you elaborate.
About 101010 it is about your code in your post Before post you have to select your code and click in this code. You can see difference here
Now I have never use nuget and opencv 0.0.-2 alpha it is unknow version. Can you try this program with same include and give results?
Thx for above information . Itried with the above code but following error is coming Severity Code Description Project File Line Suppression State Error LNK1181 cannot open input file 'opencv_calib3d310.lib'
I don't know nuget. If you install opencv from github and use CMake i can help you..
check this you will understand nuget link text
I understand now UWP : you want to make an universal windows application . I don't think that you can use imshow.
Check this sample.
About LNK1181 give manually path opencv_calib3d310.lib. (it is weird because it should be 2.4.10 version ?)
Thx a lot for your initiative to help me. i am checking out with sample if any issue i will contact you LBerger.
please, if you're a noob, try a non-managed (empty) project first.
managed c++ (what you're trying to use above) and opencv is not a marriage made in heaven, there's tons of (unnessecary) complications, please avoid those.