Programming Language: C++ (Cpp)

Namespace/Package Name: cv

Class/Type: Mat

Method/Function: total

Examples at hotexamples.com: 30

cv::Mat::total is a function in the OpenCV C++ library that returns the total number of matrix elements.

Example 1:

cv::Mat img = cv::imread("example.jpg");

int total_pixels = img.total();

In this example, we load an image using imread from the OpenCV library and then calculate the total number of pixels in the image.

Package library: OpenCV

Example 2:

cv::Mat mat(3, 5, CV_8UC1);

int total_elements = mat.total();

In this example, we create a matrix of size 3x5 with depth of 8 bits per pixel and calculate the total number of elements in the matrix.

Package library: OpenCV

Example 1:

cv::Mat img = cv::imread("example.jpg");

int total_pixels = img.total();

In this example, we load an image using imread from the OpenCV library and then calculate the total number of pixels in the image.

Package library: OpenCV

Example 2:

cv::Mat mat(3, 5, CV_8UC1);

int total_elements = mat.total();

In this example, we create a matrix of size 3x5 with depth of 8 bits per pixel and calculate the total number of elements in the matrix.

Package library: OpenCV

Frequently Used Methods

Frequently Used Methods

Frequently Used Methods

Frequently Used Methods