summaryrefslogtreecommitdiff
path: root/python/openvino/runtime/streaming/image_streaming_app/bmp_file.h
blob: 95ab3063522409d160cb909b7c748e8581200a62 (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2023 Intel Corporation.
//
// This software and the related documents are Intel copyrighted materials,
// and your use of them is governed by the express license under which they
// were provided to you ("License"). Unless the License provides otherwise,
// you may not use, modify, copy, publish, distribute, disclose or transmit
// this software or the related documents without Intel's prior written
// permission.
//
// This software and the related documents are provided as is, with no express
// or implied warranties, other than those that are expressly stated in the
// License.

#pragma once
#include <cstdint>
#include <string>
#include <vector>

struct BitmapHeader {
  uint32_t _size;
  int32_t _width;
  int32_t _height;
  uint16_t _planes;
  uint16_t _bitCount;
  uint32_t _compression;
  uint32_t _sizeImage;
  int32_t _xPixelsPerMeter;
  int32_t _yPixelsPerMeter;
  uint32_t _colorUsed;
  uint32_t _colorImportant;
};

class BmpFile {
 public:
  BmpFile(const std::string& filename, bool planarBGR);
  std::vector<uint8_t>& GetData() { return _data; }
  uint32_t GetNumPixels() { return (_width * _height); }

 private:
  bool LoadFile(const std::string& filename, bool planarBGR);
  std::vector<uint8_t> _data;
  uint32_t _width = 0;
  uint32_t _height = 0;
  uint32_t _bitsPerPixel = 0;
  uint32_t _stride = 0;
  bool _upsideDown = false;
};