# Continuous Mode

This code snippet shows how to build and draw blobs in the continuous mode context.

## C++

```cpp
#include <eVision/EasyObject/EasyObject2/EImageEncoder.h>
```

```cpp
using namespace eVision;
// Size of the chunks that will be processed
int chunkWidth = 128;
int chunkHeight = 256;

// Number of chunks that will be processed
int numChunks = 100;

// Image that will contain each chunk to be encoded
EImageBW8 imageChunk(chunkWidth, chunkHeight);

// An image in which we will draw all the detected objects from all the chunks.
EImageC24A allBlobs(chunkWidth, numChunks * chunkHeight);

// Image encoder
EImageEncoder encoder;
// Coded image
ECodedImage2 codedImage;
// ...
// Enable the continuous mode
encoder.SetContinuousModeEnabled(true);

// Loop to acquire the different chunks
for (int count = 0; count < numChunks; count++)
{
  // Store the new chunk into imageChunk
  // ...

  // Encode the current chunk
  encoder.Encode(imageChunk, codedImage);

  // Draw the current objects
  EGenericDrawAdapter drawAdapter(&allBlobs);
  codedImage.Draw(&drawAdapter, 1.0f, 1.0f, 0.0f, static_cast<float>(count * chunkHeight));
}

// Flush the continuous mode
encoder.FlushContinuousMode(codedImage);

// codedImage now contains the remaining blobs that were touching the bottom of the last chunk.
EGenericDrawAdapter drawAdapter(&allBlobs);
codedImage.Draw(&drawAdapter, 1.0f, 1.0f, 0.0f, static_cast<float>(numChunks * chunkHeight));
```

#### SEE ALSO
[`EImageEncoder::SetContinuousModeEnabled`](../../../../doxygen_cpp/classeVision_1_1EImageEncoder.html#a783c4febdddc085a48db2b7e08e1276c) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EImageEncoder.html#a3510d398894451bad5010e1768d2c137) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EImageEncoder.html#a2c46d1bfd5972b3504a0df1212cf35f1), [`EImageEncoder::FlushContinuousMode`](../../../../doxygen_cpp/classeVision_1_1EImageEncoder.html#adedb693dd808ab67ef30c2f35cd82c94) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EImageEncoder.html#aee101c36751deb5117d7632b7f4e484a) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EImageEncoder.html#a2205f8b271e10172c6833724d408a991)

## C#

```cs
using eVision;
```

```cs
// Size of the chunks that will be processed
int chunkWidth = 128;
int chunkHeight = 256;

// Number of chunks that will be processed
int numChunks = 100;

// Image that will contain each chunk to be encoded
EImageBW8 imageChunk = new EImageBW8(chunkWidth, chunkHeight);

// An image in which we will draw all the detected objects from all the chunks.
EImageC24A allBlobs = new EImageC24A(chunkWidth, numChunks * chunkHeight);

// Draw adapter to draw in the image "allBlobs"
EGenericDrawAdapter drawAdapter = new EGenericDrawAdapter(allBlobs);

// Image encoder
EImageEncoder encoder = new EImageEncoder();
// Coded image
ECodedImage2 codedImage = new ECodedImage2();
// ...
// Enable the continuous mode
encoder.ContinuousModeEnabled = true;
// Loop to acquire the different chunks
for (int count = 0; count < numChunks; count++)
{
  // Store the new chunk into imageChunk
  // ...

  // Encode the current chunk
  encoder.Encode(imageChunk, codedImage);

  // Draw the current objects
  codedImage.Draw(drawAdapter, 1.0f, 1.0f, 0.0f, count * chunkHeight);
}

// Flush the continuous mode
encoder.FlushContinuousMode(codedImage);

// codedImage now contains the remaining blobs that were touching the bottom of the last chunk.
codedImage.Draw(drawAdapter, 1.0f, 1.0f, 0.0f, numChunks * chunkHeight);
```

#### SEE ALSO
[`EImageEncoder.ContinuousModeEnabled`](../../../../doxygen_cs/classeVision_1_1EImageEncoder.html#a3510d398894451bad5010e1768d2c137) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EImageEncoder.html#acc709c6b037c037c39265b5cae164ad9) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EImageEncoder.html#a2c46d1bfd5972b3504a0df1212cf35f1), [`EImageEncoder.FlushContinuousMode`](../../../../doxygen_cs/classeVision_1_1EImageEncoder.html#aee101c36751deb5117d7632b7f4e484a) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EImageEncoder.html#adedb693dd808ab67ef30c2f35cd82c94) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EImageEncoder.html#a2205f8b271e10172c6833724d408a991)

## Python

```py
import eVision
# Size of the chunks that will be processed
chunkWidth = 128
chunkHeight = 256

# Number of chunks that will be processed
numChunks = 100

# Image that will contain each chunk to be encoded
imageChunk = eVision.EImageBW8(chunkWidth, chunkHeight)

# An image in which we will draw all the detected objects from all the chunks.
allBlobs = eVision.EImageC24A(chunkWidth, numChunks * chunkHeight)

# Draw adapter to draw in the image "allBlobs"
drawAdapter = eVision.EGenericDrawAdapter(allBlobs)

# Image encoder
encoder = eVision.EImageEncoder()
# Coded image
codedImage = eVision.ECodedImage2()
# ...
# Enable the continuous mode
encoder.ContinuousModeEnabled = True
# Loop to acquire the different chunks
for count in range(numChunks):
    # Store the new chunk into imageChunk
    # ...

    # Encode the current chunk
    encoder.Encode(imageChunk, codedImage)

    # Draw the current objects
    codedImage.Draw(drawAdapter, 1.0, 1.0, 0.0, count * chunkHeight)

# Flush the continuous mode
encoder.FlushContinuousMode(codedImage)

# codedImage now contains the remaining blobs that were touching the bottom of the last chunk.
codedImage.Draw(drawAdapter, 1.0, 1.0, 0.0, numChunks * chunkHeight)
```

#### SEE ALSO
[`EImageEncoder.ContinuousModeEnabled`](../../../../doxygen_python/classeVision_1_1EImageEncoder.html#a2c46d1bfd5972b3504a0df1212cf35f1) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EImageEncoder.html#acc709c6b037c037c39265b5cae164ad9) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EImageEncoder.html#a3510d398894451bad5010e1768d2c137), [`EImageEncoder.FlushContinuousMode`](../../../../doxygen_python/classeVision_1_1EImageEncoder.html#a2205f8b271e10172c6833724d408a991) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EImageEncoder.html#adedb693dd808ab67ef30c2f35cd82c94) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EImageEncoder.html#aee101c36751deb5117d7632b7f4e484a)
