Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] - OpenCV; cv::UMat (Data Structure) #302

Open
HotDenim opened this issue Jan 7, 2021 · 2 comments
Open

[Feature Request] - OpenCV; cv::UMat (Data Structure) #302

HotDenim opened this issue Jan 7, 2021 · 2 comments

Comments

@HotDenim
Copy link

HotDenim commented Jan 7, 2021

There is the Plugin for converting the image data structure to the OpenCV (www.opencv.org) data structure, cv::Mat:

CImg/plugins/cvMat.h

But OpenCV also has a similar image data structure: cv::UMat

Can a plug-In be made for this also ?.

@xinsuinizhuan
Copy link

There is the Plugin for converting the image data structure to the OpenCV (www.opencv.org) data structure, cv::Mat:

CImg/plugins/cvMat.h

But OpenCV also has a similar image data structure: cv::UMat

Can a plug-In be made for this also ?.

how to use cv::Mat,i include the cvMat, then compile,but so many errors.

@aalbiol
Copy link

aalbiol commented Feb 25, 2021

To use the plugin:

#include <opencv2/core.hpp>
#define cimg_plugin1 "cvMat.h"
#define cimg_use_opencv
#include <CImg.h>
....

============ SAMPLE COMPLETE PROGRAM =======
#include
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp> //this is required for cv::imshow()

#define cimg_plugin1 "cvMat.h"
#define cimg_use_opencv
#include <CImg.h>

using namespace cv;
using namespace cimg_library;

int main( int argc, char** argv )
{

namedWindow( "OpenCV-Display", cv::WINDOW_AUTOSIZE );


if(argc < 2) {
	std::cerr << "An argument must be given\n";
	exit(0);
}

//Read CIMG Image
CImg cimg( argv[1] );
cimg.display("Original CIMG Image in CIMG Window\n",false);

//Create an OPENCV copy from CIMG
Mat cv_image = cimg.get_MAT();
imshow("OpenCV-Display", cv_image);
std::cout << "Press key...\n";
cv::waitKey(0); //Wait for key press
destroyWindow("OpenCV-Display"); //Close OpenCV Window

// Convert to CIMG from OPENCV
CImg cimg2(cv_image);
cimg2.display("Final CIMG Image in CIMG Window\n",false);

return 0;

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants