#include#include int main() { std::vector myVector; // Declaration myVector.push_back(1); // Inserting elements myVector.push_back(2); myVector.push_back(3); for (int i = 0; i < myVector.size(); i++) { std::cout << myVector[i] << " "; // Accessing elements } return 0; }
#includeIn this code example, we declare a Mat object called image and read an image file into it using the imread() function. We then use the imshow() and waitKey() functions to display the image to the user. The Mat class is provided by the OpenCV package in C++.#include int main() { cv::Mat image; // Declaration image = cv::imread("image.png"); // Reading an image file cv::imshow("Image", image); // Displaying the image cv::waitKey(0); // Waiting for user input return 0; }