Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/java/generator/src/cpp/opencv_java.hpp
16354 views
1
// This file is part of OpenCV project.
2
// It is subject to the license terms in the LICENSE file found in the top-level directory
3
// of this distribution and at http://opencv.org/license.html
4
5
// Author: abratchik
6
7
#undef LOGE
8
#undef LOGD
9
#ifdef __ANDROID__
10
# include <android/log.h>
11
# define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
12
# ifdef DEBUG
13
# define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
14
# else
15
# define LOGD(...)
16
# endif
17
#else
18
# define LOGE(...)
19
# define LOGD(...)
20
#endif
21
22
#ifndef OPENCV_JAVA_HPP
23
#define OPENCV_JAVA_HPP
24
25
#define MATOFINT(ENV) static_cast<jclass>(ENV->NewGlobalRef(ENV->FindClass("org/opencv/core/MatOfInt")))
26
#define GETNATIVEOBJ(ENV, CLS, MAT) ENV->GetLongField(MAT, ENV->GetFieldID(CLS, "nativeObj", "J"))
27
28
#define CONSTRUCTOR(ENV, CLS) ENV->GetMethodID(CLS, "<init>", "(I)V")
29
30
#define ARRAYLIST(ENV) static_cast<jclass>(ENV->NewGlobalRef(ENV->FindClass("java/util/ArrayList")))
31
#define LIST_ADD(ENV, LIST) ENV->GetMethodID(LIST, "add", "(Ljava/lang/Object;)Z")
32
#define LIST_GET(ENV, LIST) ENV->GetMethodID(LIST, "get", "(I)Ljava/lang/Object;")
33
#define LIST_SIZE(ENV, LIST) ENV->GetMethodID(LIST, "size", "()I")
34
#define LIST_CLEAR(ENV, LIST) ENV->GetMethodID(LIST, "clear", "()V")
35
36
#define CHECK_MAT(cond) if(!(cond)){ LOGD("FAILED: " #cond); return; }
37
38
#endif // OPENCV_JAVA_HPP
39
40