How to convert cv::Mat to ofImage in ofxCv?

ofApp.h

ā€¦
ofImage gray;

ofApp.cpp
//------------------
using namespace ofxCv;
using namespace cv;

//-------
void ofApp::setup() {

cv::Mat img = cv::imread("/Users/kerbal/Documents/c1.jpg");

toOf(img, gray);
gray.update();

}

//----------
void ofApp::update() {
gray.draw(10,10);
}


My Code is here.

But Nothing is shown in window. )-:

How can I convert cv::Mat to ofImage ?

Thanks in advance.

i think the correct call is toOf(gray, img)

1 Like

Thanks a lot ~