#includeusing namespace cv; int main() { // Load an image Mat image = imread("example.jpg"); // Get the image height int height = image.size().height; // Print the image height std::cout << "The image height is " << height << std::endl; return 0; }
#includeIn this example, the CImg library is used to load an image and get its height. The image height is then printed to the console. Both of these examples demonstrate how easy it is to access the image height attribute using C++ and various image processing libraries.using namespace cimg_library; int main() { // Load an image CImg image("example.jpg"); // Get the image height int height = image.height(); // Print the image height std::cout << "The image height is " << height << std::endl; return 0; }