# IntermediateResultManager

The `IntermediateResultManager` class provides the API needed to manage the intermediate results that are produced during the capture process. Currently, the `IntermediateResultManager` is mainly used for when the user wants to retrieve the original image or frame that the captured result is taken from, especially in an interactive video scenario where the input is a camera feed.

## Definition

*Assembly:* dynamsoft_capture_vision_flutter

```dart
class IntermediateResultManager
```

## Methods

### getOriginalImage

Retrieves the original image (as an ImageData object) associated with the captured result, based on the `originalImageHashId` of the [`CapturedResult`](/capture-vision/docs/mobile/programming/flutter/api-reference/capture-vision-router/captured-result.html).

```dart
Future<ImageData?> getOriginalImage(String hashId) async
```

**Remarks**

In order to get the hashID input parameter, please access the `originalImageHashId` of the [`CapturedResult`](/capture-vision/docs/mobile/programming/flutter/api-reference/capture-vision-router/captured-result.html). The `CapturedResult` can be a [`DecodedBarcodesResult`](/barcode-reader/docs/mobile/programming/flutter/api-reference/barcode-reader/decoded-barcodes-result.html) (if the Barcode Reader is used) and so the `originalImageHashId` can be obtained from the `DecodedBarcodesResult` object directly since it extends the `CapturedResult` class.

The method returns a [`ImageData`](/capture-vision/docs/mobile/programming/flutter/api-reference/core/image-data.html) object which contains all the info of the original image, including a byte array to represent the raw image.

## Code Snippet

```dart
..onDecodedBarcodesReceived = (DecodedBarcodesResult result) async {
    if (result.items?.isNotEmpty ?? false) {
    final intManager = CaptureVisionRouter.getIntermediateResultManager();
    final originalImage = await intManager.getOriginalImage(result.originalImageHashId);
    if (originalImage != null){
        print(originalImage.format); // verify that it is output in colour
        final filePath = "${directory.path}/dynamsoft_output.jpg"; // you can change this path to whatever works and that is accessible
        await ImageIO().saveToFile(originalImage, filePath, true); // saving the captured frame to the directory above
    }
    }
};
```