Images are now being displayed. Test code may be incorrect.
This commit is contained in:
parent
332e6e8f89
commit
fa6c998da2
|
@ -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) {
|
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);
|
string located_path = samples::findFile(image_path);
|
||||||
Mat loaded = imread(located_path, IMREAD_COLOR);
|
Mat loaded = imread(located_path, IMREAD_COLOR);
|
||||||
|
Mat resized;
|
||||||
Mat image = getBlank();
|
Mat image = getBlank();
|
||||||
|
|
||||||
if (loaded.empty()) {
|
if (loaded.empty()) {
|
||||||
cerr << "Image " << loaded << " empty" << endl;
|
cerr << "Image " << loaded << " empty" << endl;
|
||||||
} else {
|
} else {
|
||||||
cout << "Loaded image " << image_path << endl;
|
cout << "Loaded image " << image_path << endl;
|
||||||
//cout << " dim " << loaded.cols << "x" << loaded.rows << endl;
|
cout << " dim " << loaded.cols << "x" << loaded.rows << endl;
|
||||||
|
cout << "target " << w << "x" << h << endl;
|
||||||
resize(loaded, loaded, Size(h, w));
|
resize(loaded, resized, Size(h, w));
|
||||||
//cout << " image " << image.cols << "x" << image.rows << endl;
|
//cout << " image " << image.cols << "x" << image.rows << endl;
|
||||||
//cout << "resized " << resized.cols << "x" << resized.rows << endl;
|
//cout << "resized " << resized.cols << "x" << resized.rows << endl;
|
||||||
//resized.copyTo(image(Rect(0, 0, resized.cols, resized.rows)));
|
resized.copyTo(image(Rect(x, y, resized.cols, resized.rows)));
|
||||||
loaded.copyTo(image(Rect(x, y, loaded.cols, loaded.rows)));
|
|
||||||
flip(image, image, 0);
|
flip(image, image, 0);
|
||||||
|
|
||||||
#if (CV_VERSION_MAJOR >= 4)
|
#if (CV_VERSION_MAJOR >= 4)
|
||||||
|
|
|
@ -103,7 +103,7 @@ void actionLoad () {
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, 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
|
0, // Pyramid level (for mip-mapping) - 0 is the top level
|
||||||
GL_RGB, // Internal colour format to convert to
|
GL_RGB, // Internal colour format to convert to
|
||||||
image.cols, // Image width
|
image.cols, // Image width
|
||||||
|
@ -158,7 +158,7 @@ void display () {
|
||||||
auto currentTime = steady_clock::now();
|
auto currentTime = steady_clock::now();
|
||||||
auto elapsedTime = duration_cast<milliseconds>(currentTime - startTime).count();
|
auto elapsedTime = duration_cast<milliseconds>(currentTime - startTime).count();
|
||||||
if (elapsedTime > exposureTime) {
|
if (elapsedTime > exposureTime) {
|
||||||
cout << "Exposure = " << elapsedTime << " ms" << endl;
|
cout << "Exposed = " << elapsedTime << " ms" << endl;
|
||||||
displaying = false;
|
displaying = false;
|
||||||
completed = true;
|
completed = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue