Main Site

Forum

Docs

Register

Login

Rss feed

Search (advanced search) Google Search search the forum using google

OF forum > openframeworks > extend > Converting from ofxCvGrayscaleImage to cv::Mat and back.

« previous next »
Print

Pages: [1] Author Topic: Converting from ofxCvGrayscaleImage to cv::Mat and back. (Read 600 times)

george.profenza
Posts: 42

Converting from ofxCvGrayscaleImage to cv::Mat and back.
« on: August 18, 2012, 12:31:29 AM »

Hello, I'm currently working on a computer vision project with another developer. He's been using ofxOpenCv and I've been using ofxCv so far. I'm using a few cv functions so I'm converting to cv::Mat :
Code: view plain copy to clipboard print ?

01.

Mat cvimg = grayImage.getCvImage();//cv converts *IplImage to Mat

I've managed to convert to an ofImage:
Code: view plain copy to clipboard print ?

01. 02. 03.

ofImage oimg; toOf(cvimg,oimg); oimg.update();

but I haven't managed to convert back to an ofxCvGrayScaleImage. I can use cv to convert a cv::Mat to an IplImage and I've tried to use ofxCvGrayScaleImage = operator:
Code: view plain copy to clipboard print ?

01. 02.

IplImage iplimg = cvimg;//cv::Mat to IplImage grayImage = iplimg;

but with no luck so far. What is the correct way to convert from a cv::Mat to ofxCvGrayScaleImage ?
Logged

ronan
Posts: 7

Re: Converting from ofxCvGrayscaleImage to cv::Mat and back.
« Reply #1 on: Septem ber 06, 2012, 07:40:10 AM »

I'm completely stuck on this. I'd like to use the openCV (2D) DFT function with my regular images that I load in openframeworks.. I'm using the openCV example project so it is presently: ofxCvGrayscaleImage . Many Thanks
Logged

arturo
Adm inistrator barcelona Posts: 2411

Re: Converting from ofxCvGrayscaleImage to cv::Mat and back.
« Reply #2 on: Septem ber 06, 2012, 12:41:27 PM »

you can do:
Code: view plain copy to clipboard print ?

01. 02.

IplImage iplimg = cvimg;//cv::Mat to IplImage grayImage.getCvImage() = &iplimg;

converted by Web2PDFConvert.com

should work too without need for an intermediate IplImage Logged Pages: [1] Print « previous next » Jump to: => extend go Antep Them e by Gulhin Internet Powered by SMF 1.h or somewhere where it won't go out of scope when the function ends Logged arturo Adm inistrator barcelona Posts: 2411 Re: Converting from ofxCvGrayscaleImage to cv::Mat and back.be careful though that you IplImage declaration is in a . 12:43:04 PM » actually thinking it better: Code: view plain copy to clipboard print ? 01. Sim ple Machines Valid x htm l and css converted by Web2PDFConvert. *grayImage.com .1.15 | SMF © 2011.getCvImage() = cvimg. « Reply #3 on: Septem ber 06. 2012.

Sign up to vote on this title
UsefulNot useful