InputArray is a type in the OpenCV library for passing arrays or matrices to functions as input parameters. It is defined in opencv2/core/mat.hpp header file.
Here are some examples of using InputArray:
Example 1: Converting a matrix to grayscale image
cv::Mat input = cv::imread("input_image.jpg"); // read input image cv::Mat gray; // declare output matrix cv::cvtColor(input, gray, CV_BGR2GRAY); // convert input to grayscale using InputArray type
In this example, InputArray is used to pass the input image matrix to cvtColor function which converts the input image to grayscale.
Package/Library: OpenCV
Example 2: Applying a median filter to an image
cv::Mat input = cv::imread("input_image.jpg"); // read input image cv::Mat output; // declare output matrix cv::medianBlur(input, output, 5); // apply median filter to input using InputArray type
In this example, InputArray is used to pass the input matrix to the medianBlur function which applies a median filter to the input matrix.
Package/Library: OpenCV
Example 3: Computing the histogram of an image
cv::Mat input = cv::imread("input_image.jpg"); // read input image cv::Mat hist; // declare output matrix int channels[] = { 0 }; // index of channel to compute histogram int histSize[] = { 256 }; // number of bins in histogram float range[] = { 0, 256 }; // range of pixel values const float* ranges[] = { range }; cv::calcHist(&input, 1, channels, cv::Mat(), hist, 1, histSize, ranges, true, false); // compute histogram using InputArray type
In this example, InputArray is used to pass the input matrix to the calcHist function which computes the histogram of the input matrix.
Package/Library: OpenCV
C++ (Cpp) InputArray::type - 30 examples found. These are the top rated real world C++ (Cpp) examples of InputArray::type extracted from open source projects. You can rate examples to help us improve the quality of examples.