Get the App
SLTechnology News&Howtos  ›  Development  › 

How to make an electronic photo album viewer with C++ OpenCV

Shulou Source: shulou.com Published: 2022-06-02 02:07:50 10月03日 Update

This article mainly introduces the relevant knowledge of "how to use C++ OpenCV to make an electronic photo album viewer". The editor shows you the process of operation through an actual case. The method of operation is simple and fast, and it is practical. I hope this article "how to use C++ OpenCV to make an electronic photo album viewer" can help you solve the problem.

First, picture reading

If we want to view the pictures in the folder one by one, the first step is to read all the pictures in the folder.

As shown in the image above, the folder created for me contains 14 pictures. Next we'll write code to read all the pictures in this folder. Store the read pictures in the images container.

/ / read all the pictures in the folder string filename = "images"; vectorimageList; glob (filename, imageList); vectorimages; for (int I = 0; I

< imageList.size(); i++) { Mat img = imread(imageList[i]); images.push_back(img); } 现在我们已经有了images容器,其实再使用一个for循环就能够一张张读取容器里的图片了。不过这样只能一张张往下读取,直到读取完最后一张图片程序结束。本案例的需求是使用键盘按键"->

"read backwards,"Control View Down,"

Tags: Pictures canvases files folders keyboards photos cuts picture libraries dimensions controls electronic albums photo albums Clippers production containers source code photos knowledge and then Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia MariaDB Apple vpn Shulou Tech Info