%% Read Image Stored in OpenCV Mat Class
% Add the MATLAB interface to OpenCV package names to the import list.

import clib.opencv.*
import vision.opencv.util.*

% Read an image into the MATLAB workspace.

img = imread("cameraman.tif");

% Create a MATLAB interface object for the OpenCV InputOutput array class.

[ocvMat,ocvArray] = createMat(img);

% Read the image stored in the InputOutput interface object.

output = getImage(ocvArray);

% Display the output image.

figure
imshow(output)

% Copyright 2021 The MathWorks, Inc.