forked from oEnzoRibas/cpp-OpenCV
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
25 lines (20 loc) · 711 Bytes
/
main.cpp
File metadata and controls
25 lines (20 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <opencv2/opencv.hpp>
#include <iostream>
const int WINDOW_HEIGHT = 600;
const int WINDOW_WIDTH = 800;
int main() {
std::cout << "/* Starting */" << std::endl;
cv::Mat image = cv::imread("blackhole.jpg");
if (image.empty()) {
std::cerr << "Error: Could not open image file." << std::endl;
return -1;
}
// Create a window with fixed size (not resizable)
cv::Mat resizedImage;
cv::resize(image, resizedImage, cv::Size(WINDOW_WIDTH, WINDOW_HEIGHT));
cv::namedWindow("Display Image", cv::WINDOW_NORMAL);
cv::resizeWindow("Display Image", WINDOW_WIDTH, WINDOW_HEIGHT);
cv::imshow("Display Image", resizedImage);
cv::waitKey(0);
return 0;
}