# CTransformedGrayscaleImageUnit

The `CTransformedGrayscaleImageUnit` class is a subclass of `CIntermediateResultUnit` that represents a transformed grayscale image. It may be the original grayscale image or the inverted image of the original grayscale image.

## Definition

*Namespace:* dynamsoft::intermediate_results

*Assembly:* DynamsoftCore

*Inheritance:* [CIntermediateResultUnit](https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/core/intermediate-results/intermediate-result-unit.md) -> CTransformedGrayscaleImageUnit

```cpp
class CTransformedGrayscaleImageUnit : public CIntermediateResultUnit 
```

## Methods

| Method               | Description |
|----------------------|-------------|
| [`GetImageData`](#getimagedata) | Gets the transformed grayscale image.|
| [`SetImageData`](#setimagedata) | Sets the transformed grayscale image. |
| **Methods Inherited from [CIntermediateResultUnit](https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/core/intermediate-results/intermediate-result-unit.md):** | |
| [`GetHashId`](https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/core/intermediate-results/intermediate-result-unit.md#gethashid) | Gets the hash ID of the unit. |
| [`GetOriginalImageHashId`](https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/core/intermediate-results/intermediate-result-unit.md#getoriginalimagehashid) | Gets the hash ID of the original image. |
| [`GetOriginalImageTag`](https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/core/intermediate-results/intermediate-result-unit.md#getoriginalimagetag) | Gets the tag of the original image. |
| [`GetType`](https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/core/intermediate-results/intermediate-result-unit.md#gettype) | Gets the type of the intermediate result unit. |
| [`Clone`](https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/core/intermediate-results/intermediate-result-unit.md#clone) | Creates a copy of the intermediate result unit. |
| [`SetHashId`](https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/core/intermediate-results/intermediate-result-unit.md#sethashid) | Sets the hash ID of the unit. |
| [`SetOriginalImageHashId`](https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/core/intermediate-results/intermediate-result-unit.md#setoriginalimagehashid) | Sets the hash ID of the original image. |
| [`SetOriginalImageTag`](https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/core/intermediate-results/intermediate-result-unit.md#setoriginalimagetag) | Sets the tag of the original image. |
| [`Retain`](https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/core/intermediate-results/intermediate-result-unit.md#retain) | Increases the reference count of the unit. |
| [`Release`](https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/core/intermediate-results/intermediate-result-unit.md#release) | Decreases the reference count of the unit. |
| [`GetTransformMatrix`](https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/core/intermediate-results/intermediate-result-unit.md#gettransformmatrix) | Gets the transformation matrix via `CTransformMatrixType`. |
| [`SetTransformMatrix`](https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/core/intermediate-results/intermediate-result-unit.md#settransformmatrix) | Sets the transformation matrix via `CTransformMatrixType`. |

### GetImageData

Gets the image data of the transformed grayscale image. It may be the original grayscale image or the inverted image of the original grayscale image.

```cpp
virtual const CImageData* GetImageData() const
```

**Return value**

Returns a const pointer to a `CImageData` object that represents the image data of the transformed grayscale image. You don't need to release the memory pointed to by the returned pointer.

**See Also**

[CImageData](https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/core/basic-structures/image-data.md)

### SetImageData

Sets the transformed grayscale image.

**Parameters**

imgData The image data to set.

**Return value**

Returns 0 if succeeds, nonzero otherwise.

```cpp
virtual int SetImageData(const CImageData* imgData) = 0;
```

**See Also**

[CImageData](https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/core/basic-structures/image-data.md)
