Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 1.03 KB

README.md

File metadata and controls

44 lines (32 loc) · 1.03 KB

cvimagepicker

Image file picker using opencv GUI win32, gtk3 and cocoa in c++17 you can use mouse (Double clicked is not available on macos) or keyboard to select an image

1 To select file -> Use arrow keys, page up or down to browse images or folder and enter

2 To browse folder or image -> use key 'f' or 'i'

3 To browse parent folder -> use key Home (https://en.wikipedia.org/wiki/Home_key) or fn up arrow on cocoa

Sample

#include <iostream>
#include <filesystem>

#include <opencv2/opencv.hpp>
#include <opencv2/highgui.hpp>

#include "imagepicker.hpp"

using namespace cv;
using namespace std;


int main(int argc, char** argv)
{
	string imageFolder(".");
	if (!std::filesystem::is_directory(imageFolder))
	{
		cout << imageFolder << " is not a path to a folder\n";
		cout << "set . as default folder\n";
		imageFolder = ".";
	}
	ImagePicker imageSelec(imageFolder);
	Mat img;

	while (imageSelec.run())
	{
		string fileName = imageSelec.path();
		img = imread(fileName);
		imshow("Choosen image", img);
	}
}