How to convert cv :: Mat to python

// Generate output image cv::Mat foreground(image.size(),CV_8UC3, cv::Scalar(255,255,255)); // all white image image.copyTo(foreground,result); // bg pixels not copied 

The above code is written in C ++ using openCV, now I need to change this in python using opencv. I could not find an alternative for cv :: Mat. Please help me..

+4
source share
1 answer

Opencv in python, just β€œimport cv” and then almost the same function names. See http://opencv.willowgarage.com/documentation/python/cookbook.html

Alternatively, if you install numpy opencv, return numpy arrays

+3
source

Source: https://habr.com/ru/post/1443485/


All Articles