Can I apply opencv directly in C files?

Hi guys,the sample I am using is deepstream_app,the structure is:
image

I am trying to add some custom function in deepstream_app.c,it need some opencv function to realize this.Can I just use C API of opencv in this sample?
For example the include file maybe:

#include "opencv2/imgproc/imgproc.h"
#include "opencv2/highgui/highgui.h"

I wonder if it’s practical.Thanks.

Yes. There are many similar examples in our open source code.
For example: sources\gst-plugins\gst-nvdspreprocess\gstnvdspreprocess.cpp.

You need to add the relevant parameters to the Makefile. Please refer to the sources\gst-plugins\gst-nvdspreprocess\Makefile. You can take a look at the parameters associated with WITH_OPENCV macro.

Emm,maybe you don’t get my point.I am trying to apply C API of opencv instead of C++ API.Is that practical?

Yes. In theory, C++ can call the C API properly. But you need to migrate that yourself.

Thanks,I meet two errors when I sudo make in the terminal:

/usr/include/opencv4/opencv2/core/cvdef.h:773:4: error: #error "OpenCV 4.x+ requires enabled C++11 support"
  773 | #  error "OpenCV 4.x+ requires enabled C++11 support"
      |    ^~~~~
/usr/include/opencv4/opencv2/core/cvdef.h:779:10: fatal error: array: No such file or directory
  779 | #include <array>
      |          ^~~~~~~
compilation terminated.
make: *** [Makefile:71:deepstream_app.o] error 1