# Working With Cognex VisionPro Images in VisionPro Deep Learning

The VisionPro API deals with images that implement ICogImage, such as CogImage24PlanarColor and CogImage8Grey. The Deep Learning API deals with images that implement IImage, such as WpfImage and FormsImage.

Note:

- The ImageExtensions class contains the method ToCogImage which can convert a Deep Learning image into an ICogImage.

  Note that the resulting ICogImage will have a default CoordinateSpaceTree. If converting back and forth, you may want to preserve this information when going from ICogImage → IImage, so that you can restore this information when going from IImage → ICogImage.

- The wrapper also provides an Image class, which is constructed with an ICogImage and converts the image under the hood into an image that implements IImage.

The following table details which ICogImage types are currently accepted by the Image class, as well as how the Image's channels vary depending on the type of ICogImage converted:

ICogImage Type | Channel Depth of Converted Image | Channels in Converted Image
--- | --- | ---
CogImage8Grey | ImageChannelDepth.Depth8 | 1
CogImage24PlanarColor | ImageChannelDepth.Depth8 | 3
CogImage16Grey | ImageChannelDepth.Depth16 | 1
CogImage16Root | ImageChannelDepth.Depth16 | 1

The following table details which IImage types can currently be converted using the ToCogImage extension method:

IImage Type | Supports ToCogImage?*
--- | ---
Local.LibraryImage | Yes
WpfImage | Yes
FormsImage | Yes
Image | No

Note:

- The type of ICogImage returned will depend on the channels and channel depth, as described in the first table above.
- Currently, 1 channel/Depth16 images are always converted to CogImage16Grey.