Gene Z. Ragan
Gene Z. Ragan

Reputation: 2873

Convert TuriCreate Image to OpenCV Mat

Is there a way to convert images loaded using image_analysis.load_images() to the cv::mat format?

I am using the OpenCV HOG detector and am stuck bridging the gap between Turi Images and OpenCV.

Thanks!

Upvotes: 0

Views: 106

Answers (1)

Gene Z. Ragan
Gene Z. Ragan

Reputation: 2873

By looking at the source code for Image, I see there is a property called pixel_data that returns the pixel data of the image object as a numpy array. I am then able to use that numpy array where a cv::mat object is asked for.

I am not a python expert, so there may be some conversion magic going on behind the scenes. If there is better way to accomplish this, please add your own answer.

Upvotes: 1

Related Questions