diff --git a/ECTrainer2/ECTrainer.h b/ECTrainer2/ECTrainer.h index 8056413..34c6590 100644 --- a/ECTrainer2/ECTrainer.h +++ b/ECTrainer2/ECTrainer.h @@ -3,7 +3,7 @@ #include #include #include -//#include "myOpenCV.h" +//#include "GOpenCV.h" #define ADDR "192.168.71.50" #define EYEDEVICE_GLASS2 diff --git a/ECTrainer2/ECTrainer2.vcxproj b/ECTrainer2/ECTrainer2.vcxproj index f6e73a1..e0b80be 100644 --- a/ECTrainer2/ECTrainer2.vcxproj +++ b/ECTrainer2/ECTrainer2.vcxproj @@ -155,7 +155,7 @@ - + @@ -176,8 +176,7 @@ - - + diff --git a/ECTrainer2/ECTrainer2.vcxproj.filters b/ECTrainer2/ECTrainer2.vcxproj.filters index 68eaed4..73ca240 100644 --- a/ECTrainer2/ECTrainer2.vcxproj.filters +++ b/ECTrainer2/ECTrainer2.vcxproj.filters @@ -66,10 +66,10 @@ ソース ファイル - + ソース ファイル - + ソース ファイル @@ -80,9 +80,6 @@ ヘッダー ファイル - - ヘッダー ファイル - ヘッダー ファイル @@ -125,9 +122,6 @@ ヘッダー ファイル - - ヘッダー ファイル - ヘッダー ファイル @@ -140,6 +134,9 @@ ヘッダー ファイル + + ヘッダー ファイル + diff --git a/ECTrainer2/ECTrainerGUI.cpp b/ECTrainer2/ECTrainerGUI.cpp index 6ca8071..6629b54 100644 --- a/ECTrainer2/ECTrainerGUI.cpp +++ b/ECTrainer2/ECTrainerGUI.cpp @@ -10,7 +10,6 @@ #include "Stimulus.h" #include "Marker.h" #include "myWinUtils.h" -#include "myOpenCVutil.h" #pragma comment(lib,"winmm.lib") #define CVUI_IMPLEMENTATION @@ -126,11 +125,11 @@ // �摜�\�� cvui::text(_MainFrame, SCENE_BUFFER_POS.x, 100, "SCENE CAMERA"); - cv::Mat sceneResized = KeepAspectResize(sceneBuf, DISP_SIZE.width); + cv::Mat sceneResized = gocv::KeepAspectResize(sceneBuf, DISP_SIZE.width); cvui::image(_MainFrame, SCENE_BUFFER_POS.x, SCENE_BUFFER_POS.y, sceneResized); cvui::text(_MainFrame, DISP_IMAGE_POS.x, 100, "STIMULUS IMAGE"); - cv::Mat dispResized = KeepAspectResize(dispBuf, DISP_SIZE.width); + cv::Mat dispResized = gocv::KeepAspectResize(dispBuf, DISP_SIZE.width); cvui::image(_MainFrame, DISP_IMAGE_POS.x, DISP_IMAGE_POS.y, dispResized); // �h������ diff --git a/ECTrainer2/ECTrainerGUI.h b/ECTrainer2/ECTrainerGUI.h index da43767..7425066 100644 --- a/ECTrainer2/ECTrainerGUI.h +++ b/ECTrainer2/ECTrainerGUI.h @@ -1,7 +1,7 @@ #pragma once #include "BaseProcess.h" -#include "myOpenCV.h" +#include "GOpenCV.h" #include class DShowMovie; diff --git a/ECTrainer2/EyeTrack.h b/ECTrainer2/EyeTrack.h index 468df8e..2b4bcfd 100644 --- a/ECTrainer2/EyeTrack.h +++ b/ECTrainer2/EyeTrack.h @@ -1,7 +1,7 @@ #pragma once #include "BaseProcess.h" -#include "myOpenCV.h" +#include "GOpenCV.h" #include "RingBuffer.h" #include "MeanBuffer.h" diff --git a/ECTrainer2/GOpenCV.cpp b/ECTrainer2/GOpenCV.cpp new file mode 100644 index 0000000..8d79511 --- /dev/null +++ b/ECTrainer2/GOpenCV.cpp @@ -0,0 +1,65 @@ +#include "GOpenCV.h" + +namespace gocv { + +// �����摜���c���ɘA���\�� +void imShowMulti( + cv::String winname, std::vector& imgs, // �S�Ă̕\���摜�i8bit 3ch or 8bit 1ch�̂�) + unsigned int cols, // ���̘A���� + unsigned int rows, // �c�̘A���� + cv::Size imgsize, // �\������摜�T�C�Y + unsigned int border) { + if (imgs.size() < 1 || cols < 1 || rows < 1) return; + + unsigned int w = imgsize.width + border, h = imgsize.height + border; + cv::Mat board(h * rows + border, w * cols + border, CV_8UC3, CV_RGB(128, 128, 128)); + for (unsigned int r = 0, i = 0; r < rows; r++) { + for (unsigned int c = 0; c < cols; c++, i++) { + cv::Rect roi_rect = cv::Rect(c * w + border, r * h + border, imgsize.width, imgsize.height); + cv::Mat roi(board, roi_rect); + if (i < imgs.size()) { + if (imgs[i].type() == CV_8UC3) { + resize(imgs[i], roi, imgsize); + } else if (imgs[i].type() == CV_8UC1) { + cv::Mat c3; + cvtColor(imgs[i], c3, cv::COLOR_GRAY2BGR); + resize(c3, roi, imgsize); + } else { + putText(roi, "Color mode not matched", cv::Point(20, 20), cv::FONT_HERSHEY_COMPLEX, 0.5, CV_RGB(0, 0, 0)); + } + } else { + putText(roi, "No image", cv::Point(20, 20), cv::FONT_HERSHEY_COMPLEX, 0.5, CV_RGB(0, 0, 0)); + } + } + } + imshow(winname, board); +} + +// �c�����ۂ������T�C�Y +cv::Mat KeepAspectResize(cv::Mat& img, int width, int height) { + cv::Size outputSize; + if (width > 0) { + if (height > 0) { + // �c���w��i���T�C�Y�Ɏ��܂�悤�ɂ���j + outputSize = cv::Size(height * img.cols / img.rows, width * img.rows / img.cols); + if (outputSize.width > width) outputSize.width = width; + else outputSize.height = height; + } else { + // �����w�� + outputSize = cv::Size(width, width * img.rows / img.cols); + } + } else { + if (height > 0) { + // �c���w�� + outputSize = cv::Size(height * img.cols / img.rows, height); + } else { + // �c���ǂ�����w�薳���ꍇ�͓��͂̃R�s�[��Ԃ� + return img.clone(); + } + } + cv::Mat resized; + cv::resize(img, resized, outputSize); + return resized; +} + +}; // namespace gocv diff --git a/ECTrainer2/GOpenCV.h b/ECTrainer2/GOpenCV.h new file mode 100644 index 0000000..dcc4f00 --- /dev/null +++ b/ECTrainer2/GOpenCV.h @@ -0,0 +1,120 @@ + +// OpenCV 3�n, 4�n ���ʃw�b�_�[�t�@�C�� +// T.Nakaguchi, CFME, Chiba Univ., 2019 + +#pragma once + +// �w�b�_�[�t�@�C�� +#pragma warning(disable: 4819) +#include +#include +#pragma warning(default: 4819) + +// �o�[�W�����擾 +#define CV_VERSION_STR CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) CVAUX_STR(CV_SUBMINOR_VERSION) + +// �r���h���[�h +#ifdef _DEBUG +#define CV_EXT_STR "d.lib" +#else +#define CV_EXT_STR ".lib" +#endif + +// ���C�u�����̃����N�i�s�v�ȕ��̓R�����g�A�E�g�j +#define PRE_COMPILE 0 // �C���X�g�[���łȂ� 1 �•ʃ��C�u�����g�p���� 0 +#define PREHEAD "opencv_" + +#if PRE_COMPILE +// OpenCV3 �C���X�g�[���� +#pragma comment(lib, PREHEAD "world" CV_VERSION_STR CV_EXT_STR) // �S�� +#pragma comment(lib, PREHEAD "ts" CV_VERSION_STR CV_EXT_STR) // �f���֘A + +#else +// �•ʂ̃��C�u�����w�� �iCmake��Static�Ŏg�p���Ȃǁj +// ��{���W���[�� +#pragma comment(lib, PREHEAD "core" CV_VERSION_STR CV_EXT_STR) // Core functionality +#pragma comment(lib, PREHEAD "imgproc" CV_VERSION_STR CV_EXT_STR) // Image processing +#pragma comment(lib, PREHEAD "imgcodecs" CV_VERSION_STR CV_EXT_STR) // Image file reading and writing +#pragma comment(lib, PREHEAD "videoio" CV_VERSION_STR CV_EXT_STR) // Video I/O +#pragma comment(lib, PREHEAD "highgui" CV_VERSION_STR CV_EXT_STR) // High-level GUI +//#pragma comment(lib, PREHEAD "video" CV_VERSION_STR CV_EXT_STR) // Video Analysis +#pragma comment(lib, PREHEAD "calib3d" CV_VERSION_STR CV_EXT_STR) // Camera Calibration and 3D Reconstruction +//#pragma comment(lib, PREHEAD "features2d" CV_VERSION_STR CV_EXT_STR) // 2D Features Framework +//#pragma comment(lib, PREHEAD "objdetect" CV_VERSION_STR CV_EXT_STR) // Object Detection +//#pragma comment(lib, PREHEAD "dnn" CV_VERSION_STR CV_EXT_STR) // Deep Neural Network module +//#pragma comment(lib, PREHEAD "ml" CV_VERSION_STR CV_EXT_STR) // Machine Learning +//#pragma comment(lib, PREHEAD "flann" CV_VERSION_STR CV_EXT_STR) // Clustering and Search in Multi-Dimensional Spaces +//#pragma comment(lib, PREHEAD "photo" CV_VERSION_STR CV_EXT_STR) // Computational Photography +//#pragma comment(lib, PREHEAD "stitching" CV_VERSION_STR CV_EXT_STR) // Images stitching +//#pragma comment(lib, PREHEAD "cudaarithm" CV_VERSION_STR CV_EXT_STR) // CUDA Operations on Matrices +//#pragma comment(lib, PREHEAD "cudabgsegm" CV_VERSION_STR CV_EXT_STR) // CUDA Background Segmentation +//#pragma comment(lib, PREHEAD "cudacodec" CV_VERSION_STR CV_EXT_STR) // CUDA Video Encoding/Decoding +//#pragma comment(lib, PREHEAD "cudafeatures2d" CV_VERSION_STR CV_EXT_STR) // CUDA Feature Detection and Description +//#pragma comment(lib, PREHEAD "cudafilters" CV_VERSION_STR CV_EXT_STR) // CUDA Image Filtering +//#pragma comment(lib, PREHEAD "cudaimgproc" CV_VERSION_STR CV_EXT_STR) // CUDA Image Processing +//#pragma comment(lib, PREHEAD "cudalegacy" CV_VERSION_STR CV_EXT_STR) // CUDA Legacy support +//#pragma comment(lib, PREHEAD "cudaobjdetect" CV_VERSION_STR CV_EXT_STR) // CUDA Object Detection +//#pragma comment(lib, PREHEAD "cudaoptflow" CV_VERSION_STR CV_EXT_STR) // CUDA Optical Flow +//#pragma comment(lib, PREHEAD "cudastereo" CV_VERSION_STR CV_EXT_STR) // CUDA Stereo Correspondence +//#pragma comment(lib, PREHEAD "cudawarping" CV_VERSION_STR CV_EXT_STR) // CUDA Image Warping +//#pragma comment(lib, PREHEAD "cudev" CV_VERSION_STR CV_EXT_STR) // CUDA Device layer +//#pragma comment(lib, PREHEAD "shape" CV_VERSION_STR CV_EXT_STR) // Shape Distance and Matching +//#pragma comment(lib, PREHEAD "superres" CV_VERSION_STR CV_EXT_STR) // Super Resolution +//#pragma comment(lib, PREHEAD "videostab" CV_VERSION_STR CV_EXT_STR) // Video Stabilization +//#pragma comment(lib, PREHEAD "viz" CV_VERSION_STR CV_EXT_STR) // 3D Visualizer + +// �g�����W���[�� +#pragma comment(lib, PREHEAD "aruco" CV_VERSION_STR CV_EXT_STR) // ArUco Marker Detection +//#pragma comment(lib, PREHEAD "bgsegm" CV_VERSION_STR CV_EXT_STR) // Improved Background-Foreground Segmentation Methods +//#pragma comment(lib, PREHEAD "bioinspired" CV_VERSION_STR CV_EXT_STR) // Biologically inspired vision models and derivated tools +//#pragma comment(lib, PREHEAD "ccalib" CV_VERSION_STR CV_EXT_STR) // Custom Calibration Pattern for 3D reconstruction +//#pragma comment(lib, PREHEAD "cnn_3dobj" CV_VERSION_STR CV_EXT_STR) // 3D object recognition and pose estimation API +//#pragma comment(lib, PREHEAD "cvv" CV_VERSION_STR CV_EXT_STR) // GUI for Interactive Visual Debugging of Computer Vision Programs +//#pragma comment(lib, PREHEAD "datasets" CV_VERSION_STR CV_EXT_STR) // Framework for working with different datasets +//#pragma comment(lib, PREHEAD "dnn_objdetect" CV_VERSION_STR CV_EXT_STR) // DNN used for object detection +//#pragma comment(lib, PREHEAD "dpm" CV_VERSION_STR CV_EXT_STR) // Deformable Part-based Models +//#pragma comment(lib, PREHEAD "face" CV_VERSION_STR CV_EXT_STR) // Face Analysis +//#pragma comment(lib, PREHEAD "freetype" CV_VERSION_STR CV_EXT_STR) // Drawing UTF-8 strings with freetype/harfbuzz +//#pragma comment(lib, PREHEAD "fuzzy" CV_VERSION_STR CV_EXT_STR) // Image processing based on fuzzy mathematics +//#pragma comment(lib, PREHEAD "hdf" CV_VERSION_STR CV_EXT_STR) // Hierarchical Data Format I/O routines +//#pragma comment(lib, PREHEAD "hfs" CV_VERSION_STR CV_EXT_STR) // Hierarchical Feature Selection for Efficient Image Segmentation +//#pragma comment(lib, PREHEAD "img_hash" CV_VERSION_STR CV_EXT_STR) // The module brings implementations of different image hashing algorithms. +//#pragma comment(lib, PREHEAD "line_descriptor" CV_VERSION_STR CV_EXT_STR) // Binary descriptors for lines extracted from an image +//#pragma comment(lib, PREHEAD "matlab" CV_VERSION_STR CV_EXT_STR) // MATLAB Bridge +//#pragma comment(lib, PREHEAD "optflow" CV_VERSION_STR CV_EXT_STR) // Optical Flow Algorithms +//#pragma comment(lib, PREHEAD "ovis" CV_VERSION_STR CV_EXT_STR) // OGRE 3D Visualiser +//#pragma comment(lib, PREHEAD "phase_unwrapping" CV_VERSION_STR CV_EXT_STR) // Phase Unwrapping API +//#pragma comment(lib, PREHEAD "plot" CV_VERSION_STR CV_EXT_STR) // Plot function for Mat data +//#pragma comment(lib, PREHEAD "reg" CV_VERSION_STR CV_EXT_STR) // Image Registration +//#pragma comment(lib, PREHEAD "rgbd" CV_VERSION_STR CV_EXT_STR) // RGB-Depth Processing +//#pragma comment(lib, PREHEAD "saliency" CV_VERSION_STR CV_EXT_STR) // Saliency API +//#pragma comment(lib, PREHEAD "sfm" CV_VERSION_STR CV_EXT_STR) // Structure From Motion +//#pragma comment(lib, PREHEAD "stereo" CV_VERSION_STR CV_EXT_STR) // Stereo Correspondance Algorithms +//#pragma comment(lib, PREHEAD "structured_light" CV_VERSION_STR CV_EXT_STR) // Structured Light API +//#pragma comment(lib, PREHEAD "surface_matching" CV_VERSION_STR CV_EXT_STR) // Surface Matching +//#pragma comment(lib, PREHEAD "text" CV_VERSION_STR CV_EXT_STR) // Scene Text Detection and Recognition +//#pragma comment(lib, PREHEAD "tracking" CV_VERSION_STR CV_EXT_STR) // Tracking API +//#pragma comment(lib, PREHEAD "xfeatures2d" CV_VERSION_STR CV_EXT_STR) // Extra 2D Features Framework +//#pragma comment(lib, PREHEAD "ximgproc" CV_VERSION_STR CV_EXT_STR) // Extended Image Processing +//#pragma comment(lib, PREHEAD "xobjdetect" CV_VERSION_STR CV_EXT_STR) // Extended object detection +//#pragma comment(lib, PREHEAD "xphoto" CV_VERSION_STR CV_EXT_STR) // Additional photo processing algorithms +#endif + +//using namespace cv; + +#include + +namespace gocv { + +// �����摜���c���ɘA���\�� +void imShowMulti( + cv::String winname, std::vector& imgs, // �S�Ă̕\���摜�i8bit 3ch or 8bit 1ch�̂�) + unsigned int cols, // ���̘A���� + unsigned int rows, // �c�̘A���� + cv::Size imgsize, // �\������摜�T�C�Y + unsigned int border); + +// �c�����ۂ������T�C�Y +cv::Mat KeepAspectResize(cv::Mat& img, int width = 0, int height = 0); + +}; // namespace gocv diff --git a/ECTrainer2/ImageProc.h b/ECTrainer2/ImageProc.h index a055359..bc47970 100644 --- a/ECTrainer2/ImageProc.h +++ b/ECTrainer2/ImageProc.h @@ -1,6 +1,6 @@ #pragma once -#include "myOpenCV.h" +#include "GOpenCV.h" #include "BaseProcess.h" #include "RingBuffer.h" diff --git a/ECTrainer2/Marker.h b/ECTrainer2/Marker.h index ff5fa8b..b615ee4 100644 --- a/ECTrainer2/Marker.h +++ b/ECTrainer2/Marker.h @@ -1,6 +1,6 @@ #pragma once -#include "myOpenCV.h" +#include "GOpenCV.h" #include "RingBuffer.h" #include diff --git a/ECTrainer2/SceneCamera.h b/ECTrainer2/SceneCamera.h index 289792e..3c49f9b 100644 --- a/ECTrainer2/SceneCamera.h +++ b/ECTrainer2/SceneCamera.h @@ -1,6 +1,6 @@ #pragma once -#include "myOpenCV.h" +#include "GOpenCV.h" #include "BaseProcess.h" #include "RingBuffer.h" diff --git a/ECTrainer2/Stimulus.h b/ECTrainer2/Stimulus.h index a6ee0ef..86548ea 100644 --- a/ECTrainer2/Stimulus.h +++ b/ECTrainer2/Stimulus.h @@ -4,7 +4,7 @@ #include #include #include -#include "myOpenCV.h" +#include "GOpenCV.h" #include "RingBuffer.h" #include "MovieObject.h" #include "myWinUtils.h" diff --git a/ECTrainer2/Worker.h b/ECTrainer2/Worker.h index c33ff4e..83ee08c 100644 --- a/ECTrainer2/Worker.h +++ b/ECTrainer2/Worker.h @@ -3,7 +3,7 @@ #include #include #include -#include "myOpenCV.h" +#include "GOpenCV.h" #include "RingBuffer.h" namespace mwut { diff --git a/ECTrainer2/myOpenCV.h b/ECTrainer2/myOpenCV.h deleted file mode 100644 index cf688ae..0000000 --- a/ECTrainer2/myOpenCV.h +++ /dev/null @@ -1,103 +0,0 @@ - -// OpenCV 3�n, 4�n ���ʃw�b�_�[�t�@�C�� -// T.Nakaguchi, CFME, Chiba Univ., 2019 - -#pragma once - -// �w�b�_�[�t�@�C�� -#pragma warning(disable: 4819) -#include -#include -#pragma warning(default: 4819) - -// �o�[�W�����擾 -#define CV_VERSION_STR CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) CVAUX_STR(CV_SUBMINOR_VERSION) - -// �r���h���[�h -#ifdef _DEBUG -#define CV_EXT_STR "d.lib" -#else -#define CV_EXT_STR ".lib" -#endif - -// ���C�u�����̃����N�i�s�v�ȕ��̓R�����g�A�E�g�j -#define PRE_COMPILE 0 // �C���X�g�[���łȂ� 1 �•ʃ��C�u�����g�p���� 0 -#define PREHEAD "opencv_" - -#if PRE_COMPILE -// OpenCV3 �C���X�g�[���� -#pragma comment(lib, PREHEAD "world" CV_VERSION_STR CV_EXT_STR) // �S�� -#pragma comment(lib, PREHEAD "ts" CV_VERSION_STR CV_EXT_STR) // �f���֘A - -#else -// �•ʂ̃��C�u�����w�� �iCmake��Static�Ŏg�p���Ȃǁj -// ��{���W���[�� -#pragma comment(lib, PREHEAD "core" CV_VERSION_STR CV_EXT_STR) // Core functionality -#pragma comment(lib, PREHEAD "imgproc" CV_VERSION_STR CV_EXT_STR) // Image processing -#pragma comment(lib, PREHEAD "imgcodecs" CV_VERSION_STR CV_EXT_STR) // Image file reading and writing -#pragma comment(lib, PREHEAD "videoio" CV_VERSION_STR CV_EXT_STR) // Video I/O -#pragma comment(lib, PREHEAD "highgui" CV_VERSION_STR CV_EXT_STR) // High-level GUI -//#pragma comment(lib, PREHEAD "video" CV_VERSION_STR CV_EXT_STR) // Video Analysis -#pragma comment(lib, PREHEAD "calib3d" CV_VERSION_STR CV_EXT_STR) // Camera Calibration and 3D Reconstruction -//#pragma comment(lib, PREHEAD "features2d" CV_VERSION_STR CV_EXT_STR) // 2D Features Framework -//#pragma comment(lib, PREHEAD "objdetect" CV_VERSION_STR CV_EXT_STR) // Object Detection -//#pragma comment(lib, PREHEAD "dnn" CV_VERSION_STR CV_EXT_STR) // Deep Neural Network module -//#pragma comment(lib, PREHEAD "ml" CV_VERSION_STR CV_EXT_STR) // Machine Learning -//#pragma comment(lib, PREHEAD "flann" CV_VERSION_STR CV_EXT_STR) // Clustering and Search in Multi-Dimensional Spaces -//#pragma comment(lib, PREHEAD "photo" CV_VERSION_STR CV_EXT_STR) // Computational Photography -//#pragma comment(lib, PREHEAD "stitching" CV_VERSION_STR CV_EXT_STR) // Images stitching -//#pragma comment(lib, PREHEAD "cudaarithm" CV_VERSION_STR CV_EXT_STR) // CUDA Operations on Matrices -//#pragma comment(lib, PREHEAD "cudabgsegm" CV_VERSION_STR CV_EXT_STR) // CUDA Background Segmentation -//#pragma comment(lib, PREHEAD "cudacodec" CV_VERSION_STR CV_EXT_STR) // CUDA Video Encoding/Decoding -//#pragma comment(lib, PREHEAD "cudafeatures2d" CV_VERSION_STR CV_EXT_STR) // CUDA Feature Detection and Description -//#pragma comment(lib, PREHEAD "cudafilters" CV_VERSION_STR CV_EXT_STR) // CUDA Image Filtering -//#pragma comment(lib, PREHEAD "cudaimgproc" CV_VERSION_STR CV_EXT_STR) // CUDA Image Processing -//#pragma comment(lib, PREHEAD "cudalegacy" CV_VERSION_STR CV_EXT_STR) // CUDA Legacy support -//#pragma comment(lib, PREHEAD "cudaobjdetect" CV_VERSION_STR CV_EXT_STR) // CUDA Object Detection -//#pragma comment(lib, PREHEAD "cudaoptflow" CV_VERSION_STR CV_EXT_STR) // CUDA Optical Flow -//#pragma comment(lib, PREHEAD "cudastereo" CV_VERSION_STR CV_EXT_STR) // CUDA Stereo Correspondence -//#pragma comment(lib, PREHEAD "cudawarping" CV_VERSION_STR CV_EXT_STR) // CUDA Image Warping -//#pragma comment(lib, PREHEAD "cudev" CV_VERSION_STR CV_EXT_STR) // CUDA Device layer -//#pragma comment(lib, PREHEAD "shape" CV_VERSION_STR CV_EXT_STR) // Shape Distance and Matching -//#pragma comment(lib, PREHEAD "superres" CV_VERSION_STR CV_EXT_STR) // Super Resolution -//#pragma comment(lib, PREHEAD "videostab" CV_VERSION_STR CV_EXT_STR) // Video Stabilization -//#pragma comment(lib, PREHEAD "viz" CV_VERSION_STR CV_EXT_STR) // 3D Visualizer - -// �g�����W���[�� -#pragma comment(lib, PREHEAD "aruco" CV_VERSION_STR CV_EXT_STR) // ArUco Marker Detection -//#pragma comment(lib, PREHEAD "bgsegm" CV_VERSION_STR CV_EXT_STR) // Improved Background-Foreground Segmentation Methods -//#pragma comment(lib, PREHEAD "bioinspired" CV_VERSION_STR CV_EXT_STR) // Biologically inspired vision models and derivated tools -//#pragma comment(lib, PREHEAD "ccalib" CV_VERSION_STR CV_EXT_STR) // Custom Calibration Pattern for 3D reconstruction -//#pragma comment(lib, PREHEAD "cnn_3dobj" CV_VERSION_STR CV_EXT_STR) // 3D object recognition and pose estimation API -//#pragma comment(lib, PREHEAD "cvv" CV_VERSION_STR CV_EXT_STR) // GUI for Interactive Visual Debugging of Computer Vision Programs -//#pragma comment(lib, PREHEAD "datasets" CV_VERSION_STR CV_EXT_STR) // Framework for working with different datasets -//#pragma comment(lib, PREHEAD "dnn_objdetect" CV_VERSION_STR CV_EXT_STR) // DNN used for object detection -//#pragma comment(lib, PREHEAD "dpm" CV_VERSION_STR CV_EXT_STR) // Deformable Part-based Models -//#pragma comment(lib, PREHEAD "face" CV_VERSION_STR CV_EXT_STR) // Face Analysis -//#pragma comment(lib, PREHEAD "freetype" CV_VERSION_STR CV_EXT_STR) // Drawing UTF-8 strings with freetype/harfbuzz -//#pragma comment(lib, PREHEAD "fuzzy" CV_VERSION_STR CV_EXT_STR) // Image processing based on fuzzy mathematics -//#pragma comment(lib, PREHEAD "hdf" CV_VERSION_STR CV_EXT_STR) // Hierarchical Data Format I/O routines -//#pragma comment(lib, PREHEAD "hfs" CV_VERSION_STR CV_EXT_STR) // Hierarchical Feature Selection for Efficient Image Segmentation -//#pragma comment(lib, PREHEAD "img_hash" CV_VERSION_STR CV_EXT_STR) // The module brings implementations of different image hashing algorithms. -//#pragma comment(lib, PREHEAD "line_descriptor" CV_VERSION_STR CV_EXT_STR) // Binary descriptors for lines extracted from an image -//#pragma comment(lib, PREHEAD "matlab" CV_VERSION_STR CV_EXT_STR) // MATLAB Bridge -//#pragma comment(lib, PREHEAD "optflow" CV_VERSION_STR CV_EXT_STR) // Optical Flow Algorithms -//#pragma comment(lib, PREHEAD "ovis" CV_VERSION_STR CV_EXT_STR) // OGRE 3D Visualiser -//#pragma comment(lib, PREHEAD "phase_unwrapping" CV_VERSION_STR CV_EXT_STR) // Phase Unwrapping API -//#pragma comment(lib, PREHEAD "plot" CV_VERSION_STR CV_EXT_STR) // Plot function for Mat data -//#pragma comment(lib, PREHEAD "reg" CV_VERSION_STR CV_EXT_STR) // Image Registration -//#pragma comment(lib, PREHEAD "rgbd" CV_VERSION_STR CV_EXT_STR) // RGB-Depth Processing -//#pragma comment(lib, PREHEAD "saliency" CV_VERSION_STR CV_EXT_STR) // Saliency API -//#pragma comment(lib, PREHEAD "sfm" CV_VERSION_STR CV_EXT_STR) // Structure From Motion -//#pragma comment(lib, PREHEAD "stereo" CV_VERSION_STR CV_EXT_STR) // Stereo Correspondance Algorithms -//#pragma comment(lib, PREHEAD "structured_light" CV_VERSION_STR CV_EXT_STR) // Structured Light API -//#pragma comment(lib, PREHEAD "surface_matching" CV_VERSION_STR CV_EXT_STR) // Surface Matching -//#pragma comment(lib, PREHEAD "text" CV_VERSION_STR CV_EXT_STR) // Scene Text Detection and Recognition -//#pragma comment(lib, PREHEAD "tracking" CV_VERSION_STR CV_EXT_STR) // Tracking API -//#pragma comment(lib, PREHEAD "xfeatures2d" CV_VERSION_STR CV_EXT_STR) // Extra 2D Features Framework -//#pragma comment(lib, PREHEAD "ximgproc" CV_VERSION_STR CV_EXT_STR) // Extended Image Processing -//#pragma comment(lib, PREHEAD "xobjdetect" CV_VERSION_STR CV_EXT_STR) // Extended object detection -//#pragma comment(lib, PREHEAD "xphoto" CV_VERSION_STR CV_EXT_STR) // Additional photo processing algorithms -#endif - -//using namespace cv; diff --git a/ECTrainer2/myOpenCVutil.cpp b/ECTrainer2/myOpenCVutil.cpp deleted file mode 100644 index fac54b7..0000000 --- a/ECTrainer2/myOpenCVutil.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "myOpenCVutil.h" - -// �����摜���c���ɘA���\�� -void imShowMulti( - cv::String winname, std::vector& imgs, // �S�Ă̕\���摜�i8bit 3ch or 8bit 1ch�̂�) - unsigned int cols, // ���̘A���� - unsigned int rows, // �c�̘A���� - cv::Size imgsize, // �\������摜�T�C�Y - unsigned int border) { - if (imgs.size() < 1 || cols < 1 || rows < 1) return; - - unsigned int w = imgsize.width + border, h = imgsize.height + border; - cv::Mat board(h * rows + border, w * cols + border, CV_8UC3, CV_RGB(128, 128, 128)); - for (unsigned int r = 0, i = 0; r < rows; r++) { - for (unsigned int c = 0; c < cols; c++, i++) { - cv::Rect roi_rect = cv::Rect(c * w + border, r * h + border, imgsize.width, imgsize.height); - cv::Mat roi(board, roi_rect); - if (i < imgs.size()) { - if (imgs[i].type() == CV_8UC3) { - resize(imgs[i], roi, imgsize); - } else if (imgs[i].type() == CV_8UC1) { - cv::Mat c3; - cvtColor(imgs[i], c3, cv::COLOR_GRAY2BGR); - resize(c3, roi, imgsize); - } else { - putText(roi, "Color mode not matched", cv::Point(20, 20), cv::FONT_HERSHEY_COMPLEX, 0.5, CV_RGB(0, 0, 0)); - } - } else { - putText(roi, "No image", cv::Point(20, 20), cv::FONT_HERSHEY_COMPLEX, 0.5, CV_RGB(0, 0, 0)); - } - } - } - imshow(winname, board); -} - -// �c�����ۂ������T�C�Y -cv::Mat KeepAspectResize(cv::Mat& img, int width, int height) { - cv::Size outputSize; - if (width > 0) { - if (height > 0) { - // �c���w��i���T�C�Y�Ɏ��܂�悤�ɂ���j - outputSize = cv::Size(height * img.cols / img.rows, width * img.rows / img.cols); - if (outputSize.width > width) outputSize.width = width; - else outputSize.height = height; - } else { - // �����w�� - outputSize = cv::Size(width, width * img.rows / img.cols); - } - } else { - if (height > 0) { - // �c���w�� - outputSize = cv::Size(height * img.cols / img.rows, height); - } else { - // �c���ǂ�����w�薳���ꍇ�͓��͂̃R�s�[��Ԃ� - return img.clone(); - } - } - cv::Mat resized; - cv::resize(img, resized, outputSize); - return resized; -} diff --git a/ECTrainer2/myOpenCVutil.h b/ECTrainer2/myOpenCVutil.h deleted file mode 100644 index f4db07c..0000000 --- a/ECTrainer2/myOpenCVutil.h +++ /dev/null @@ -1,19 +0,0 @@ - -// OpenCV 3�n, 4�n ���[�e�B���e�B�t�@�C�� -// T.Nakaguchi, CFME, Chiba Univ., 2019 - -#pragma once - -#include "myOpenCV.h" -#include - -// �����摜���c���ɘA���\�� -void imShowMulti( - cv::String winname, std::vector& imgs, // �S�Ă̕\���摜�i8bit 3ch or 8bit 1ch�̂�) - unsigned int cols, // ���̘A���� - unsigned int rows, // �c�̘A���� - cv::Size imgsize, // �\������摜�T�C�Y - unsigned int border); - -// �c�����ۂ������T�C�Y -cv::Mat KeepAspectResize(cv::Mat& img, int width = 0, int height = 0);