- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is Image Array? Explain with an example in C++
An array is a convenient method to store and retrieve the collection of data. In OpenCV, we can use this concept to load multiple images in an image array and show them using the array's index number.
The following program loads multiple images in a matrix array and shows the array's images called by the index number.
Example
#include<iostream> #include<opencv2/highgui/highgui.hpp> using namespace cv; using namespace std; int main(int argc,const char** argv) { Mat myImage_array[3];//declaring a matrix named myImage// namedWindow("PhotoFrame1");//declaring the window to show the image// namedWindow("PhotoFrame2");//declaring the window to show the image// namedWindow("PhotoFrame3");//declaring the window to show the image// myImage_array[0]= imread("cat.jpg");//loading the image named cat in the matrix// myImage_array[1] = imread("cat.jpg");//loading the image named cat in the matrix// myImage_array[2] = imread("cat.jpg");//loading the image named cat in the matrix// imshow("PhotoFrame1", myImage_array[0]);//display the image which is stored in the 'img' in the "MyWindow" window// imshow("PhotoFrame2", myImage_array[1]);//display the image which is stored in the 'img' in the "MyWindow" window// imshow("PhotoFrame3", myImage_array[2]);//display the image which is stored in the 'img' in the "MyWindow" window// waitKey(0);//wait till user press any key return 0; }
Output
- Related Articles
- What is an anonymous array and explain with an example in Java?
- What is meant by Splicing an array in JavaScript? Explain with an example
- What is Symbiosis? Explain with an example.
- What is heat? Explain with an example.
- What is Inheritance in Java? Explain with an example
- What is CheckBoxTreeItem in JavaFX explain with an example?
- What is shallow copy? Explain with an example in Java.
- What is deep copy? Explain with an example in Java.
- What is Bubble Sort in Python? Explain with an example?
- What is the character count? Explain with an example?
- What is a homologous series? Explain with an example.
- What is a tropic movement? Explain with an example.
- How to sort an array in JavaScript?Explain with example?
- What are polygons ? Explain with an example.
- What are isobars? Explain with an example.

Advertisements