Images are now being displayed. Test code may be incorrect.

This commit is contained in:
mmcwilliams 2024-05-14 14:54:52 -04:00
parent 332e6e8f89
commit fa6c998da2
2 changed files with 7 additions and 7 deletions

View File

@ -14,19 +14,19 @@ Mat Image::getBlank () {
Mat Image::loadImage (string& image_path, uint64_t& x, uint64_t& y, uint64_t& w, uint64_t& h) {
string located_path = samples::findFile(image_path);
Mat loaded = imread(located_path, IMREAD_COLOR);
Mat resized;
Mat image = getBlank();
if (loaded.empty()) {
cerr << "Image " << loaded << " empty" << endl;
} else {
cout << "Loaded image " << image_path << endl;
//cout << " dim " << loaded.cols << "x" << loaded.rows << endl;
resize(loaded, loaded, Size(h, w));
cout << " dim " << loaded.cols << "x" << loaded.rows << endl;
cout << "target " << w << "x" << h << endl;
resize(loaded, resized, Size(h, w));
//cout << " image " << image.cols << "x" << image.rows << endl;
//cout << "resized " << resized.cols << "x" << resized.rows << endl;
//resized.copyTo(image(Rect(0, 0, resized.cols, resized.rows)));
loaded.copyTo(image(Rect(x, y, loaded.cols, loaded.rows)));
resized.copyTo(image(Rect(x, y, resized.cols, resized.rows)));
flip(image, image, 0);
#if (CV_VERSION_MAJOR >= 4)

View File

@ -103,7 +103,7 @@ void actionLoad () {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexSubImage2D(GL_TEXTURE_2D, // Type of texture
glTexImage2D(GL_TEXTURE_2D, // Type of texture
0, // Pyramid level (for mip-mapping) - 0 is the top level
GL_RGB, // Internal colour format to convert to
image.cols, // Image width
@ -158,7 +158,7 @@ void display () {
auto currentTime = steady_clock::now();
auto elapsedTime = duration_cast<milliseconds>(currentTime - startTime).count();
if (elapsedTime > exposureTime) {
cout << "Exposure = " << elapsedTime << " ms" << endl;
cout << "Exposed = " << elapsedTime << " ms" << endl;
displaying = false;
completed = true;
}