opencv - DataType<cv::detail::deriv_type>::depth what is it used for -


i wondering why line used in lucas kanade tracker in opencv:

datatype<cv::detail::deriv_type>::depth

can explain me?

in opencv, depth of mat refers type of data contained in mat's data buffer. represented integer values correspond given data type. these integers commonly abstracted appropriate macro definition (e.g. uchar data represented macro cv_8u).

cv::datatype type-traits class provides method obtain corresponding integer value without having memorize macro means data type. there few cases user code needs use datatype::depth. more common datatype::type.

a simple example shows 1 possible use of datatype::depth:

cv::mat uchar_data = cv::mat::ones(3, 3, cv_8uc1); cv::mat float_data; uchar_data.convertto(float_data, cv::datatype<float>::depth);                               // ^^ equivalently replaced                               //    cv_32f macro float_data.at<float>(0,1) += 0.5f; std::cout << float_data << std::endl; 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -