diff --git a/.gitignore b/.gitignore index 874eb239..7e2a60f4 100644 --- a/.gitignore +++ b/.gitignore @@ -92,3 +92,6 @@ /Projects/Cortex_test/x64/Debug /Projects/Cortex_test/x64/Release/cortex_test_2019.tlog /Projects/Cortex_test/x64/Release +/Projects/CudaWare_64_DNN_Learning/platforms +/Projects/CudaWare_64_DNN_Learning/x64/Debug/CudaWare_64_DNN_Learning.vcxproj.FileListAbsolute.txt +*.dll diff --git a/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.cpp b/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.cpp new file mode 100644 index 00000000..4173815f --- /dev/null +++ b/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.cpp @@ -0,0 +1,77 @@ +// CudaWare_64_DNN_Learning.cpp : Defines the entry point for the application. +// +#include "framework.h" +#include "CudaWare_64_DNN_Learning.h" +#include "../../lib/components/object/objectFileLoggingService.h" + +#define MAX_LOADSTRING 100 + +#define LOG(X) mpLog->Log( "Main", NULL, X ) +#define LOG_DEBUG( X ) mpLog->Log( "Main", NULL, _LOG_DEBUG, X ) +#define LOG_ERROR( X ) mpLog->Log( "Main", NULL, _LOG_ERROR, X ) + +int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, + _In_opt_ HINSTANCE hPrevInstance, + _In_ LPTSTR lpCmdLine, + _In_ int nCmdShow) +{ + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + + // TODO: Place code here. + guiClass* GUI; + GUI = guiClass::getInstance(); + GUI->init(0, NULL); + + basicLogCollection * mpLog = basicLogCollection::getInstance(); + objectFileLoggingService * fLog; + char tPath[1024]; + char* ttPtz = NULL; + //ttPtz = (char *)GUI->getApp()->applicationDirPath().toStdString().c_str(); + if (ttPtz != NULL) { + sprintf(tPath, "%s/my.log", ttPtz); + } else { + sprintf(tPath, "my.log"); + }; + fLog = new objectFileLoggingService(tPath); + mpLog->addHandler((basicLoggingService*)fLog); + printf("From now - refer to log file\n"); + LOG_DEBUG("ENTER APPLICATION"); + basicSettingsProvider * mpSettingsProvider = basicSettingsProvider::getInstance(); + config_setting_t * mpSettings; + mpSettings = mpSettingsProvider->getSubNode(NULL,(CSTR)"APPLICATION_GUI"); + + mainWinow* window; + window = mainWinow::getInstance(); + + //Check Startup Mode + int gAppStartupMode; + config_setting_t * pSetting; + + if (!config_setting_lookup_int(mpSettings, "STARTUP_WINDOW_MODE", &gAppStartupMode)) { + gAppStartupMode = 0; + pSetting = config_setting_add(mpSettings, "STARTUP_WINDOW_MODE", CONFIG_TYPE_INT); + config_setting_set_int(pSetting, gAppStartupMode); + mpSettingsProvider->compromise(); + }; + + switch (gAppStartupMode) { + case 0: window->show(); break; + case 1: window->showMaximized(); break; + case 2: window->showFullScreen(); break; + default: + gAppStartupMode = 0; + pSetting = config_setting_lookup(mpSettings, "STARTUP_WINDOW_MODE"); + config_setting_set_int(pSetting, gAppStartupMode); + mpSettingsProvider->compromise(); + window->showMaximized(); + }; + + delete GUI; + delete window; + delete mpSettingsProvider; + + LOG_DEBUG("EXIT APPLICATION"); + delete mpLog; + return 0; +} diff --git a/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.h b/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.h new file mode 100644 index 00000000..d00d47e7 --- /dev/null +++ b/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.h @@ -0,0 +1,3 @@ +#pragma once + +#include "resource.h" diff --git a/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.ico b/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.ico new file mode 100644 index 00000000..b3ec03bd Binary files /dev/null and b/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.ico differ diff --git a/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.rc b/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.rc new file mode 100644 index 00000000..0123c2df --- /dev/null +++ b/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.rc @@ -0,0 +1,151 @@ +//Microsoft Visual C++ generated resource script. +// +#pragma code_page(65001) + +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE resource. +// +#ifndef APSTUDIO_INVOKED +#include "targetver.h" +#endif +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. + +IDI_CUDAWARE64DNNLEARNING ICON "CudaWare_64_DNN_Learning.ico" +IDI_SMALL ICON "small.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDC_CUDAWARE64DNNLEARNING MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_EXIT + END + POPUP "&Help" + BEGIN + MENUITEM "&About ...", IDM_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDC_CUDAWARE64DNNLEARNING ACCELERATORS +BEGIN + "?", IDM_ABOUT, ASCII, ALT + "/", IDM_ABOUT, ASCII, ALT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About CudaWare_64_DNN_Learning" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDR_MAINFRAME,IDC_STATIC,14,14,21,20 + LTEXT "CudaWare_64_DNN_Learning, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX + LTEXT "Copyright (c) 2020",IDC_STATIC,42,26,114,8 + DEFPUSHBUTTON "OK",IDOK,113,41,50,14,WS_GROUP +END + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 163 + TOPMARGIN, 7 + BOTTOMMARGIN, 55 + END +END +#endif // APSTUDIO_INVOKED + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#ifndef APSTUDIO_INVOKED\r\n" + "#include ""targetver.h""\r\n" + "#endif\r\n" + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDC_CUDAWARE64DNNLEARNING "CUDAWARE64DNNLEARNING" + IDS_APP_TITLE "CudaWare_64_DNN_Learning" +END + +#endif +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE resource. +// + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.vcxproj b/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.vcxproj new file mode 100644 index 00000000..c68f2530 --- /dev/null +++ b/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.vcxproj @@ -0,0 +1,232 @@ + + + + + Debug + x64 + + + Release + x64 + + + + 16.0 + {C03D51D2-8661-4D85-B159-E0C9E480ED82} + Win32Proj + CudaWare64DNNLearning + 10.0 + + + + Application + true + v142 + + + + + Application + false + v142 + true + Unicode + + + + + + + + + + + + + + + + true + ..\..\lib\App\CudaWare_64_DNN_Learning;C:\LIBS\libconfig-1.5\include;C:\LIBS\Qt\5.12.2\msvc2015_64\include;C:\LIBS\pthreads\include;C:\MS_LIBS\cv3\include;C:\LIBS\ffmpeg\include;C:\LIBS\openssl\include;C:\LIBS\boost_1_72;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include;$(IncludePath) + C:\LIBS\Qt\5.12.2\msvc2015_64\lib;C:\LIBS\openssl\x64;C:\LIBS\libconfig-1.5\lib\x64;C:\LIBS\ffmpeg\static_lib\debug\x64;C:\LIBS\pthreads\lib\x64;C:\MS_LIBS\cv3\x64\vc12\lib;C:\LIBS\boost_1_72\lib64-msvc-14.2;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib\x64;$(LibraryPath) + + + false + C:\LIBS\libconfig-1.5\include;C:\LIBS\Qt\5.12.2\msvc2015_64\include;C:\LIBS\pthreads\include;$(IncludePath) + + + + + + Level3 + Disabled + _OPENCV_;_CLIENT_APPLICATION_;__GUI__;WITH_OPENSSL;WIN_XP;WIN32;PTW32_STATIC_LIB;_TIMESPEC_DEFINED;GPU;VC_EXTRALEAN;WIN32_LEAN_AND_MEAN;__STDC_FORMAT_MACROS;DEBUG;HAVE_STRUCT_TIMESPEC;__STDC_LIMIT_MACROS;__STDC_CONSTANT_MACROS;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;OPENCV;__SSE2__;VL_DISABLE_AVX;VL_EMBED_INCODE;WITH_PURE_VIRTUAL;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + true + false + true + true + /bigobj /Zc:twoPhase- /Zc:strictStrings- %(AdditionalOptions) + false + + + Windows + true + WinMainCRTStartup + cublas.lib;cublasLt.lib;cuda.lib;cudadevrt.lib;cudart.lib;cudart_static.lib;cudnn.lib;cufft.lib;cufftw.lib;curand.lib;cusolver.lib;cusolverMg.lib;cusparse.lib;nppc.lib;nppial.lib;nppicc.lib;nppicom.lib;nppidei.lib;nppif.lib;nppig.lib;nppim.lib;nppist.lib;nppisu.lib;nppitc.lib;npps.lib;nvblas.lib;nvcuvid.lib;nvencodeapi.lib;nvgraph.lib;nvjpeg.lib;nvml.lib;nvrtc.lib;OpenCL.lib;opencv_ts300d.lib;opencv_world300d.lib;pthreadVC2.lib;libconfigd.lib;%(AdditionalDependencies) + + + + + + + Level3 + MaxSpeed + true + true + true + NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Document + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Document + + + + + + Document + + + Document + + + + Document + + + Document + + + Document + + + + + + + \ No newline at end of file diff --git a/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.vcxproj.filters b/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.vcxproj.filters new file mode 100644 index 00000000..13b3f7f7 --- /dev/null +++ b/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.vcxproj.filters @@ -0,0 +1,363 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {24d0217f-3689-464e-9b44-6bb23a1f3a6a} + + + {5f874326-7b83-483f-abc4-95c938074cde} + + + {c5a4982c-a450-4900-9204-215d21b20b16} + + + {3851e2ef-c28b-4501-bd54-fd46b65be0f3} + + + {bfa94e82-d339-4f7f-a68c-86c899fa1841} + + + {df5e3d18-734d-4e8e-89ee-a54b5b092550} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files\Cortex\Base + + + Source Files\Cortex\Base + + + Source Files\Cortex\Base + + + Source Files\Cortex\Base + + + Source Files\Cortex\Base + + + Source Files\Cortex\Base + + + Source Files\Cortex\Base + + + Source Files\Cortex\Base + + + Source Files\Cortex\Base + + + Source Files\Cortex\Base + + + Source Files\Cortex\Base + + + Source Files\Cortex\Base + + + Source Files\Cortex\Base + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Layers + + + Source Files\Cortex\Cuda + + + Source Files\Cortex\Cuda + + + Source Files\Cortex\Cuda + + + Source Files\Cortex\Cuda + + + Source Files\Cortex\Cuda + + + Source Files\Cortex\Cuda + + + Source Files\Cortex\Cuda + + + Source Files\Cortex\Cuda + + + Source Files\Cortex\Cuda + + + Source Files\Cortex\Cuda + + + Source Files\Cortex\Cuda + + + Source Files\Cortex\Cuda + + + Source Files\Cortex\Cuda + + + Source Files\Cortex\Cuda + + + Source Files\Cortex\CPU + + + Source Files\Cortex\CPU + + + Source Files\Cortex\CPU + + + Source Files\Cortex\CPU + + + Source Files\Cortex\CPU + + + Source Files\Cortex\CPU + + + Source Files\Cortex\CPU + + + Source Files\Cortex\CPU + + + Source Files\Cortex\CPU + + + Source Files\Cortex\CPU + + + Source Files\Cortex\CPU + + + Source Files\Cortex\CPU + + + Source Files\Cortex\CPU + + + Source Files\Cortex\CPU + + + Source Files\Cortex\CPU + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + + + Resource Files + + + Resource Files + + + + + Source Files\CUDA modules + + + Source Files\CUDA modules + + + Source Files\CUDA modules + + + Source Files\CUDA modules + + + Source Files\CUDA modules + + + Source Files\CUDA modules + + + Source Files\CUDA modules + + + Source Files\CUDA modules + + + Source Files\CUDA modules + + + Source Files\CUDA modules + + + Source Files\Cortex\Cuda + + + \ No newline at end of file diff --git a/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.vcxproj.user b/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.vcxproj.user new file mode 100644 index 00000000..88a55094 --- /dev/null +++ b/Projects/CudaWare_64_DNN_Learning/CudaWare_64_DNN_Learning.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Projects/CudaWare_64_DNN_Learning/Resource.h b/Projects/CudaWare_64_DNN_Learning/Resource.h new file mode 100644 index 00000000..8b34eeea --- /dev/null +++ b/Projects/CudaWare_64_DNN_Learning/Resource.h @@ -0,0 +1,30 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by CudaWare_64_DNN_Learning.rc + +#define IDS_APP_TITLE 103 + +#define IDR_MAINFRAME 128 +#define IDD_CUDAWARE64DNNLEARNING_DIALOG 102 +#define IDD_ABOUTBOX 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDI_CUDAWARE64DNNLEARNING 107 +#define IDI_SMALL 108 +#define IDC_CUDAWARE64DNNLEARNING 109 +#define IDC_MYICON 2 +#ifndef IDC_STATIC +#define IDC_STATIC -1 +#endif +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS + +#define _APS_NO_MFC 130 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/Projects/CudaWare_64_DNN_Learning/default.conf b/Projects/CudaWare_64_DNN_Learning/default.conf new file mode 100644 index 00000000..000c240a --- /dev/null +++ b/Projects/CudaWare_64_DNN_Learning/default.conf @@ -0,0 +1,4 @@ +APPLICATION_GUI : +{ + STARTUP_WINDOW_MODE = 1; +}; diff --git a/Projects/CudaWare_64_DNN_Learning/framework.h b/Projects/CudaWare_64_DNN_Learning/framework.h new file mode 100644 index 00000000..58c6fd3f --- /dev/null +++ b/Projects/CudaWare_64_DNN_Learning/framework.h @@ -0,0 +1,25 @@ +// header.h : include file for standard system include files, +// or project specific include files +// + +#pragma once +#ifndef __linux__ +#include +#endif + +#include +//https://autotire.co.il/%D7%92%D7%A0%D7%98%D7%99%D7%9D-%D7%92%D7%A0%D7%98%D7%99%D7%9D-5x114.3-15 +#ifdef _NO_STDIO_IOB_FUNC_ +extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; } +#endif + +#include "main_window.h" +#include "targetver.h" +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files +#include +// C RunTime Header Files +#include +#include +#include +#include diff --git a/Projects/CudaWare_64_DNN_Learning/resources.rcc b/Projects/CudaWare_64_DNN_Learning/resources.rcc new file mode 100644 index 00000000..b6501d0e Binary files /dev/null and b/Projects/CudaWare_64_DNN_Learning/resources.rcc differ diff --git a/Projects/CudaWare_64_DNN_Learning/small.ico b/Projects/CudaWare_64_DNN_Learning/small.ico new file mode 100644 index 00000000..b3ec03bd Binary files /dev/null and b/Projects/CudaWare_64_DNN_Learning/small.ico differ diff --git a/Projects/CudaWare_64_DNN_Learning/targetver.h b/Projects/CudaWare_64_DNN_Learning/targetver.h new file mode 100644 index 00000000..bf75e089 --- /dev/null +++ b/Projects/CudaWare_64_DNN_Learning/targetver.h @@ -0,0 +1,6 @@ +#pragma once + +// // Including SDKDDKVer.h defines the highest available Windows platform. +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. +#include diff --git a/Projects/QT-Gui-App/Win32-QT-gui-application_2019.vcxproj.filters b/Projects/QT-Gui-App/Win32-QT-gui-application_2019.vcxproj.filters index 1fb09cfb..a380feb9 100644 --- a/Projects/QT-Gui-App/Win32-QT-gui-application_2019.vcxproj.filters +++ b/Projects/QT-Gui-App/Win32-QT-gui-application_2019.vcxproj.filters @@ -147,9 +147,6 @@ Source Files\GUI - - Source Files\GUI - Source Files\GUI @@ -693,6 +690,9 @@ Source Files\GUI + + Source Files\GUI + diff --git a/Windows_Workspace_2019 - Home.sln b/Windows_Workspace_2019 - Home.sln index b18dcd30..2b05a1fd 100644 --- a/Windows_Workspace_2019 - Home.sln +++ b/Windows_Workspace_2019 - Home.sln @@ -9,6 +9,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Win32-QT-gui-application_20 EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL_HAD", "Projects\SDL_HAD\SDL_HAD.vcxproj", "{FB5FF731-FE00-436C-AEF0-014ACE08D10C}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CudaWare_64_DNN_Learning", "Projects\CudaWare_64_DNN_Learning\CudaWare_64_DNN_Learning.vcxproj", "{C03D51D2-8661-4D85-B159-E0C9E480ED82}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -38,6 +40,12 @@ Global {FB5FF731-FE00-436C-AEF0-014ACE08D10C}.Release|x64.Build.0 = Release|x64 {FB5FF731-FE00-436C-AEF0-014ACE08D10C}.Release|x86.ActiveCfg = Release|Win32 {FB5FF731-FE00-436C-AEF0-014ACE08D10C}.Release|x86.Build.0 = Release|Win32 + {C03D51D2-8661-4D85-B159-E0C9E480ED82}.Debug|x64.ActiveCfg = Debug|x64 + {C03D51D2-8661-4D85-B159-E0C9E480ED82}.Debug|x64.Build.0 = Debug|x64 + {C03D51D2-8661-4D85-B159-E0C9E480ED82}.Debug|x86.ActiveCfg = Debug|x64 + {C03D51D2-8661-4D85-B159-E0C9E480ED82}.Release|x64.ActiveCfg = Release|x64 + {C03D51D2-8661-4D85-B159-E0C9E480ED82}.Release|x64.Build.0 = Release|x64 + {C03D51D2-8661-4D85-B159-E0C9E480ED82}.Release|x86.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/lib/App/CudaWare_64_DNN_Learning/main_window.cpp b/lib/App/CudaWare_64_DNN_Learning/main_window.cpp new file mode 100644 index 00000000..eb371a65 --- /dev/null +++ b/lib/App/CudaWare_64_DNN_Learning/main_window.cpp @@ -0,0 +1,275 @@ +#include "main_window.h" + +mainWinow* mainWinow::_instance = 0; + +void mainWinow::changeEvent(QEvent *event){ + if(event->type() == QEvent::WindowStateChange ){ + if (!isMinimized()) { + setAttribute(Qt::WA_Mapped); + }; + }; +}; + +mainWinow::mainWinow() : QMainWindow(){ + m_pSettings = basicSettingsProvider::getInstance()->getSubNode(NULL, (CSTR)"APPLICATION_GUI"); + m_pFactory = cortexLayersFactory::getInstance(); + m_pCortex = NULL; + m_bChangesAreSaved = true; + m_pMainWidget = new QWidget( NULL ); + m_pMainWidget->setObjectName("m_pMainWidget"); + setCentralWidget( m_pMainWidget ); + QVBoxLayout* layout = new QVBoxLayout; + layout->setContentsMargins(5, 5, 5, 5); + + //m_pMainWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + + m_pLayerTable = new QTableWidget( this ); + m_pLayerTable->setColumnCount( 5 ); + m_pLayerTable->setSortingEnabled( false ); + m_pLayerTable->setSelectionMode( QAbstractItemView::SingleSelection ); + m_pLayerTable->setSelectionBehavior( QAbstractItemView::SelectRows ); + m_pLayerTable->setGridStyle( Qt::DashLine ); + m_pLayerTable->setCornerButtonEnabled( true ); + layout->addWidget(m_pLayerTable); + + QTableWidgetItem* __qtablewidgetitem; + __qtablewidgetitem = new QTableWidgetItem(); + __qtablewidgetitem->setText("Type"); + m_pLayerTable->setHorizontalHeaderItem( 0, __qtablewidgetitem ); + __qtablewidgetitem = new QTableWidgetItem(); + __qtablewidgetitem->setText("Filter"); + m_pLayerTable->setHorizontalHeaderItem( 1, __qtablewidgetitem ); + __qtablewidgetitem = new QTableWidgetItem(); + __qtablewidgetitem->setText("FIlter Size"); + m_pLayerTable->setHorizontalHeaderItem( 2, __qtablewidgetitem ); + __qtablewidgetitem = new QTableWidgetItem(); + __qtablewidgetitem->setText("Input"); + m_pLayerTable->setHorizontalHeaderItem( 3, __qtablewidgetitem ); + __qtablewidgetitem = new QTableWidgetItem(); + __qtablewidgetitem->setText("Output"); + m_pLayerTable->setHorizontalHeaderItem( 4, __qtablewidgetitem ); + + connect(m_pLayerTable, &QTableWidget::cellClicked, this, &mainWinow::selectLayerRow ); + + + QHBoxLayout* hlayout = new QHBoxLayout; + hlayout->setContentsMargins(5, 5, 5, 5); + + m_pTabWidget = new QTabWidget( this ); + m_pTabWidget->setObjectName( "m_pTabWidget" ); + + m_pTabLayerVisual = new QWidget(); + m_pTabLayerVisual->setObjectName("m_pTabLayerVisual"); + QHBoxLayout* hlayout1 = new QHBoxLayout; + hlayout1->setContentsMargins(5, 5, 5, 5); + m_pLayerPreview = new CortexLayerWidget( m_pTabLayerVisual ); + if( m_pLayerPreview->init() ){ + + }; + hlayout1->addWidget(m_pLayerPreview); + m_pTabLayerVisual->setLayout(hlayout1); + + + m_pTabWidget->addTab(m_pTabLayerVisual, "Layer Visual"); + + m_pTabCategories = new QWidget(); + m_pTabCategories->setObjectName("m_pTabCategories"); + m_pTabWidget->addTab(m_pTabCategories, "Classes"); + + m_pTabLearning = new QWidget(); + m_pTabLearning->setObjectName("m_pTabLearning"); + m_pTabWidget->addTab(m_pTabLearning, "Learning"); + + m_pTabInput = new QWidget(); + m_pTabInput->setObjectName("m_pTabInput"); + QHBoxLayout* hlayout2 = new QHBoxLayout; + hlayout2->setContentsMargins(5, 5, 5, 5); + m_pInputStream = new MediaDestWidget( m_pTabInput ); + if( m_pInputStream->init() ){ + m_pAVLIBSource = new videoAVLIBSource(); + if (m_pAVLIBSource != NULL) { + if( m_pAVLIBSource->_open("C:\\KeepVid Pro Downloaded\\The Renter.mp4") ){ + m_pAVLIBSource->attachDestination(m_pInputStream); + }; + }; + }; + hlayout2->addWidget(m_pInputStream); + m_pTabInput->setLayout(hlayout2); + + m_pTabWidget->addTab(m_pTabInput, "Input"); + + m_pTabOutput = new QWidget(); + m_pTabOutput->setObjectName("m_pTabOutput"); + m_pOutputStream = new MediaDestWidget( m_pTabOutput ); + m_pOutputStream->init(); + + m_pTabWidget->addTab(m_pTabOutput, "Output"); + + m_pTabProcessingUnits = new QWidget(); + m_pTabProcessingUnits->setObjectName("m_pTabProcessingUnits"); + m_pTabWidget->addTab(m_pTabProcessingUnits, "Processing Unit"); + + + hlayout->addWidget(m_pTabWidget); + layout->addItem( hlayout ); + + m_pMainWidget->setLayout(layout); + + + + setObjectName("Mainwindow"); + /* Menu Things */ + actionNew_Network = new QAction( QIcon(":/general/file.png"), "&New", this ); + actionNew_Network->setShortcuts(QKeySequence::New); + actionNew_Network->setStatusTip(tr("Create a new Network")); + connect( actionNew_Network, &QAction::triggered, this, &mainWinow::newNetwork ); + + actionOpen = new QAction( QIcon(":/layout/PNG/layout/049.png"), "&Open", this ); + actionOpen->setShortcuts(QKeySequence::Open); + actionOpen->setStatusTip(tr("Open Network Config")); + connect( actionOpen, &QAction::triggered, this, &mainWinow::open ); + + actionSave = new QAction( QIcon(":/layout/PNG/layout/048.png"), "&Save", this ); + actionSave->setShortcuts(QKeySequence::Save); + actionSave->setStatusTip(tr("Save Network Config")); + connect(actionSave, &QAction::triggered, this, &mainWinow::save); + + actionSave_As = new QAction( QIcon(":/layout/PNG/layout/048.png"), "Save &As", this ); + actionSave_As->setShortcuts(QKeySequence::SaveAs); + actionSave_As->setStatusTip(tr("Save Network Config in Another File")); + connect(actionSave_As, &QAction::triggered, this, &mainWinow::saveAs); + + actionExit = new QAction( QIcon(":/layout/PNG/layout/076.png"), "&Exit", this); + actionExit->setShortcuts(QKeySequence::Close); + actionExit->setStatusTip(tr("Exit Application")); + connect(actionExit, &QAction::triggered, this, &mainWinow::exitApp); + + menuFile = menuBar()->addMenu(QIcon(":/menu/PNG/devices/008.png"),"&File"); + menuFile->setObjectName("menuFile"); + menuFile->addAction(actionNew_Network); + menuFile->addAction(actionOpen); + menuFile->addAction(actionSave); + menuFile->addAction(actionSave_As); + menuFile->addAction(actionExit); + + toolBar = addToolBar("Yoba!"); + toolBar->setObjectName("toolBar"); + toolBar->setOrientation(Qt::Horizontal); + toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + toolBar->setFloatable(true); + + tbActionAdd = toolBar->addAction(QIcon(":/layout/PNG/layout/064.png"), "Add Layer"); + tbActionInsert = toolBar->addAction(QIcon(":/layout/PNG/layout/067.png"), "Insert Layer"); + tbActionEdit = toolBar->addAction(QIcon(":/layout/PNG/layout/073.png"), "Edit Layer"); + tbActionEdit->setEnabled(false); + tbActionDelete = toolBar->addAction(QIcon(":/layout/PNG/layout/066.png"), "Delete Layer"); + tbActionDelete->setEnabled(false); + toolBar->addSeparator(); + tbActionLoadWeights = toolBar->addAction(QIcon(":/layout/PNG/layout/024.png"), "Load Weights"); + tbActionLoadWeights->setEnabled(false); + + insertToolBarBreak(toolBar); + statusBar()->showMessage("Init Done."); + + setWindowTitle(tr("Neural Network Manager")); + setMinimumSize(160, 160); +}; + +mainWinow::~mainWinow(){ + if (m_pAVLIBSource != NULL) { + m_pAVLIBSource->_stop(); + delete(m_pAVLIBSource); + }; +}; + +/** +* Returns the single instance of the object. +*/ +mainWinow* mainWinow::getInstance() { + // check if the instance has been created yet + if (0 == _instance){ + // if not, then create it + _instance = new mainWinow(); + }; + // return the single instance + return _instance; +}; + +void mainWinow::newNetwork(){ + if (m_pFactory != NULL) { + m_pFactory->cleanFactory(); + }; +}; + +void mainWinow::open(){ + QString fileName; + fileName = QFileDialog::getOpenFileName(this, "Open Data", "data/", "Data Files (*.cfg *.raw *.jpg *.bmp)"); + char fName[MAX_PATH]; + sprintf( fName, "%s", fileName.toStdString().c_str() ); + if( strlen(fName) ){ + char tBuff[1024]; + sprintf(tBuff, "Neural Network Manager: %s", fName ); + setWindowTitle(tBuff); + if (m_pCortex != NULL) { + for (uint32_t index = m_pLayerTable->rowCount(); index > -1; index-- ) m_pLayerTable->removeRow(index); + delete(m_pCortex); + m_pCortex = NULL; + }; + m_pCortex = m_pFactory->parseConfig(fName); + if( m_pCortex!= NULL ) { + for( uint32_t index = 0; index < m_pCortex->getLayersCount(); index++ ){ + char tBuff[256]; + m_pLayerTable->insertRow(index); + QTableWidgetItem * __qtablewidgetitem; + __qtablewidgetitem = new QTableWidgetItem(); + __qtablewidgetitem->setText( m_pCortex->getLayer(index)->getString() ); + m_pLayerTable->setItem( index, 0, __qtablewidgetitem ); + __qtablewidgetitem = new QTableWidgetItem(); + sprintf(tBuff, "%dx%dx%d", m_pCortex->getLayer(index)->getInputSizeWidth(), m_pCortex->getLayer(index)->getInputSizeHeight(), m_pCortex->getLayer(index)->getInputSizeChannels() ); + __qtablewidgetitem->setText(tBuff ); + m_pLayerTable->setItem(index, 3, __qtablewidgetitem); + __qtablewidgetitem = new QTableWidgetItem(); + sprintf(tBuff, "%dx%dx%d", m_pCortex->getLayer(index)->getOutputSizeWidth(), m_pCortex->getLayer(index)->getOutputSizeHeight(), m_pCortex->getLayer(index)->getOutputSizeChannels()); + __qtablewidgetitem->setText(tBuff); + m_pLayerTable->setItem(index, 4, __qtablewidgetitem); + }; + tbActionLoadWeights->setEnabled(true); + }; + }; +}; + +void mainWinow::save(){ + m_bChangesAreSaved = true; +}; + +void mainWinow::saveAs(){ + QString fileName; + fileName = QFileDialog::getSaveFileName(this, "Save Data As ...", "data/", "Data Files (*.raw *.jpg *.bmp)"); + m_bChangesAreSaved = true; +}; + +void mainWinow::exitApp() { + if (m_bChangesAreSaved) { + QApplication::quit(); + } else { + QMessageBox::StandardButton reply; + reply = QMessageBox::question( this, "Unsaved Data", "Are you sure to Quit?", QMessageBox::Yes | QMessageBox::No); + if( reply == QMessageBox::Yes ){ + QApplication::quit(); + }; + }; +}; + +void mainWinow::contextMenuEvent(QContextMenuEvent* event){ + QMenu menu(this); + //menu.addAction(cutAct); + //menu.addAction(copyAct); + //menu.addAction(pasteAct); + menu.exec(event->globalPos()); +}; + +void mainWinow::selectLayerRow( int row, int col ){ + tbActionEdit->setEnabled(true); + tbActionDelete->setEnabled(true); + m_pLayerPreview->attachCortexLayer(m_pCortex->getLayer(row)); +}; diff --git a/lib/App/CudaWare_64_DNN_Learning/main_window.h b/lib/App/CudaWare_64_DNN_Learning/main_window.h new file mode 100644 index 00000000..33f54b19 --- /dev/null +++ b/lib/App/CudaWare_64_DNN_Learning/main_window.h @@ -0,0 +1,88 @@ +#ifndef __QT5_MAIN_WINDOW_HEADER__ +#define __QT5_MAIN_WINDOW_HEADER__ + +#ifndef __linux__ + #include +#endif + +#include "../../components/base/basicSettingsProvider.h" +#include "../../gui/guiClass.h" +#include "../../data/cortex/layers/layersFactory.h" +#include "../../data/media/video/videoAVLIBSource.h" +#include "../../gui/controls/MediaDestWidget.h" +#include "../../gui/controls/CortexLayerWidget.h" + +class mainWinow : public QMainWindow{ + //Q_OBJECT + private: + config_setting_t * m_pSettings; + QWidget * m_pMainWidget; + bool m_bChangesAreSaved; + cortexLayersFactory * m_pFactory; + basicCortex * m_pCortex; + QTableWidget * m_pLayerTable; + QTabWidget * m_pTabWidget; + QWidget * m_pTabProcessingUnits; + QWidget * m_pTabNetworkStageVisual; + QWidget * m_pTabLayerVisual; + QWidget * m_pTabCategories; + QWidget * m_pTabLearning; + QWidget * m_pTabInput; + QWidget * m_pTabOutput; + videoAVLIBSource * m_pAVLIBSource; + MediaDestWidget * m_pInputStream; + MediaDestWidget * m_pOutputStream; + CortexLayerWidget * m_pLayerPreview; + void * m_pInputImage; + + private slots: + void newNetwork(); + void open(); + void save(); + void saveAs(); + void exitApp(); + void selectLayerRow( int, int ); + public: + QAction * actionNew_Network; + QAction * actionOpen; + QAction * actionSave; + QAction * actionSave_As; + QAction * actionExit; + + QAction * tbActionInsert; + QAction * tbActionAdd; + QAction * tbActionEdit; + QAction * tbActionDelete; + QAction * tbActionLoadWeights; + + QMenu * menuFile; + QToolBar * toolBar; + // Method to fetch singleton instance. + static mainWinow * getInstance(); + // Destructor + virtual ~mainWinow(); + protected: + mainWinow(); + void changeEvent(QEvent *event); + void contextMenuEvent(QContextMenuEvent* event) override; + private: + // private static member referencing the single instance of the object + // TODO: Replace basicLogCollection with the type of object you want to + // return the single instance of + static mainWinow* _instance; + + // Copy constructor + // Declared but not defined to prevent auto-generated + // copy constructor. Refer to "Effective C++" by Meyers + mainWinow(const mainWinow& src); + + // Assignment operator + // Declared but not defined to prevent auto-generated + // assignment operator. Refer to "Effective C++" by Meyers + mainWinow& operator=(const mainWinow& src); + public slots: + // void callbackSettings(void); + // void callbackClear(void); +}; + +#endif diff --git a/lib/App/CudaWare_64_DNN_Learning/main_window.ui b/lib/App/CudaWare_64_DNN_Learning/main_window.ui new file mode 100644 index 00000000..c7900ec6 --- /dev/null +++ b/lib/App/CudaWare_64_DNN_Learning/main_window.ui @@ -0,0 +1,262 @@ + + + MainWindow + + + + 0 + 0 + 794 + 604 + + + + MainWindow + + + + + + 0 + 0 + 791 + 561 + + + + + + + + + + koko + + + + + kokol + + + + + + + + + + PushButton + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + 0 + + + + Tab 1 + + + + + 20 + 10 + 321 + 211 + + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + Qt::DashLine + + + true + + + + 1 + + + + + 2 + + + + + kaka + + + + + Maka + + + + + Baka + + + + + 11 + + + + + 22 + + + + + 33 + + + + + 22 + + + + + 33 + + + + + 44 + + + + + + + Tab 2 + + + + + + + + + + + 0 + 0 + 794 + 21 + + + + + File + + + + + + + + + + + + toolBar + + + Qt::Horizontal + + + true + + + TopToolBarArea + + + true + + + + + New Network + + + + + Open + + + + + Save + + + + + Save As + + + + + + + + + listWidget + clicked(QModelIndex) + MainWindow + close() + + + 353 + 160 + + + 396 + 301 + + + + + tableWidget + cellClicked(int,int) + MainWindow + show() + + + 183 + 454 + + + 396 + 301 + + + + + diff --git a/lib/components/base/basicFunctionality.cpp b/lib/components/base/basicFunctionality.cpp index 36d07391..70774dfa 100644 --- a/lib/components/base/basicFunctionality.cpp +++ b/lib/components/base/basicFunctionality.cpp @@ -93,7 +93,7 @@ CSTR implode( CArray *Data, CSTR S_Str, U8 Start, U8 End ){ U8 REnd = End; if( Start > Data->size() ) return NULL; if( End < Start ) return NULL; - if( End > Data->size() ) REnd = Data->size()-1; + if( End > Data->size() ) REnd = (U8)(Data->size()-1); if( strlen( (*Data).at( RStart )) ){ RetVal = (CSTR) malloc( strlen( (*Data).at( RStart )) + 1 ); sprintf( RetVal,"%s",(*Data).at( RStart )); @@ -101,9 +101,11 @@ CSTR implode( CArray *Data, CSTR S_Str, U8 Start, U8 End ){ RetVal = (CSTR) malloc( 1 ); *RetVal=(char)0; }; - for( int i = RStart+1; i < REnd; i++){ - RetVal = (CSTR) realloc ( RetVal, strlen( RetVal ) + strlen( (*Data).at( i )) + 1 + strlen( S_Str ) ); - sprintf( RetVal, "%s%s%s", RetVal, S_Str, (*Data).at( i ) ); + if (RetVal != NULL) { + for (int i = RStart + 1; i < REnd; i++) { + RetVal = (CSTR)realloc(RetVal, strlen(RetVal) + strlen((*Data).at(i)) + 1 + strlen(S_Str)); + sprintf(RetVal, "%s%s%s", RetVal, S_Str, (*Data).at(i)); + }; }; return RetVal; }; diff --git a/lib/components/base/basicLIBAV.h b/lib/components/base/basicLIBAV.h index e2f5d33f..518a3a82 100644 --- a/lib/components/base/basicLIBAV.h +++ b/lib/components/base/basicLIBAV.h @@ -10,7 +10,7 @@ #ifdef _OPENCV_ #include #include - using namespace cv; + //using namespace cv; #else #ifdef _SDL_ #include @@ -63,8 +63,8 @@ extern bool _FFD_REGISTER_ALL_FLAG; #define VIDEO_PICTURE_QUEUE_SIZE 30 #define BUFFER_ALIGN 32 -#define PROCESS_YUV420P -//#define PROCESS_BGR24 +//#define PROCESS_YUV420P +#define PROCESS_BGR24 #define _NOAUDIO_ diff --git a/lib/data/cortex/base/basicCortex.cpp b/lib/data/cortex/base/basicCortex.cpp index bea51533..1eefe736 100644 --- a/lib/data/cortex/base/basicCortex.cpp +++ b/lib/data/cortex/base/basicCortex.cpp @@ -66,26 +66,33 @@ basicCortex::basicCortex(LEARNING_POLICY Policy, bool useGPU){ }; basicCortex::~basicCortex(){ + /* if (m_pOutput != NULL){ free(m_pOutput); + m_pOutput = NULL; m_nOutput = 0; }; if (m_pInput != NULL){ free(m_pInput); + m_pInput = NULL; m_nInput = 0; }; if (m_pTruth != NULL){ free(m_pTruth); + m_pTruth = NULL; m_nTruth = 0; }; if (m_pDelta != NULL){ free(m_pDelta); + m_pDelta = NULL; m_nDelta = 0; }; if (m_pWorkspace != NULL){ free(m_pWorkspace); + m_pWorkspace = NULL; m_nWorkspace = 0; - }; + };*/ + freeNetwork(); }; bool basicCortex::create(int n){ @@ -489,13 +496,6 @@ LAYER_TYPE string_to_layer_type(char * type){ return BLANK; } -/* -void basicCortex::parseConfig(char * filename){ -}; -void basicCortex::parseConfigCustom(char * filename, int batch){ -}; -*/ - void basicCortex::save(char *filename){ }; void basicCortex::saveWeights(char *filename){ diff --git a/lib/data/cortex/base/basicLayer.cpp b/lib/data/cortex/base/basicLayer.cpp index 110bd68d..7e8464a2 100644 --- a/lib/data/cortex/base/basicLayer.cpp +++ b/lib/data/cortex/base/basicLayer.cpp @@ -91,7 +91,6 @@ cortexLayer::~cortexLayer(){ FREE_HOST(m_pX); FREE_HOST(m_pCharWeight); FREE_HOST(m_pHostIndexes); - FREE_HOST(m_pGpuIndexes); #ifdef GPU if (m_pPU != NULL){ FREE_PU(m_pGpuZ); @@ -129,6 +128,7 @@ cortexLayer::~cortexLayer(){ FREE_PU(m_pGpuRand); FREE_PU(m_pGpuBinaryWeight); FREE_PU(m_pGpuBinaryInput); + FREE_PU(m_pGpuIndexes); }; #endif }; @@ -198,3 +198,27 @@ void cortexLayer::resetState(uint32_t b){ }; */ +uint32_t cortexLayer::getInputSizeWidth(){ + return m_nIn_Width; +}; + +uint32_t cortexLayer::getInputSizeHeight(){ + return m_nIn_Height; +}; + +uint32_t cortexLayer::getInputSizeChannels(){ + return m_nIn_Channels; +}; + +uint32_t cortexLayer::getOutputSizeWidth(){ + return m_nOut_Width; +}; + +uint32_t cortexLayer::getOutputSizeHeight(){ + return m_nOut_Height; +}; + +uint32_t cortexLayer::getOutputSizeChannels() { + return m_nOut_Channels; +}; + diff --git a/lib/data/cortex/base/basicLayer.h b/lib/data/cortex/base/basicLayer.h index 29737da6..16054aa8 100644 --- a/lib/data/cortex/base/basicLayer.h +++ b/lib/data/cortex/base/basicLayer.h @@ -230,6 +230,13 @@ class cortexLayer{ virtual void pull(void){}; /* regular methods */ char * getString(void); + LAYER_TYPE getType(void){ return m_eType; }; + uint32_t getInputSizeWidth(); + uint32_t getInputSizeHeight(); + uint32_t getInputSizeChannels(); + uint32_t getOutputSizeWidth(); + uint32_t getOutputSizeHeight(); + uint32_t getOutputSizeChannels(); #ifdef GPU friend class gpuCUDA; #endif @@ -238,6 +245,7 @@ class cortexLayer{ friend class routeLayer; friend class cortexProcessingUnit; friend class cortexLayersFactory; + friend class CortexLayerWidget; }; typedef std::vector layerHeap; diff --git a/lib/data/cortex/base/basicProcessingUnit.h b/lib/data/cortex/base/basicProcessingUnit.h index 37ca9e9d..3b39edf2 100644 --- a/lib/data/cortex/base/basicProcessingUnit.h +++ b/lib/data/cortex/base/basicProcessingUnit.h @@ -1,6 +1,6 @@ #ifndef __BASIC_PROCESSING_UNIT_HEADER__ #define __BASIC_PROCESSING_UNIT_HEADER__ -#define __STDC_LIMIT_MACROS + #include #include "../../../components/base/basicLogCollection.h" #include "basicData.h" diff --git a/lib/data/cortex/layers/layersFactory.cpp b/lib/data/cortex/layers/layersFactory.cpp index c38c5cb3..2b945a21 100644 --- a/lib/data/cortex/layers/layersFactory.cpp +++ b/lib/data/cortex/layers/layersFactory.cpp @@ -1006,5 +1006,18 @@ uint8_t cortexLayersFactory::getStatus(CSTR msg){ return m_bLoadingStatus; }; +void cortexLayersFactory::cleanFactory(){ + if( m_vLayers.size() ) { + for( vectorCortexLayers::iterator index = m_vLayers.begin(); index < m_vLayers.end(); index++ ){ + + }; + m_vLayers.clear(); + }; +}; + +vectorCortexLayers* cortexLayersFactory::getLayers(){ + return &m_vLayers; +}; + #undef LOG #undef LOG_ERROR diff --git a/lib/data/cortex/layers/layersFactory.h b/lib/data/cortex/layers/layersFactory.h index b1f7fd94..6ad187f5 100644 --- a/lib/data/cortex/layers/layersFactory.h +++ b/lib/data/cortex/layers/layersFactory.h @@ -68,6 +68,8 @@ class cortexLayersFactory : public basicStatusProvider{ void setPushPullMode(bool aa); void setGpuUsageMode(bool aa); virtual uint8_t getStatus(CSTR msg = NULL); + void cleanFactory(); + vectorCortexLayers * getLayers(); protected: // Constructor - protected so users cannot call it. cortexLayersFactory(); diff --git a/lib/data/media/video/videoAVLIBSource.cpp b/lib/data/media/video/videoAVLIBSource.cpp index b7ad556b..cfa79bbe 100644 --- a/lib/data/media/video/videoAVLIBSource.cpp +++ b/lib/data/media/video/videoAVLIBSource.cpp @@ -136,6 +136,7 @@ bool videoAVLIBSource::_close(void){ if (m_pVideoState == NULL) return true; if (m_pVideoState->m_bStatus < MS_OPENED) return true; + if (m_pVideoState->m_bStatus == MS_CLOSED) return true; m_pVideoState->m_bStatus = MS_CLOSING; @@ -529,7 +530,7 @@ void videoAVLIBSource::m_fThreadProc( void ){ memcpy(tFrame->bits(), m_pFrameBGR->data[0], m_pFrameBGR->linesize[0] * m_nHeight); if (m_pMediaDestination != NULL) m_pMediaDestination->pushFrame(tFrame, me ); # else -#ifdef _OPEN_CV_ +#ifdef _OPENCV_ cv::Mat *mRGB; mRGB = new cv::Mat(m_nHeight, m_nWidth, CV_8UC3); memcpy(mRGB->data, m_pFrameBGR->data[0], m_pFrameBGR->linesize[0] * m_nHeight); @@ -546,7 +547,7 @@ void videoAVLIBSource::m_fThreadProc( void ){ #endif if (m_pMediaDestination != NULL) m_pMediaDestination->pushFrame(mRGB, this); -#ifdef _OPEN_CV_ +#ifdef _OPENCV_ delete(mRGB); #endif #ifdef _SDL_ diff --git a/lib/data/storage/storageProvider.h b/lib/data/storage/storageProvider.h index 1996b967..5d784728 100644 --- a/lib/data/storage/storageProvider.h +++ b/lib/data/storage/storageProvider.h @@ -28,7 +28,7 @@ class storageProvider{ basicMutex m_mCounterProtectorMutex; public: // Method to fetch singleton instance. - static storageProvider* getInstance(CSTR Base = "data/storage"); + static storageProvider* getInstance(CSTR Base = (CSTR)"data/storage"); ~storageProvider(); bool startNewSeries(void); bool startNewEntry(void); diff --git a/lib/gui/controls/CortexLayerWidget.cpp b/lib/gui/controls/CortexLayerWidget.cpp new file mode 100644 index 00000000..60c601de --- /dev/null +++ b/lib/gui/controls/CortexLayerWidget.cpp @@ -0,0 +1,179 @@ +#include "CortexLayerWidget.h" + +#define LOG( X ) m_pLog->Log( "CortexLayerWidget", this, X ) +#define LOG_ERROR( X ) m_pLog->Log( "CortexLayerWidget", this, _LOG_ERROR, X ) + +CortexLayerWidget::CortexLayerWidget(QWidget* parent) : QWidget(parent) { + m_pLog = basicLogCollection::getInstance(); + m_pLayer = NULL; + m_bDirectDrawing = false; + setMinimumSize(QSize(320, 240)); + setSizeIncrement(QSize(20, 20)); + //m_backingStore = new QBackingStore( ); + //setBackgroundRole(QPalette::Window); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + setAutoFillBackground(false); + setAttribute(Qt::WA_OpaquePaintEvent); + setCursor(QCursor(Qt::PointingHandCursor)); + m_pPixmap = NULL; + m_pOverlayPixmap = NULL; + m_pGraber = NULL; + m_mFrame = NULL; + m_mOutput = NULL; + m_pTimer = NULL; + m_pPropertiesProtectorMutex = new basicMutex(); + m_pWidgetProtectorMutex = new basicMutex(); + m_pPropertiesProtectorMutex->lock(); + m_pWidgetProtectorMutex->lock(); +}; + +CortexLayerWidget::~CortexLayerWidget() { + +}; + +bool CortexLayerWidget::init(void) { + LOG("init."); + m_pPixmap = new QPixmap(width(), height()); //, QImage::Format_RGB888 ); + if (m_pPixmap == NULL) return false; + m_pOverlayPixmap = new QPixmap(":pictures/43a.png", "PNG"); + m_pTimer = new QTimer(); + if (m_pTimer != NULL) { + QObject::connect(m_pTimer, SIGNAL(timeout()), this, SLOT(update())); + m_pTimer->start(40); + }; + m_pPixmap->fill(Qt::black); + m_pPropertiesProtectorMutex->unlock(); + m_pWidgetProtectorMutex->unlock(); + return true; +}; + +void CortexLayerWidget::renderNow() { + m_pWidgetProtectorMutex->lock(); + try { + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + render(&painter); + } + catch (std::exception & e) { + LOG_ERROR("RenderNow exception!"); + }; + m_pWidgetProtectorMutex->unlock(); +}; + +void CortexLayerWidget::render(QPainter* painter) { + if (painter != NULL) { + try { + //char buffer[64]; + //sprintf(buffer, "Coords: %dx%d %d %d ? %d %d", pos().x(), pos().y(), width(), height(), m_nMouseX, m_nMouseY); + painter->save(); + //painter->fillRect(QRect(0, 0, width(), height()), Qt::green); + QPen BgPen(Qt::SolidPattern, 3); + BgPen.setColor(Qt::black); + //if (m_bErrorMode && m_pOverlayPixmap != NULL) { + painter->drawPixmap(QRect(0, 0, width(), height()), *m_pOverlayPixmap); + //if (m_pErrorMsg != NULL) { + //QPen FgPen(Qt::SolidPattern, 0); + //FgPen.setColor(Qt::yellow); + //painter->setPen(BgPen); + // + //painter->setPen(FgPen); + //painter->drawText(QRect(0, 0, width(), height()), Qt::AlignHCenter | Qt::AlignBaseline, m_pErrorMsg); + //}; + //} else { + painter->drawPixmap(QRect(0, 0, width(), height()), *m_pPixmap); + //}; + //if (m_bSelected) { + BgPen.setColor(Qt::blue); + painter->setPen(BgPen); + painter->drawRect(QRect(2, 2, width() - 4, height() - 4)); + //}; + //if (m_bMouseActive){ + // if (m_pOverlayPixmap != NULL){ + // painter->drawPixmap(QRect(0, 0, width(), height()), *m_pOverlayPixmap); + // }; + //}; + + if (m_pLayer != NULL) { + QPen FgPen(Qt::SolidPattern, 0); + FgPen.setColor(Qt::yellow); + painter->setPen(FgPen); + painter->drawText( QRect(0, 0, width(), height()), Qt::AlignHCenter | Qt::AlignBaseline, m_pLayer->getString() ); + switch (m_pLayer->m_eType) { + case CONVOLUTIONAL: + case DECONVOLUTIONAL: + case CONNECTED: + case MAXPOOL: + case SOFTMAX: + case DETECTION: + case DROPOUT: + case CROP: + case ROUTE: + case COST: + case NORMALIZATION: + case AVGPOOL: + case LOCAL: + case SHORTCUT: + case ACTIVE: + case RNN: + case GRU: + case LSTM: + case CRNN: + case BATCHNORM: + case NETWORK: + case XNOR: + case REGION: + case REORG: + case BLANK: + break; + }; + }; + painter->restore(); + } catch (std::exception & e) { + LOG_ERROR("Render exception!"); + }; + }; +}; + +bool CortexLayerWidget::event(QEvent* event) { + /* + if (event->type() == QEvent::UpdateRequest) { + m_bUpdateIsPending = false; + renderNow(); + return true; + } + if (event->type() == QEvent::MouseButtonRelease) { + //m_bSelected = (m_bSelected) ? false : true; + if (((QMouseEvent*)event)->button() == Qt::RightButton) { + ShowContextMenu(QPoint(((QMouseEvent*)event)->x(), ((QMouseEvent*)event)->y())); + };// else selected(m_pSignalParameter); + return true; + } + if (event->type() == QEvent::MouseButtonDblClick) { + m_bEnhanced = (m_bEnhanced) ? false : true; + renderLater(); + return true; + } + if (event->type() == QEvent::MouseMove) { + m_nMouseX = ((QMouseEvent*)event)->x(); + m_nMouseY = ((QMouseEvent*)event)->y(); + m_bMouseActive = true; + m_nMenuActivityCounter = 75;// 3 Sec + };*/ + return QWidget::event(event); +}; + +void CortexLayerWidget::exposeEvent(QExposeEvent*) { + LOG_ERROR("Expose EVT!"); +}; + +void CortexLayerWidget::paintEvent(QPaintEvent* evt) { + renderNow(); +}; + +void CortexLayerWidget::attachCortexLayer(cortexLayer* L) { + m_pLayer = L; +}; + +#undef LOG +#undef LOG_ERROR + diff --git a/lib/gui/controls/CortexLayerWidget.h b/lib/gui/controls/CortexLayerWidget.h new file mode 100644 index 00000000..5c1f5bca --- /dev/null +++ b/lib/gui/controls/CortexLayerWidget.h @@ -0,0 +1,56 @@ +#ifndef __GUI_CORTEX_LAYER_WIDGET__ +#define __GUI_CORTEX_LAYER_WIDGET__ + +#include +#include "../../components/base/basicMutex.h" +#include "../../components/base/basicThread.h" +#include "../../data/cortex/base/basicLayer.h" +#include "../guiClass.h" + +class CortexLayerWidget : public QWidget{ + private: + bool m_bDirectDrawing; + + basicLogCollection * m_pLog; + IplImage * m_pGraber; + cv::Mat * m_mFrame; + cv::Mat * m_mOutput; + cortexLayer * m_pLayer; + + //basicVideoSource *m_pCapture; + basicMutex * m_pPropertiesProtectorMutex; + basicMutex * m_pWidgetProtectorMutex; + protected: + QPixmap * m_pPixmap; + QPixmap * m_pOverlayPixmap; + public: + explicit CortexLayerWidget(QWidget* parent = NULL); + ~CortexLayerWidget(); + void attachCortexLayer( cortexLayer *L ); + virtual void render(QPainter* painter); + + bool init(void); + signals: + //void selected(void* P); + public slots: + //void setGrayScale(); + //void setEnhanced(); + //void showCameraSettings(); + //void removeThisCamera(); + void renderLater(); + void renderNow(); + //void ShowContextMenu(const QPoint& pos); + protected: + bool event(QEvent* event); + + //void resizeEvent(QResizeEvent *event); + void exposeEvent(QExposeEvent* event); + void paintEvent(QPaintEvent* event); + //void drawContents(QPainter * p, const QRectF & rect = QRectF()); + private: + bool m_bUpdateIsPending; + QTimer * m_pTimer; +}; + + +#endif \ No newline at end of file diff --git a/lib/gui/controls/MediaDestWidget.cpp b/lib/gui/controls/MediaDestWidget.cpp new file mode 100644 index 00000000..c4575e11 --- /dev/null +++ b/lib/gui/controls/MediaDestWidget.cpp @@ -0,0 +1,323 @@ +#include "MediaDestWidget.h" + +#define LOG( X ) m_pLog->Log( "MediaDestWidget", this, X ) +#define LOG_ERROR( X ) m_pLog->Log( "MediaDestWidget", this, _LOG_ERROR, X ) + +MediaDestWidget::MediaDestWidget(QWidget *parent) : + QWidget(parent), + basicMediaDestination(){ + m_bGrayScale = false; + m_bEnhanced = false; + m_bDirectDrawing = true; + m_bUpdateIsPending = false; + m_pLog = basicLogCollection::getInstance(); + //setFixedSize( 240, 180 ); + setMouseTracking( true ); + m_eStreamAspectRatio = FAR_UNKNOWN; + m_eWidgetAspectRatio = detectAspectRatio(width(), height()); + //setGeometry(m_nPosX, m_nPosY, m_nWidth+1, m_nHeight+1); + setMinimumSize(QSize(320, 240)); + setSizeIncrement(QSize(20, 20)); + //m_backingStore = new QBackingStore( ); + //setBackgroundRole(QPalette::Window); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + setAutoFillBackground(false); + setAttribute(Qt::WA_OpaquePaintEvent); + setCursor(QCursor(Qt::PointingHandCursor)); + //create(); + + m_pPixmap = NULL; + m_pOverlayPixmap = NULL; + m_pGraber = NULL; + m_mFrame = NULL; + m_mOutput = NULL; + m_pTimer = NULL; + m_bMouseActive = false; + m_bSelected = false; + m_bErrorMode = false; + m_pErrorMsg = NULL; + m_nMouseX = 0; + m_nMouseY = 0; + m_pPropertiesProtectorMutex = new basicMutex(); + m_pWidgetProtectorMutex = new basicMutex(); + m_pPropertiesProtectorMutex->lock(); + m_pWidgetProtectorMutex->lock(); + + //this->setContextMenuPolicy(Qt::CustomContextMenu); + + //connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), + // this, SLOT(ShowContextMenu(const QPoint &))); +}; + +void MediaDestWidget::ShowContextMenu(const QPoint &pos){ + QMenu contextMenu("Context menu", this); + + QAction action1("Togle Enhanced Mode", this); + action1.setIcon(QIcon(":pictures/appbar.candle.png")); + connect(&action1, &QAction::triggered, this, &MediaDestWidget::setEnhanced); + + QAction action2("Togle Video B/W", this); + action2.setIcon(QIcon(":pictures/appbar.alien.png")); + connect(&action2, &QAction::triggered, this, &MediaDestWidget::setGrayScale); + + QAction action3("Camera Settings", this); + action3.setIcon(QIcon(":pictures/appbar.cog.png")); + connect(&action3, &QAction::triggered, this, &MediaDestWidget::showCameraSettings); + + QAction action4("Remove Camera", this); + action4.setIcon(QIcon(":pictures/appbar.close.png")); + connect(&action4, &QAction::triggered, this, &MediaDestWidget::removeThisCamera); + + contextMenu.addAction(&action1); + contextMenu.addAction(&action2); + contextMenu.addAction(&action3); + contextMenu.addAction(&action4); + contextMenu.exec(mapToGlobal(pos)); +}; + +bool MediaDestWidget::event(QEvent *event){ + if (event->type() == QEvent::UpdateRequest){ + m_bUpdateIsPending = false; + renderNow(); + return true; + } + if (event->type() == QEvent::MouseButtonRelease){ + //m_bSelected = (m_bSelected) ? false : true; + if (((QMouseEvent*)event)->button() == Qt::RightButton){ + ShowContextMenu(QPoint(((QMouseEvent*)event)->x(), ((QMouseEvent*)event)->y())); + };// else selected(m_pSignalParameter); + return true; + } + if (event->type() == QEvent::MouseButtonDblClick){ + m_bEnhanced = (m_bEnhanced) ? false : true; + renderLater(); + return true; + } + if (event->type() == QEvent::MouseMove){ + m_nMouseX = ((QMouseEvent*)event)->x(); + m_nMouseY = ((QMouseEvent*)event)->y(); + m_bMouseActive = true; + m_nMenuActivityCounter = 75;// 3 Sec + }; + return QWidget::event(event); +} +//! [7] + +//! [6] +void MediaDestWidget::renderLater(){ + if (!m_bUpdateIsPending) { + m_bUpdateIsPending = true; + QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest)); + LOG("Delayed Rendering Request"); + } +} +//! [6] + + +//! [5] +//void VideoWidget::resizeEvent(QResizeEvent *resizeEvent){ +// //m_backingStore->resize(resizeEvent->size()); +// this->backingStore()->resize(resizeEvent->size()); +// if( this->isEnabled() ) +// renderNow(); +//} +//! [5] + +//! [2] +void MediaDestWidget::selected(void *P){ + //((VideoSourceChooser*)m_pParent)->selectForMainPreview(P); +}; +void MediaDestWidget::exposeEvent(QExposeEvent *){ + LOG_ERROR("Expose EVT!"); +} +//! [2] + +void MediaDestWidget::paintEvent(QPaintEvent *evt){ + renderNow(); +} + +//! [3] +void MediaDestWidget::renderNow(){ + m_pWidgetProtectorMutex->lock(); + try{ + //if (m_nMenuActivityCounter)m_nMenuActivityCounter--; + //else if (m_bMouseActive)m_bMouseActive = false; + + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + //painter.begin(this); + render(&painter); + //painter.end(); + }catch (std::exception& e){ + LOG_ERROR("RenderNow exception!"); + }; + m_pWidgetProtectorMutex->unlock(); +} +//! [3] + +//! [4] + +void MediaDestWidget::render(QPainter *painter){ + if( painter != NULL ){ + try{ + //char buffer[64]; + //sprintf(buffer, "Coords: %dx%d %d %d ? %d %d", pos().x(), pos().y(), width(), height(), m_nMouseX, m_nMouseY); + painter->save(); + //painter->fillRect(QRect(0, 0, width(), height()), Qt::green); + QPen BgPen(Qt::SolidPattern, 3); + BgPen.setColor(Qt::black); + if( m_bErrorMode && m_pOverlayPixmap!= NULL ){ + painter->drawPixmap(QRect(0, 0, width(), height()), *m_pOverlayPixmap); + if (m_pErrorMsg != NULL){ + QPen FgPen(Qt::SolidPattern, 0); + FgPen.setColor(Qt::yellow); + painter->setPen(BgPen); + painter->drawText(QRect(0, 0, width(), height()), Qt::AlignHCenter | Qt::AlignBaseline, m_pErrorMsg); + painter->setPen(FgPen); + painter->drawText(QRect(0, 0, width(), height()), Qt::AlignHCenter | Qt::AlignBaseline, m_pErrorMsg); + }; + } else { + painter->drawPixmap(QRect(0, 0, width(), height()), *m_pPixmap); + }; + if (m_bSelected){ + BgPen.setColor(Qt::blue); + painter->setPen(BgPen); + painter->drawRect(QRect(2, 2, width() - 4, height() - 4)); + }; + //if (m_bMouseActive){ + // if (m_pOverlayPixmap != NULL){ + // painter->drawPixmap(QRect(0, 0, width(), height()), *m_pOverlayPixmap); + // }; + //}; + painter->restore(); + }catch (std::exception& e){ + LOG_ERROR("Render exception!"); + }; + }; +} + + +bool MediaDestWidget::init( void ){ + m_pPixmap = new QPixmap(width(), height()); //, QImage::Format_RGB888 ); + if( m_pPixmap==NULL ) return false; + m_pOverlayPixmap = new QPixmap(":pictures/43a.png", "PNG"); + m_pTimer = new QTimer(); + if (m_pTimer != NULL){ + QObject::connect(m_pTimer, SIGNAL(timeout()), this, SLOT( update())); + //connect( m_pTimer, &QTimer::timeout, this, &QWidget::update ); + m_pTimer->start(40); + }; + m_pPixmap->fill(Qt::black); + m_pPropertiesProtectorMutex->unlock(); + m_pWidgetProtectorMutex->unlock(); + return true; +}; + +MediaDestWidget::~MediaDestWidget(){ + if (m_pTimer){ + m_pTimer->stop(); + delete(m_pTimer); + }; + delete( m_pPropertiesProtectorMutex ); + delete( m_pWidgetProtectorMutex ); +}; + +void MediaDestWidget::setGrayScale(){ + m_pPropertiesProtectorMutex->lock(); + m_bGrayScale = (m_bGrayScale) ? false : true; + m_pPropertiesProtectorMutex->unlock(); +}; + +void MediaDestWidget::setEnhanced(){ + m_pPropertiesProtectorMutex->lock(); + m_bEnhanced = (m_bEnhanced) ? false : true; + m_pPropertiesProtectorMutex->unlock(); +}; + +void MediaDestWidget::setError(bool AAA, CSTR Message){ + m_bErrorMode = AAA; + m_pErrorMsg = Message; + if (AAA) LOG("ERROR TRUE"); else LOG("ERROR FALSE"); +}; + +void MediaDestWidget::pushFrame(cv::Mat *Frame, void *src){ + if (Frame != NULL && m_pPixmap!= NULL){ + m_pPropertiesProtectorMutex->lock(); + m_eStreamAspectRatio = detectAspectRatio(Frame->cols, Frame->rows); + if (m_bGrayScale) { + cvtColor(*Frame, *Frame, CV_BGR2GRAY); + }; + if (m_bEnhanced) { + if (!m_bGrayScale) { + vector channels; + cv::Mat img_hist_equalized; + cvtColor(*Frame, img_hist_equalized, CV_BGR2YCrCb); //change the color image from BGR to YCrCb format + cv::split(img_hist_equalized, channels); //split the image into channels + cv::equalizeHist(channels[0], channels[0]); //equalize histogram on the 1st channel (Y) + merge(channels, img_hist_equalized); //merge 3 channels including the modified 1st channel into one image + cvtColor(img_hist_equalized, *Frame, CV_YCrCb2BGR); //change the color image from YCrCb to BGR format (to display image properly) + } else { + equalizeHist(*Frame, *Frame); + }; + }; + if (!m_bGrayScale){ + cvtColor(*Frame, *Frame, CV_BGR2RGB); + } else { + cvtColor(*Frame, *Frame, CV_GRAY2RGB); + }; + m_pPropertiesProtectorMutex->unlock(); + m_mOutput = Frame; + try{ + assert(m_mOutput->isContinuous()); + m_pWidgetProtectorMutex->lock(); + assert(m_pPixmap); + QPainter dbPainter(m_pPixmap); + if (m_eStreamAspectRatio != m_eWidgetAspectRatio){ + int tOffset; + if (m_eStreamAspectRatio > m_eWidgetAspectRatio){ + int tHeight; + tHeight = (int)((float)m_pPixmap->width() / m_eStreamAspectRatio); + tOffset = (m_pPixmap->height() - tHeight) >> 1; + dbPainter.drawImage(QRect(0, tOffset, width(), tHeight), + QImage((unsigned char*)m_mOutput->data, m_mOutput->cols, m_mOutput->rows, QImage::Format_RGB888), + QRect(0, 0, m_mOutput->cols, m_mOutput->rows)); + } else { + int tWidth; + tWidth = (int)((float)m_pPixmap->height() * m_eStreamAspectRatio); + tOffset = (m_pPixmap->width() - tWidth) >> 1; + dbPainter.drawImage(QRect(tOffset, 0, tWidth, height()), + QImage((unsigned char*)m_mOutput->data, m_mOutput->cols, m_mOutput->rows, QImage::Format_RGB888), + QRect(0, 0, m_mOutput->cols, m_mOutput->rows)); + }; + } else { + dbPainter.drawImage(QRect(0, 0, width(), height()), QImage((unsigned char*)m_mOutput->data, m_mOutput->cols, m_mOutput->rows, QImage::Format_RGB888), QRect(0, 0, m_mOutput->cols, m_mOutput->rows)); + }; + m_pWidgetProtectorMutex->unlock(); + } catch (std::exception& e){ + LOG_ERROR("Exception catched:"); + LOG_ERROR(e.what()); + }; + //delete(Frame); + }; +}; + +void MediaDestWidget::showCameraSettings(){ + //if (m_pSettingsDialog == NULL){ + // m_pSettingsDialog = new DialogSettingsCamera(this); + //} + //m_pSettingsDialog->attachDevice( m_pSignalParameter ); + //m_pSettingsDialog->show(); +}; + +void MediaDestWidget::removeThisCamera(){ + //if( m_pParent != NULL ){ + // if (m_pSignalParameter != NULL){ + // m_pParent->removeCamera(m_pSignalParameter); + // }; + //}; +}; + + +#undef LOG +#undef LOG_ERROR + diff --git a/lib/gui/controls/MediaDestWidget.h b/lib/gui/controls/MediaDestWidget.h new file mode 100644 index 00000000..7c55708e --- /dev/null +++ b/lib/gui/controls/MediaDestWidget.h @@ -0,0 +1,73 @@ +#ifndef __GUI_MEDIA_DESTINATION_WIDGET__ +#define __GUI_MEDIA_DESTINATION_WIDGET__ + +#include +#include "../../components/base/basicMutex.h" +#include "../../components/base/basicMediaDestination.h" +#include "../../components/base/basicLIBAV.h" +#include "../guiClass.h" + +class MediaDestWidget : public QWidget, public basicMediaDestination { +private: + U8 m_bStatus; + int m_nMouseX; + int m_nMouseY; + bool m_bMouseActive; + bool m_bSelected; + int m_nMenuActivityCounter; + bool m_bGrayScale; + bool m_bEnhanced; + bool m_bErrorMode; + CSTR m_pErrorMsg; + bool m_bDirectDrawing; + + FrameAspectRatio m_eWidgetAspectRatio; + FrameAspectRatio m_eStreamAspectRatio; + + basicLogCollection* m_pLog; + IplImage* m_pGraber; + cv::Mat* m_mFrame; + cv::Mat* m_mOutput; + + //basicVideoSource *m_pCapture; + basicMutex* m_pPropertiesProtectorMutex; + basicMutex* m_pWidgetProtectorMutex; + //void m_fThreadProc(void); + +protected: + QPixmap* m_pPixmap; + QPixmap* m_pOverlayPixmap; +public: + explicit MediaDestWidget(QWidget* parent = NULL); + ~MediaDestWidget(); + + virtual void render(QPainter* painter); + + bool init(void); + virtual void pushFrame(cv::Mat* Frame, void* src = NULL); + void setSourceType(int Type); + void setError(bool AAA, CSTR Message = NULL); +signals: + void selected(void* P); +public slots: + void setGrayScale(); + void setEnhanced(); + void showCameraSettings(); + void removeThisCamera(); + void renderLater(); + void renderNow(); + void ShowContextMenu(const QPoint& pos); +protected: + bool event(QEvent* event); + + //void resizeEvent(QResizeEvent *event); + void exposeEvent(QExposeEvent* event); + void paintEvent(QPaintEvent* event); + //void drawContents(QPainter * p, const QRectF & rect = QRectF()); +private: + bool m_bUpdateIsPending; + QTimer * m_pTimer; +}; + + +#endif \ No newline at end of file diff --git a/lib/gui/controls/VideoWidget.h b/lib/gui/controls/VideoWidget.h index 7dcbb663..5fc9d3a1 100644 --- a/lib/gui/controls/VideoWidget.h +++ b/lib/gui/controls/VideoWidget.h @@ -5,13 +5,13 @@ #include #include "../guiClass.h" -#include #include "../../components/base/basicLIBAV.h" #include "../../components/base/basicMediaDestination.h" #include "../../components/base/basicMutex.h" #include "../../components/base/basicCameraPTZ.h" #include "../../components/base/basicStatus.h" #include "../../hardware/stick/joystick.h" +#include #ifdef USE_OPENGL #include "FSGLVideoWidget.h" #else diff --git a/lib/gui/gui.h b/lib/gui/gui.h index 773656f8..7b3368a1 100644 --- a/lib/gui/gui.h +++ b/lib/gui/gui.h @@ -2,6 +2,7 @@ #define __FLTK_LIBRARY_HEADER__ #ifndef __linux__ + #include #include #include #endif @@ -145,8 +146,8 @@ #pragma comment(lib, "Qt5QuickTestd.lib") #pragma comment(lib, "Qt5QuickWidgetsd.lib") #pragma comment(lib, "Qt5RemoteObjectsd.lib") - #pragma comment(lib, "Qt5Scriptd.lib") - #pragma comment(lib, "Qt5ScriptToolsd.lib") + //#pragma comment(lib, "Qt5Scriptd.lib") + //#pragma comment(lib, "Qt5ScriptToolsd.lib") #pragma comment(lib, "Qt5Scxmld.lib") #pragma comment(lib, "Qt5Sensorsd.lib") #pragma comment(lib, "Qt5SerialBusd.lib") @@ -161,9 +162,9 @@ #pragma comment(lib, "Qt5VirtualKeyboardd.lib") #pragma comment(lib, "Qt5VulkanSupportd.lib") #pragma comment(lib, "Qt5WebChanneld.lib") - #pragma comment(lib, "Qt5WebEngineCored.lib") - #pragma comment(lib, "Qt5WebEngined.lib") - #pragma comment(lib, "Qt5WebEngineWidgetsd.lib") + //#pragma comment(lib, "Qt5WebEngineCored.lib") + //#pragma comment(lib, "Qt5WebEngined.lib") + //#pragma comment(lib, "Qt5WebEngineWidgetsd.lib") #pragma comment(lib, "Qt5WebSocketsd.lib") #pragma comment(lib, "Qt5WebViewd.lib") #pragma comment(lib, "Qt5Widgetsd.lib") diff --git a/lib/resources/cudawork_resources.qrc b/lib/resources/cudawork_resources.qrc new file mode 100644 index 00000000..7c711034 --- /dev/null +++ b/lib/resources/cudawork_resources.qrc @@ -0,0 +1,231 @@ + + + PNG/layout/001.png + PNG/layout/002.png + PNG/layout/003.png + PNG/layout/004.png + PNG/layout/005.png + PNG/layout/006.png + PNG/layout/007.png + PNG/layout/008.png + PNG/layout/009.png + PNG/layout/010.png + PNG/layout/011.png + PNG/layout/012.png + PNG/layout/013.png + PNG/layout/014.png + PNG/layout/015.png + PNG/layout/016.png + PNG/layout/017.png + PNG/layout/018.png + PNG/layout/019.png + PNG/layout/020.png + PNG/layout/021.png + PNG/layout/022.png + PNG/layout/023.png + PNG/layout/024.png + PNG/layout/025.png + PNG/layout/026.png + PNG/layout/027.png + PNG/layout/028.png + PNG/layout/029.png + PNG/layout/030.png + PNG/layout/031.png + PNG/layout/032.png + PNG/layout/033.png + PNG/layout/034.png + PNG/layout/035.png + PNG/layout/036.png + PNG/layout/037.png + PNG/layout/038.png + PNG/layout/039.png + PNG/layout/040.png + PNG/layout/041.png + PNG/layout/042.png + PNG/layout/043.png + PNG/layout/044.png + PNG/layout/045.png + PNG/layout/046.png + PNG/layout/047.png + PNG/layout/048.png + PNG/layout/049.png + PNG/layout/050.png + PNG/layout/051.png + PNG/layout/052.png + PNG/layout/053.png + PNG/layout/054.png + PNG/layout/055.png + PNG/layout/056.png + PNG/layout/057.png + PNG/layout/058.png + PNG/layout/059.png + PNG/layout/060.png + PNG/layout/061.png + PNG/layout/062.png + PNG/layout/063.png + PNG/layout/064.png + PNG/layout/065.png + PNG/layout/066.png + PNG/layout/067.png + PNG/layout/068.png + PNG/layout/069.png + PNG/layout/070.png + PNG/layout/071.png + PNG/layout/072.png + PNG/layout/073.png + PNG/layout/074.png + PNG/layout/075.png + PNG/layout/076.png + PNG/layout/077.png + PNG/layout/078.png + PNG/layout/079.png + PNG/layout/080.png + PNG/layout/081.png + PNG/layout/082.png + PNG/layout/083.png + PNG/layout/084.png + PNG/layout/085.png + PNG/layout/086.png + PNG/layout/087.png + PNG/layout/088.png + PNG/layout/089.png + PNG/layout/090.png + PNG/layout/091.png + PNG/layout/092.png + PNG/layout/093.png + PNG/layout/094.png + PNG/layout/095.png + PNG/layout/096.png + PNG/layout/097.png + PNG/layout/098.png + PNG/layout/099.png + PNG/layout/100.png + PNG/layout/101.png + PNG/layout/102.png + PNG/layout/103.png + PNG/layout/104.png + PNG/layout/105.png + PNG/layout/106.png + PNG/layout/107.png + PNG/layout/108.png + PNG/layout/109.png + PNG/layout/110.png + PNG/layout/111.png + PNG/layout/112.png + PNG/layout/113.png + PNG/layout/114.png + PNG/layout/115.png + PNG/layout/116.png + PNG/layout/117.png + PNG/layout/118.png + PNG/layout/119.png + PNG/layout/120.png + PNG/layout/121.png + PNG/layout/122.png + PNG/layout/123.png + PNG/layout/124.png + + + PNG/devices/001.png + PNG/devices/002.png + PNG/devices/003.png + PNG/devices/004.png + PNG/devices/005.png + PNG/devices/006.png + PNG/devices/007.png + PNG/devices/008.png + PNG/devices/009.png + PNG/devices/010.png + PNG/devices/011.png + PNG/devices/012.png + PNG/devices/013.png + PNG/devices/014.png + PNG/devices/015.png + PNG/devices/016.png + PNG/devices/017.png + PNG/devices/018.png + PNG/devices/019.png + PNG/devices/020.png + PNG/devices/021.png + PNG/devices/022.png + PNG/devices/023.png + PNG/devices/024.png + PNG/devices/025.png + PNG/devices/026.png + PNG/devices/027.png + PNG/devices/028.png + PNG/devices/029.png + PNG/devices/030.png + PNG/devices/031.png + PNG/devices/032.png + PNG/devices/033.png + PNG/devices/034.png + PNG/devices/035.png + PNG/devices/036.png + PNG/devices/037.png + PNG/devices/038.png + PNG/devices/039.png + PNG/devices/040.png + PNG/devices/041.png + PNG/devices/042.png + PNG/devices/043.png + PNG/devices/044.png + PNG/devices/045.png + PNG/devices/046.png + PNG/devices/047.png + PNG/devices/048.png + PNG/devices/049.png + + + 025.png + 026.png + alert.png + alert_clock.ico + alert_clock.png + audio_high.png + audio_low.png + battery_20_2.png + battery_40.png + battery_100_2.png + battery_charge.png + battery_charge_2.png + bulb.ico + bulb.png + cancel.ico + cancel.png + close.ico + close.png + cog_02_2x.png + faq.ico + faq.png + fax.ico + fax.png + file.png + id_card.ico + id_card.png + information.ico + information.png + locked.png + map_2.png + megaphone.ico + megaphone.png + page_empty_2x.png + pin_2.png + refresh (1).png + refresh.png + refresh_2x.png + resources.qrc + save.ico + save.png + settings_4.png + settings1.png + settings2.png + success.ico + success.png + target.ico + target.png + unlocked.png + watch.png + watch_2.png + + diff --git a/lib/resources/make_resource.bat b/lib/resources/make_resource.bat new file mode 100644 index 00000000..4117102b --- /dev/null +++ b/lib/resources/make_resource.bat @@ -0,0 +1 @@ +C:\LIBS\Qt\5.12.2\msvc2015_64\bin\rcc.exe -binary cudawork_resources.qrc -o resources2.rcc