#pragma once #include #include #include #include #include #pragma pack(push, 1) struct BmpHeader { uint16_t signature; // 'BM' uint32_t fileSize; // Size of the BMP file uint16_t reserved1; // Reserved uint16_t reserved2; // Reserved uint32_t dataOffset; // Offset to the start of image data }; struct BmpInfoHeader { uint32_t headerSize; // Size of the info header int32_t width; // Width of the image int32_t height; // Height of the image uint16_t planes; // Number of color planes uint16_t bitsPerPixel; // Bits per pixel uint32_t compression; // Compression type uint32_t imageSize; // Image size in bytes int32_t xPixelsPerMeter; // X resolution int32_t yPixelsPerMeter; // Y resolution uint32_t colorsUsed; // Number of colors used uint32_t colorsImportant;// Number of important colors }; #pragma pack(pop) struct BmpInfo { int32_t width; int32_t height; int32_t bitsPerPixel; uint32_t dataOffset; int32_t rowPadding; int32_t rowSize; }; class BmpLoader { public: static BmpInfo readBmpInfo(const std::string& filePath); static std::vector readBmpRegion( const std::string& filePath, const BmpInfo& info, int32_t startX, int32_t startY, int32_t width, int32_t height); static std::vector readBmpRegionAsFloat( const std::string& filePath, const BmpInfo& info, int32_t startX, int32_t startY, int32_t width, int32_t height); };