mirror of
https://github.com/opencv/opencv.git
synced 2024-11-23 18:50:21 +08:00
WinRT/UWP build: fix some specific warnings
This commit is contained in:
parent
e4bcd46f64
commit
52100328d8
@ -916,16 +916,6 @@ macro(ocv_create_module)
|
||||
POST_BUILD
|
||||
COMMAND link.exe /edit /APPCONTAINER:NO $(TargetPath))
|
||||
endif()
|
||||
|
||||
if("${the_module}" STREQUAL "opencv_ts")
|
||||
# copy required dll files; WinRT apps need these dlls that are usually substituted by Visual Studio
|
||||
# however they are not on path and need to be placed with executables to run from console w/o APPCONTAINER
|
||||
add_custom_command(TARGET ${the_module}
|
||||
POST_BUILD
|
||||
COMMAND copy /y "\"$(VCInstallDir)redist\\$(PlatformTarget)\\Microsoft.VC$(PlatformToolsetVersion).CRT\\msvcp$(PlatformToolsetVersion).dll\"" "\"${CMAKE_BINARY_DIR}\\bin\\$(Configuration)\\msvcp$(PlatformToolsetVersion)_app.dll\""
|
||||
COMMAND copy /y "\"$(VCInstallDir)redist\\$(PlatformTarget)\\Microsoft.VC$(PlatformToolsetVersion).CRT\\msvcr$(PlatformToolsetVersion).dll\"" "\"${CMAKE_BINARY_DIR}\\bin\\$(Configuration)\\msvcr$(PlatformToolsetVersion)_app.dll\""
|
||||
COMMAND copy /y "\"$(VCInstallDir)redist\\$(PlatformTarget)\\Microsoft.VC$(PlatformToolsetVersion).CRT\\vccorlib$(PlatformToolsetVersion).dll\"" "\"${CMAKE_BINARY_DIR}\\bin\\$(Configuration)\\vccorlib$(PlatformToolsetVersion)_app.dll\"")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
@ -164,9 +164,9 @@ bool getBinLocation(std::string& dst)
|
||||
#ifdef _WIN32
|
||||
bool getBinLocation(std::wstring& dst)
|
||||
{
|
||||
void* addr = (void*)getModuleLocation; // using code address, doesn't work with static linkage!
|
||||
HMODULE m = 0;
|
||||
#if _WIN32_WINNT >= 0x0501 && (!defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP))
|
||||
void* addr = (void*)getModuleLocation; // using code address, doesn't work with static linkage!
|
||||
::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
|
||||
reinterpret_cast<LPCTSTR>(addr),
|
||||
&m);
|
||||
|
@ -41,10 +41,13 @@
|
||||
__FILE__, __LINE__ ); \
|
||||
}
|
||||
|
||||
#ifdef CV_ERROR
|
||||
#undef CV_ERROR
|
||||
#define CV_ERROR( Code, Msg ) \
|
||||
{ \
|
||||
cvError( (Code), cvFuncName, Msg, __FILE__, __LINE__ ); \
|
||||
};
|
||||
#endif
|
||||
|
||||
/********************************** WinRT Specific API Implementation ******************************************/
|
||||
|
||||
@ -86,6 +89,7 @@ CV_IMPL void cvShowImage(const char* name, const CvArr* arr)
|
||||
|
||||
CV_IMPL int cvNamedWindow(const char* name, int flags)
|
||||
{
|
||||
CV_UNUSED(flags);
|
||||
CV_FUNCNAME("cvNamedWindow");
|
||||
|
||||
if (!name)
|
||||
@ -116,8 +120,6 @@ CV_IMPL int cvCreateTrackbar2(const char* trackbar_name, const char* window_name
|
||||
{
|
||||
CV_FUNCNAME("cvCreateTrackbar2");
|
||||
|
||||
int pos = 0;
|
||||
|
||||
if (!window_name || !trackbar_name)
|
||||
CV_ERROR(cv::Error::StsNullPtr, "NULL window or trackbar name");
|
||||
|
||||
@ -197,7 +199,7 @@ CV_IMPL int cvGetTrackbarPos(const char* trackbar_name, const char* window_name)
|
||||
CvTrackbar* trackbar = HighguiBridge::getInstance().findTrackbarByName(trackbar_name, window_name);
|
||||
|
||||
if (trackbar)
|
||||
pos = trackbar->getPosition();
|
||||
pos = (int)trackbar->getPosition();
|
||||
|
||||
return pos;
|
||||
}
|
||||
@ -209,11 +211,11 @@ CV_IMPL int cvWaitKey(int delay)
|
||||
CV_WINRT_NO_GUI_ERROR("cvWaitKey");
|
||||
|
||||
// see https://msdn.microsoft.com/en-us/library/windows/desktop/ms724411(v=vs.85).aspx
|
||||
int time0 = GetTickCount64();
|
||||
//int time0 = GetTickCount64();
|
||||
|
||||
for (;;)
|
||||
{
|
||||
CvWindow* window;
|
||||
// CvWindow* window;
|
||||
|
||||
if (delay <= 0)
|
||||
{
|
||||
@ -224,6 +226,7 @@ CV_IMPL int cvWaitKey(int delay)
|
||||
|
||||
CV_IMPL void cvSetMouseCallback(const char* window_name, CvMouseCallback on_mouse, void* param)
|
||||
{
|
||||
CV_UNUSED(on_mouse); CV_UNUSED(param);
|
||||
CV_WINRT_NO_GUI_ERROR("cvSetMouseCallback");
|
||||
|
||||
CV_FUNCNAME("cvSetMouseCallback");
|
||||
@ -242,11 +245,13 @@ CV_IMPL void cvSetMouseCallback(const char* window_name, CvMouseCallback on_mous
|
||||
|
||||
CV_IMPL void cvMoveWindow(const char* name, int x, int y)
|
||||
{
|
||||
CV_UNUSED(name); CV_UNUSED(x); CV_UNUSED(y);
|
||||
CV_WINRT_NO_GUI_ERROR("cvMoveWindow");
|
||||
}
|
||||
|
||||
CV_IMPL void cvResizeWindow(const char* name, int width, int height)
|
||||
{
|
||||
CV_UNUSED(name); CV_UNUSED(width); CV_UNUSED(height);
|
||||
CV_WINRT_NO_GUI_ERROR("cvResizeWindow");
|
||||
}
|
||||
|
||||
@ -269,10 +274,12 @@ CV_IMPL const char* cvGetWindowName(void*)
|
||||
}
|
||||
|
||||
void cvSetModeWindow_WinRT(const char* name, double prop_value) {
|
||||
CV_UNUSED(name); CV_UNUSED(prop_value);
|
||||
CV_WINRT_NO_GUI_ERROR("cvSetModeWindow");
|
||||
}
|
||||
|
||||
double cvGetModeWindow_WinRT(const char* name) {
|
||||
CV_UNUSED(name);
|
||||
CV_WINRT_NO_GUI_ERROR("cvGetModeWindow");
|
||||
return cv::Error::StsNotImplemented;
|
||||
}
|
||||
|
@ -64,9 +64,9 @@ HighguiBridge& HighguiBridge::getInstance()
|
||||
return instance;
|
||||
}
|
||||
|
||||
void HighguiBridge::setContainer(Windows::UI::Xaml::Controls::Panel^ container)
|
||||
void HighguiBridge::setContainer(Windows::UI::Xaml::Controls::Panel^ container_)
|
||||
{
|
||||
this->container = container;
|
||||
this->container = container_;
|
||||
}
|
||||
|
||||
CvWindow* HighguiBridge::findWindowByName(cv::String name)
|
||||
@ -190,9 +190,9 @@ void CvTrackbar::setMinPosition(double pos)
|
||||
slider->Minimum = pos;
|
||||
}
|
||||
|
||||
void CvTrackbar::setSlider(Slider^ slider) {
|
||||
if (slider)
|
||||
this->slider = slider;
|
||||
void CvTrackbar::setSlider(Slider^ slider_) {
|
||||
if (slider_)
|
||||
this->slider = slider_;
|
||||
}
|
||||
|
||||
double CvTrackbar::getPosition()
|
||||
@ -219,6 +219,7 @@ Slider^ CvTrackbar::getSlider()
|
||||
|
||||
CvWindow::CvWindow(cv::String name, int flags) : name(name)
|
||||
{
|
||||
CV_UNUSED(flags);
|
||||
this->page = (Page^)Windows::UI::Xaml::Markup::XamlReader::Load(const_cast<Platform::String^>(markupContent));
|
||||
this->sliderMap = new std::map<cv::String, CvTrackbar*>();
|
||||
|
||||
@ -246,14 +247,15 @@ CvWindow::CvWindow(cv::String name, int flags) : name(name)
|
||||
|
||||
CvWindow::~CvWindow() {}
|
||||
|
||||
void CvWindow::createSlider(cv::String name, int* val, int count, CvTrackbarCallback2 on_notify, void* userdata)
|
||||
void CvWindow::createSlider(cv::String name_, int* val, int count, CvTrackbarCallback2 on_notify, void* userdata)
|
||||
{
|
||||
CvTrackbar* trackbar = findTrackbarByName(name);
|
||||
CV_UNUSED(userdata);
|
||||
CvTrackbar* trackbar = findTrackbarByName(name_);
|
||||
|
||||
// Creating slider if name is new or reusing the existing one
|
||||
Slider^ slider = !trackbar ? ref new Slider() : trackbar->getSlider();
|
||||
|
||||
slider->Header = HighguiBridge::getInstance().convertString(name);
|
||||
slider->Header = HighguiBridge::getInstance().convertString(name_);
|
||||
|
||||
// Making slider the same size as the image control or setting minimal size.
|
||||
// This is added to cover potential edge cases because:
|
||||
@ -282,26 +284,26 @@ void CvWindow::createSlider(cv::String name, int* val, int count, CvTrackbarCall
|
||||
if (!sliderPanel) return;
|
||||
|
||||
// Adding slider to the list for current window
|
||||
CvTrackbar* trackbar = new CvTrackbar(name, slider, this);
|
||||
trackbar->callback = on_notify;
|
||||
CvTrackbar* trackbar_ = new CvTrackbar(name_, slider, this);
|
||||
trackbar_->callback = on_notify;
|
||||
slider->ValueChanged +=
|
||||
ref new Controls::Primitives::RangeBaseValueChangedEventHandler(
|
||||
[=](Platform::Object^ sender,
|
||||
Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e)
|
||||
{
|
||||
Slider^ slider = (Slider^)sender;
|
||||
trackbar->callback(slider->Value, nullptr);
|
||||
trackbar_->callback((int)slider->Value, nullptr);
|
||||
});
|
||||
this->sliderMap->insert(std::pair<cv::String, CvTrackbar*>(name, trackbar));
|
||||
this->sliderMap->insert(std::pair<cv::String, CvTrackbar*>(name_, trackbar_));
|
||||
|
||||
// Adding slider to the window
|
||||
sliderPanel->Children->Append(slider);
|
||||
}
|
||||
}
|
||||
|
||||
CvTrackbar* CvWindow::findTrackbarByName(cv::String name)
|
||||
CvTrackbar* CvWindow::findTrackbarByName(cv::String name_)
|
||||
{
|
||||
auto search = sliderMap->find(name);
|
||||
auto search = sliderMap->find(name_);
|
||||
if (search != sliderMap->end()) {
|
||||
return search->second;
|
||||
}
|
||||
@ -342,12 +344,12 @@ Page^ CvWindow::getPage()
|
||||
}
|
||||
|
||||
//TODO: prototype, not in use yet
|
||||
void CvWindow::createButton(cv::String name)
|
||||
void CvWindow::createButton(cv::String name_)
|
||||
{
|
||||
if (!buttonPanel) return;
|
||||
|
||||
Button^ b = ref new Button();
|
||||
b->Content = HighguiBridge::getInstance().convertString(name);
|
||||
b->Content = HighguiBridge::getInstance().convertString(name_);
|
||||
b->Width = 260;
|
||||
b->Height = 80;
|
||||
b->Click += ref new Windows::UI::Xaml::RoutedEventHandler(
|
||||
@ -361,4 +363,4 @@ void CvWindow::createButton(cv::String name)
|
||||
buttonPanel->Children->Append(b);
|
||||
}
|
||||
|
||||
// end
|
||||
// end
|
||||
|
@ -113,7 +113,6 @@ private:
|
||||
|
||||
// Meyers singleton
|
||||
HighguiBridge(const HighguiBridge &);
|
||||
void operator=(HighguiBridge &);
|
||||
HighguiBridge() {
|
||||
windowsMap = new std::map<cv::String, CvWindow*>();
|
||||
};
|
||||
@ -232,4 +231,4 @@ private:
|
||||
|
||||
// Default Slider size, fallback solution for unexpected edge cases
|
||||
static const double sliderDefaultWidth;
|
||||
};
|
||||
};
|
||||
|
@ -309,7 +309,7 @@ Ptr<FaceDetectorYN> FaceDetectorYN::create(const String& framework,
|
||||
#ifdef HAVE_OPENCV_DNN
|
||||
return makePtr<FaceDetectorYNImpl>(framework, bufferModel, bufferConfig, input_size, score_threshold, nms_threshold, top_k, backend_id, target_id);
|
||||
#else
|
||||
CV_UNUSED(bufferModel); CV_UNUSED(bufferConfig); CV_UNUSED(input_size); CV_UNUSED(score_threshold); CV_UNUSED(nms_threshold); CV_UNUSED(top_k); CV_UNUSED(backend_id); CV_UNUSED(target_id);
|
||||
CV_UNUSED(framework); CV_UNUSED(bufferModel); CV_UNUSED(bufferConfig); CV_UNUSED(input_size); CV_UNUSED(score_threshold); CV_UNUSED(nms_threshold); CV_UNUSED(top_k); CV_UNUSED(backend_id); CV_UNUSED(target_id);
|
||||
CV_Error(cv::Error::StsNotImplemented, "cv::FaceDetectorYN requires enabled 'dnn' module.");
|
||||
#endif
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ Ptr<FaceRecognizerSF> FaceRecognizerSF::create(const String& framework,
|
||||
#ifdef HAVE_OPENCV_DNN
|
||||
return makePtr<FaceRecognizerSFImpl>(framework, bufferModel, bufferConfig, backend_id, target_id);
|
||||
#else
|
||||
CV_UNUSED(bufferModel); CV_UNUSED(bufferConfig); CV_UNUSED(backend_id); CV_UNUSED(target_id);
|
||||
CV_UNUSED(framework); CV_UNUSED(bufferModel); CV_UNUSED(bufferConfig); CV_UNUSED(backend_id); CV_UNUSED(target_id);
|
||||
CV_Error(cv::Error::StsNotImplemented, "cv::FaceRecognizerSF requires enabled 'dnn' module");
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user