/* #ifndef DPX_HPP #define DPX_HPP #include #include #include #include #include using namespace std; using namespace cv; class DPX { public: DPX(const std::string& filepath); ~DPX() = default; // Get the loaded raw image data cv::Mat getRawImage() const { return raw; } // Get image properties int getBitDepth() const { return bitDepth; } int getWidth() const { return width; } int getHeight() const { return height; } // Convert to 8-bit or 10-bit representation cv::Mat convertTo8Bit() const; cv::Mat convertTo10Bit() const; private: struct DPXHeader { uint32_t magic; // Magic number (0x53445058 or 'SDPX') uint32_t imageOffset; // Offset to image data uint32_t fileVersion; // Version number of header format uint32_t fileSize; // Total image file size in bytes uint16_t dittoKey; // Image content flag uint16_t headerSize; // Generic header length in bytes uint32_t industrySize; // Industry specific header length uint32_t userSize; // User defined data length uint32_t encryptKey; // Encryption key }; struct DPXImageElement { uint32_t dataSign; // Data sign (0 = unsigned, 1 = signed) uint32_t lowData; // Reference low data code value uint32_t lowQuantity; // Reference low quantity uint32_t highData; // Reference high data code value uint32_t highQuantity; // Reference high quantity uint8_t descriptor; // Descriptor for image element uint8_t transfer; // Transfer characteristics uint8_t colorimetric; // Colorimetric specification uint8_t bitDepth; // Bit depth uint16_t packing; // Packing method uint16_t encoding; // Encoding method }; cv::Mat raw; // Raw image data int bitDepth; // Image bit depth int width; // Image width int height; // Image height // Private helper methods void readHeader(std::ifstream& file); void readImageData(std::ifstream& file, uint32_t imageOffset); void processImageData(std::vector& buffer); void unpack10BitData(const std::vector& buffer, cv::Mat& output); void swapEndianness(uint8_t* data, size_t size); bool isLittleEndian() const; }; #endif */