# Old C-style OpenCV types like CvMat: supported until what version of OpenCV?

**URL:** <https://forum.opencv.org/t/old-c-style-opencv-types-like-cvmat-supported-until-what-version-of-opencv/6115>\
**Category:** C++\
**Tags:** core, historical\
**Created:** [November 9, 2021, 12:47pm UTC](https://forum.opencv.org/t/old-c-style-opencv-types-like-cvmat-supported-until-what-version-of-opencv/6115 "2021-11-09T12:47:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bart\_Vandewoestyne](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/bart_vandewoestyne/32/3708_2.png) [@Bart\_Vandewoestyne](https://forum.opencv.org/u/Bart_Vandewoestyne)\
**Post date:** [November 9, 2021, 12:47pm UTC](https://forum.opencv.org/t/old-c-style-opencv-types-like-cvmat-supported-until-what-version-of-opencv/6115/1 "2021-11-09T12:47:15Z")

</div>

I am working on a legacy code base that still uses OpenCV 2.3.1. In quite some places, the C-style OpenCV types `CvMat` and the `cvMat` function are used.

I am definitely not an OpenCV-guru, but I know that that is old-style OpenCV and one should now use `cv::Mat`. The note on [Basic C Structures and Operations — OpenCV v2.3 documentation](https://docs.opencv.org/2.3/modules/core/doc/old_basic_structures.html?highlight=cvmat#CvMat) confirms that `CvMat` was already obsolete in OpenCV 2.3.1.

The question that I now have is since what version these old C-style OpenCV types are no longer supported? From what version of OpenCV can one no longer use the `CvMat` type and functions that use it (e.g. `cvMat`)? Or is it still possible to use these types with the latest OpenCV?

---

<div class="post-metadata">

**Author:** ![Bart\_Vandewoestyne](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/bart_vandewoestyne/32/3708_2.png) [@Bart\_Vandewoestyne](https://forum.opencv.org/u/Bart_Vandewoestyne)\
**Post date:** [November 9, 2021, 1:01pm UTC](https://forum.opencv.org/t/old-c-style-opencv-types-like-cvmat-supported-until-what-version-of-opencv/6115/2 "2021-11-09T13:01:29Z")

</div>

Looking at [OpenCV: Deprecated List](https://docs.opencv.org/3.4.16/da/d58/deprecated.html) I have the impression that `CvMat` was still in OpenCV 3.4.16. However, looking at [https://opencv.org/opencv-4-0/](https://opencv.org/opencv-4-0/) I read

> A lot of C API from OpenCV 1.x has been removed.

So based on that, my conclusion would be that `CvMat` is no longer supported since OpenCV 4.0. Would be nice if somebody could confirm 🙂

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [November 9, 2021, 1:15pm UTC](https://forum.opencv.org/t/old-c-style-opencv-types-like-cvmat-supported-until-what-version-of-opencv/6115/3 "2021-11-09T13:15:06Z")

</div>

yep, all correct.

(sooner or later you’ll have to convert your legacy code, if you want to keep it)  
(and the 3.4 branch will be frozen, once 5.0 is out)
