123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412 |
-
- using OpenCVForUnity.CoreModule;
- using OpenCVForUnity.UtilsModule;
- using System;
- using System.Collections.Generic;
- using System.Runtime.InteropServices;
- namespace OpenCVForUnity.VideoioModule {
- // C++: class VideoCapture
- //javadoc: VideoCapture
- public class VideoCapture : DisposableOpenCVObject {
- protected override void Dispose(bool disposing) {
- #if ((UNITY_ANDROID) && !UNITY_EDITOR)
- try {
- if (disposing) {
- }
- if (IsEnabledDispose) {
- if (nativeObj != IntPtr.Zero)
- videoio_VideoCapture_delete(nativeObj);
- nativeObj = IntPtr.Zero;
- }
- } finally {
- base.Dispose(disposing);
- }
- #else
- return;
- #endif
- }
- protected internal VideoCapture(IntPtr addr) : base(addr) { }
- public IntPtr getNativeObjAddr() { return nativeObj; }
- // internal usage only
- public static VideoCapture __fromPtr__(IntPtr addr) { return new VideoCapture(addr); }
- //
- // C++: cv::VideoCapture::VideoCapture(String filename, int apiPreference = CAP_ANY)
- //
- //javadoc: VideoCapture::VideoCapture(filename, apiPreference)
- public VideoCapture(string filename, int apiPreference) {
- #if ((UNITY_ANDROIDL) && !UNITY_EDITOR)
- nativeObj = videoio_VideoCapture_VideoCapture_10(filename, apiPreference);
- return;
- #else
- return;
- #endif
- }
- //javadoc: VideoCapture::VideoCapture(filename)
- public VideoCapture(string filename) {
- #if ((UNITY_ANDROID) && !UNITY_EDITOR)
- nativeObj = videoio_VideoCapture_VideoCapture_11(filename);
- return;
- #else
- return;
- #endif
- }
- //
- // C++: cv::VideoCapture::VideoCapture(int index, int apiPreference = CAP_ANY)
- //
- //javadoc: VideoCapture::VideoCapture(index, apiPreference)
- public VideoCapture(int index, int apiPreference) {
- #if ((UNITY_ANDROID ) && !UNITY_EDITOR)
- nativeObj = videoio_VideoCapture_VideoCapture_12(index, apiPreference);
- return;
- #else
- return;
- #endif
- }
- //javadoc: VideoCapture::VideoCapture(index)
- public VideoCapture(int index) {
- #if ((UNITY_ANDROID) && !UNITY_EDITOR)
- nativeObj = videoio_VideoCapture_VideoCapture_13(index);
- return;
- #else
- return;
- #endif
- }
- //
- // C++: cv::VideoCapture::VideoCapture()
- //
- //javadoc: VideoCapture::VideoCapture()
- public VideoCapture() {
- #if ((UNITY_ANDROID) && !UNITY_EDITOR)
- nativeObj = videoio_VideoCapture_VideoCapture_14();
- return;
- #else
- return;
- #endif
- }
- //
- // C++: String cv::VideoCapture::getBackendName()
- //
- //javadoc: VideoCapture::getBackendName()
- public string getBackendName() {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- string retVal = Marshal.PtrToStringAnsi(videoio_VideoCapture_getBackendName_10(nativeObj));
- return retVal;
- #else
- return null;
- #endif
- }
- //
- // C++: bool cv::VideoCapture::grab()
- //
- //javadoc: VideoCapture::grab()
- public bool grab() {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- bool retVal = videoio_VideoCapture_grab_10(nativeObj);
- return retVal;
- #else
- return false;
- #endif
- }
- //
- // C++: bool cv::VideoCapture::isOpened()
- //
- //javadoc: VideoCapture::isOpened()
- public bool isOpened() {
- ThrowIfDisposed();
- #if ((UNITY_ANDROID) && !UNITY_EDITOR)
- bool retVal = videoio_VideoCapture_isOpened_10(nativeObj);
- return retVal;
- #else
- return false;
- #endif
- }
- //
- // C++: bool cv::VideoCapture::open(String filename, int apiPreference = CAP_ANY)
- //
- //javadoc: VideoCapture::open(filename, apiPreference)
- public bool open(string filename, int apiPreference) {
- ThrowIfDisposed();
- #if ((UNITY_ANDROID ) && !UNITY_EDITOR)
- bool retVal = videoio_VideoCapture_open_10(nativeObj, filename, apiPreference);
- return retVal;
- #else
- return false;
- #endif
- }
- //javadoc: VideoCapture::open(filename)
- public bool open(string filename) {
- ThrowIfDisposed();
- #if ((UNITY_ANDROID) && !UNITY_EDITOR)
- bool retVal = videoio_VideoCapture_open_11(nativeObj, filename);
- return retVal;
- #else
- return false;
- #endif
- }
- //
- // C++: bool cv::VideoCapture::open(int index, int apiPreference = CAP_ANY)
- //
- //javadoc: VideoCapture::open(index, apiPreference)
- public bool open(int index, int apiPreference) {
- ThrowIfDisposed();
- #if ((UNITY_ANDROID ) && !UNITY_EDITOR)
- bool retVal = videoio_VideoCapture_open_12(nativeObj, index, apiPreference);
- return retVal;
- #else
- return false;
- #endif
- }
- //javadoc: VideoCapture::open(index)
- public bool open(int index) {
- ThrowIfDisposed();
- #if ((UNITY_ANDROID) && !UNITY_EDITOR)
- bool retVal = videoio_VideoCapture_open_13(nativeObj, index);
- return retVal;
- #else
- return false;
- #endif
- }
- //
- // C++: bool cv::VideoCapture::read(Mat& image)
- //
- //javadoc: VideoCapture::read(image)
- public bool read(Mat image) {
- ThrowIfDisposed();
- if (image != null) image.ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- bool retVal = videoio_VideoCapture_read_10(nativeObj, image.nativeObj);
- return retVal;
- #else
- return false;
- #endif
- }
- //
- // C++: bool cv::VideoCapture::retrieve(Mat& image, int flag = 0)
- //
- //javadoc: VideoCapture::retrieve(image, flag)
- public bool retrieve(Mat image, int flag) {
- ThrowIfDisposed();
- if (image != null) image.ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- bool retVal = videoio_VideoCapture_retrieve_10(nativeObj, image.nativeObj, flag);
- return retVal;
- #else
- return false;
- #endif
- }
- //javadoc: VideoCapture::retrieve(image)
- public bool retrieve(Mat image) {
- ThrowIfDisposed();
- if (image != null) image.ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- bool retVal = videoio_VideoCapture_retrieve_11(nativeObj, image.nativeObj);
- return retVal;
- #else
- return false;
- #endif
- }
- //
- // C++: bool cv::VideoCapture::set(int propId, double value)
- //
- //javadoc: VideoCapture::set(propId, value)
- public bool set(int propId, double value) {
- ThrowIfDisposed();
- #if (UNITY_ANDROID&& !UNITY_EDITOR)
- bool retVal = videoio_VideoCapture_set_10(nativeObj, propId, value);
- return retVal;
- #else
- return false;
- #endif
- }
- //
- // C++: double cv::VideoCapture::get(int propId)
- //
- //javadoc: VideoCapture::get(propId)
- public double get(int propId) {
- ThrowIfDisposed();
- #if (UNITY_ANDROID&& !UNITY_EDITOR)
- double retVal = videoio_VideoCapture_get_10(nativeObj, propId);
- return retVal;
- #else
- return -1;
- #endif
- }
- //
- // C++: void cv::VideoCapture::release()
- //
- //javadoc: VideoCapture::release()
- public void release() {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- videoio_VideoCapture_release_10(nativeObj);
- return;
- #else
- return;
- #endif
- }
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- const string LIBNAME = "opencvforunity";
- // C++: cv::VideoCapture::VideoCapture(String filename, int apiPreference = CAP_ANY)
- [DllImport(LIBNAME)]
- private static extern IntPtr videoio_VideoCapture_VideoCapture_10(string filename, int apiPreference);
- [DllImport(LIBNAME)]
- private static extern IntPtr videoio_VideoCapture_VideoCapture_11(string filename);
- // C++: cv::VideoCapture::VideoCapture(int index, int apiPreference = CAP_ANY)
- [DllImport(LIBNAME)]
- private static extern IntPtr videoio_VideoCapture_VideoCapture_12(int index, int apiPreference);
- [DllImport(LIBNAME)]
- private static extern IntPtr videoio_VideoCapture_VideoCapture_13(int index);
- // C++: cv::VideoCapture::VideoCapture()
- [DllImport(LIBNAME)]
- private static extern IntPtr videoio_VideoCapture_VideoCapture_14();
- // C++: String cv::VideoCapture::getBackendName()
- [DllImport(LIBNAME)]
- private static extern IntPtr videoio_VideoCapture_getBackendName_10(IntPtr nativeObj);
- // C++: bool cv::VideoCapture::grab()
- [DllImport(LIBNAME)]
- private static extern bool videoio_VideoCapture_grab_10(IntPtr nativeObj);
- // C++: bool cv::VideoCapture::isOpened()
- [DllImport(LIBNAME)]
- private static extern bool videoio_VideoCapture_isOpened_10(IntPtr nativeObj);
- // C++: bool cv::VideoCapture::open(String filename, int apiPreference = CAP_ANY)
- [DllImport(LIBNAME)]
- private static extern bool videoio_VideoCapture_open_10(IntPtr nativeObj, string filename, int apiPreference);
- [DllImport(LIBNAME)]
- private static extern bool videoio_VideoCapture_open_11(IntPtr nativeObj, string filename);
- // C++: bool cv::VideoCapture::open(int index, int apiPreference = CAP_ANY)
- [DllImport(LIBNAME)]
- private static extern bool videoio_VideoCapture_open_12(IntPtr nativeObj, int index, int apiPreference);
- [DllImport(LIBNAME)]
- private static extern bool videoio_VideoCapture_open_13(IntPtr nativeObj, int index);
- // C++: bool cv::VideoCapture::read(Mat& image)
- [DllImport(LIBNAME)]
- private static extern bool videoio_VideoCapture_read_10(IntPtr nativeObj, IntPtr image_nativeObj);
- // C++: bool cv::VideoCapture::retrieve(Mat& image, int flag = 0)
- [DllImport(LIBNAME)]
- private static extern bool videoio_VideoCapture_retrieve_10(IntPtr nativeObj, IntPtr image_nativeObj, int flag);
- [DllImport(LIBNAME)]
- private static extern bool videoio_VideoCapture_retrieve_11(IntPtr nativeObj, IntPtr image_nativeObj);
- // C++: bool cv::VideoCapture::set(int propId, double value)
- [DllImport(LIBNAME)]
- private static extern bool videoio_VideoCapture_set_10(IntPtr nativeObj, int propId, double value);
- // C++: double cv::VideoCapture::get(int propId)
- [DllImport(LIBNAME)]
- private static extern double videoio_VideoCapture_get_10(IntPtr nativeObj, int propId);
- // C++: void cv::VideoCapture::release()
- [DllImport(LIBNAME)]
- private static extern void videoio_VideoCapture_release_10(IntPtr nativeObj);
- // native support for java finalize()
- [DllImport(LIBNAME)]
- private static extern void videoio_VideoCapture_delete(IntPtr nativeObj);
- #endif
- }
- }
|