To get cv::UMat from a cv::Mat in OpenCV 3.0, you use this function :
UMat cv::Mat::getUMat(int accessFlags, UMatUsageFlags usageFlags=USAGE_DEFAULT )
the variable accessFlags
is an enumeration type that takes one of the values below:
enum { ACCESS_READ=1<<24, ACCESS_WRITE=1<<25,
ACCESS_RW=3<<24, ACCESS_MASK=ACCESS_RW, ACCESS_FAST=1<<26 };
What is the purpose of using the value ACCESS_FAST
?
Although some developers never heard about UMat class and its advantages. The UMat class tells OpenCV functions to process images with an OpenCL-specific code which uses an OpenCL-enabled GPU if exists in the system (automatically switching to CPU otherwise).
so CV_8UC3 is an 8-bit unsigned integer matrix/image with 3 channels. Although it is most common that this means an RGB (or actually BGR) image, it does not mandate it. It simply means that there are three channels, and how you use them is up to you and your application.
Vec3b is the abbreviation for "vector with 3 byte entries" Here those byte entries are unsigned char values to represent values between 0 .. 255.
Vec4i is a structure for representing a vector with 4 dimensions, with each value an int. If you look at the HoughLinesP() documentation you'll see what each dimension in is in this particular case: lines – Output vector of lines.
ACCESS_FAST
is only used in the allocate
function to use memcpy
or create a temporary mat if ACCESS_FAST
is not specified. It was added to OpenCV as part of its OpenCL Shared Virtual Memory support.
cv::Mat::getUMat()
will allocate
a new UMat
and return it, forwarding accessFlags
when allocating the new matrix. If you aren't building OpenCV with OpenCL support, then ACCESS_FAST
seems mostly useless.
I'm afraid that's the limit of my knowledge. Someone more experienced with OpenCV will have to provide more a detailed answer/documentation on exactly what ACCESS_FAST
is intended for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With