SharpCV icon indicating copy to clipboard operation
SharpCV copied to clipboard

Implement imdecode

Open tk4218 opened this issue 4 years ago • 0 comments

I have an image that is loaded in memory that I need to get into a Mat object.

Can cv2.imdecode() be implemented as it is in OpenCvSharp? It looks like this was already partly implemented in cv2_native_api.imgcodecs.cs with the imgcodecs_imdecode_vectors() method.

This would be simple to implement by adding the following to cv2,imgcodecs.cs

    public Mat imdecode(byte[] buf, IMREAD_COLOR flags = IMREAD_COLOR.IMREAD_COLOR)
    {
        cv2_native_api.imgcodecs_imdecode_vector(buf, new IntPtr(buf.Length), (int) flags, out var handle);
        return new Mat(handle);
    }

tk4218 avatar Jun 10 '20 19:06 tk4218