# Retrieving the Decoded Data (Advanced)

This code snippet shows how to read a QR code and retrieve its coding mode, the raw bit stream and the data part by part.

## C++

```cpp
#include <eVision/EasyQRCode/EQRCodeReader.h>
```

```cpp
using namespace eVision;

// Image constructor
EImageBW8 srcImage;

// QR code reader constructor
EQRCodeReader reader;
// ...

// Read
std::vector<EQRCode> qrCodes = reader.Read(srcImage);

// Retrieve the data stream of the first QR code found
EQRCodeDecodedStream stream = qrCodes[0].GetDecodedStream();

// Retrieve the coding mode and the raw bit stream of the first QR code found
EQRCodeCodingMode codingMode = stream.GetCodingMode();
std::vector<uint8_t> bitstream = stream.GetRawBitstream();

// Retrieve the encoding and the decoded data of each part of the first QR code found
std::vector<EQRCodeDecodedStreamPart> parts = stream.GetDecodedStreamParts();
for (unsigned int i = 0; i < parts.size(); ++i)
{
  // Retrieve encoding
  EQRCodeEncoding encoding = parts[i].GetEncoding();

  // Retrieve the decoded data
  std::vector<uint8_t> decodedData = parts[i].GetDecodedData();

  // Interpret the decoded data based on the retrieved encoding
}
```

#### SEE ALSO
[`EQRCodeReader::Read`](../../../../doxygen_cpp/classeVision_1_1EQRCodeReader.html#aca78237d6203febd6221ed2e05cdc19b) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EQRCodeReader.html#af3a09d6c336baba0d2d1f078f37c6877) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EQRCodeReader.html#a98fbd0bb085de6d6d609875e6cc82ae4), [`EQRCode::GetDecodedStream`](../../../../doxygen_cpp/classeVision_1_1EQRCode.html#ac43f1f93c3b66f6cd3f40718f7a9f6c6) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EQRCode.html#a01b234d54bb1be91310910620b3c2ebb) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EQRCode.html#a5d30242a31406866ef59859a1eca6033), [`EQRCodeDecodedStreamPart::GetDecodedData`](../../../../doxygen_cpp/classeVision_1_1EQRCodeDecodedStreamPart.html#aae915754d9bff372de4e06a4f0c0b73e) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EQRCodeDecodedStreamPart.html#ad5f15a6827d44b9208ebacf25a5e7855) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EQRCodeDecodedStreamPart.html#a79a5dbac0b5ee649137a01d404d898f8), [`EQRCodeDecodedStream::GetCodingMode`](../../../../doxygen_cpp/classeVision_1_1EQRCodeDecodedStream.html#a0b5cbed53a9410edb3dcc2f94a221c67) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EQRCodeDecodedStream.html#ae2124158ebada5535c68a09511507191) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EQRCodeDecodedStream.html#addd858ebb848ca70cd81735129f34b76), [`EQRCodeDecodedStream::GetDecodedStreamParts`](../../../../doxygen_cpp/classeVision_1_1EQRCodeDecodedStream.html#a0add29d0029c03418e70f4780de89e1f) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EQRCodeDecodedStream.html#a96226d0c0dd4dfac164c513620ffa7dd) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EQRCodeDecodedStream.html#adc5228e0f84bc8a6f2e39d1245871551)

## C#

```cs
using eVision;
```

```cs
// Image constructor
EImageBW8 srcImage = new EImageBW8();

// QR code reader constructor
EQRCodeReader reader = new EQRCodeReader();

// ...

// Read
EQRCode[] qrCodes = reader.Read(srcImage);

// Retrieve the data stream of the first QR code found
EQRCodeDecodedStream stream = qrCodes[0].DecodedStream;

// Retrieve the coding mode and the raw bit stream of the first QR code found
EQRCodeCodingMode codingMode = stream.CodingMode;
byte[] bitstream = stream.RawBitstream;

// Retrieve the encoding and the decoded data of each part of the first QR code found
EQRCodeDecodedStreamPart[] parts = stream.DecodedStreamParts;
for (uint i = 0; i < parts.Length; ++i)
{
  // Retrieve encoding
  EQRCodeEncoding encoding = parts[i].Encoding;

  // Retrieve the decoded data
  byte[] decodedData = parts[i].DecodedData;

  // Interpret the decoded data based on the retrieved encoding
}
```

#### SEE ALSO
[`EQRCodeReader.Read`](../../../../doxygen_cs/classeVision_1_1EQRCodeReader.html#af3a09d6c336baba0d2d1f078f37c6877) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EQRCodeReader.html#aca78237d6203febd6221ed2e05cdc19b) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EQRCodeReader.html#a98fbd0bb085de6d6d609875e6cc82ae4), [`EQRCode.DecodedStream`](../../../../doxygen_cs/classeVision_1_1EQRCode.html#a01b234d54bb1be91310910620b3c2ebb) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EQRCode.html#ac43f1f93c3b66f6cd3f40718f7a9f6c6) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EQRCode.html#a5d30242a31406866ef59859a1eca6033), [`EQRCodeDecodedStreamPart.DecodedData`](../../../../doxygen_cs/classeVision_1_1EQRCodeDecodedStreamPart.html#ad5f15a6827d44b9208ebacf25a5e7855) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EQRCodeDecodedStreamPart.html#aae915754d9bff372de4e06a4f0c0b73e) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EQRCodeDecodedStreamPart.html#a79a5dbac0b5ee649137a01d404d898f8), [`EQRCodeDecodedStream.CodingMode`](../../../../doxygen_cs/classeVision_1_1EQRCodeDecodedStream.html#ae2124158ebada5535c68a09511507191) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EQRCodeDecodedStream.html#a0b5cbed53a9410edb3dcc2f94a221c67) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EQRCodeDecodedStream.html#addd858ebb848ca70cd81735129f34b76), [`EQRCodeDecodedStream.DecodedStreamParts`](../../../../doxygen_cs/classeVision_1_1EQRCodeDecodedStream.html#a96226d0c0dd4dfac164c513620ffa7dd) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EQRCodeDecodedStream.html#a0add29d0029c03418e70f4780de89e1f) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EQRCodeDecodedStream.html#adc5228e0f84bc8a6f2e39d1245871551)

## Python

```py
import eVision
# Image constructor
src_image = eVision.EImageBW8()

# QR code reader constructor
reader = eVision.EQRCodeReader()
# ...

# Read
qr_codes = reader.Read(src_image)

# Retrieve the data stream of the first QR code found
stream = qr_codes[0].DecodedStream

# Retrieve the coding mode and the raw bit stream of the first QR code found
coding_mode = stream.CodingMode
bitstream = stream.RawBitstream

# Retrieve the encoding and the decoded data of each part of the first QR code found
parts = stream.DecodedStreamParts
for part in parts:
    # Retrieve encoding
    encoding = part.Encoding

    # Retrieve the decoded data
    decoded_data = part.DecodedData

    # Interpret the decoded data based on the retrieved encoding
```

#### SEE ALSO
[`EQRCodeReader.Read`](../../../../doxygen_python/classeVision_1_1EQRCodeReader.html#a98fbd0bb085de6d6d609875e6cc82ae4) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EQRCodeReader.html#aca78237d6203febd6221ed2e05cdc19b) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EQRCodeReader.html#af3a09d6c336baba0d2d1f078f37c6877), [`EQRCode.DecodedStream`](../../../../doxygen_python/classeVision_1_1EQRCode.html#a5d30242a31406866ef59859a1eca6033) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EQRCode.html#ac43f1f93c3b66f6cd3f40718f7a9f6c6) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EQRCode.html#a01b234d54bb1be91310910620b3c2ebb), [`EQRCodeDecodedStreamPart.DecodedData`](../../../../doxygen_python/classeVision_1_1EQRCodeDecodedStreamPart.html#a79a5dbac0b5ee649137a01d404d898f8) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EQRCodeDecodedStreamPart.html#aae915754d9bff372de4e06a4f0c0b73e) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EQRCodeDecodedStreamPart.html#ad5f15a6827d44b9208ebacf25a5e7855), [`EQRCodeDecodedStream.CodingMode`](../../../../doxygen_python/classeVision_1_1EQRCodeDecodedStream.html#addd858ebb848ca70cd81735129f34b76) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EQRCodeDecodedStream.html#a0b5cbed53a9410edb3dcc2f94a221c67) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EQRCodeDecodedStream.html#ae2124158ebada5535c68a09511507191), [`EQRCodeDecodedStream.DecodedStreamParts`](../../../../doxygen_python/classeVision_1_1EQRCodeDecodedStream.html#adc5228e0f84bc8a6f2e39d1245871551) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EQRCodeDecodedStream.html#a0add29d0029c03418e70f4780de89e1f) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EQRCodeDecodedStream.html#a96226d0c0dd4dfac164c513620ffa7dd)
