Skip to content

Commit 6fe9506

Browse files
committed
Android project ready to be used
0 parents  commit 6fe9506

File tree

35 files changed

+1074
-0
lines changed

35 files changed

+1074
-0
lines changed

.gitignore

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
*.iml
2+
/.idea
3+
.gradle
4+
/local.properties
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
.DS_Store
9+
/build
10+
/captures
11+
.externalNativeBuild
12+
### C++ template
13+
# Prerequisites
14+
*.d
15+
16+
# Compiled Object files
17+
*.slo
18+
*.lo
19+
*.o
20+
*.obj
21+
22+
# Precompiled Headers
23+
*.gch
24+
*.pch
25+
26+
27+
# Fortran module files
28+
*.mod
29+
*.smod
30+
31+
### Gradle template
32+
/build/
33+
34+
# Ignore Gradle GUI config
35+
gradle-app.setting
36+
37+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
38+
!gradle-wrapper.jar
39+
40+
# Cache of project
41+
.gradletasknamecache
42+
43+
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
44+
# gradle/wrapper/gradle-wrapper.properties
45+
### Android template
46+
# Built application files
47+
*.apk
48+
*.ap_
49+
50+
# Files for the ART/Dalvik VM
51+
*.dex
52+
53+
# Java class files
54+
*.class
55+
56+
# Generated files
57+
bin/
58+
gen/
59+
out/
60+
61+
# Gradle files
62+
.gradle/
63+
build/
64+
65+
# Local configuration file (sdk path, etc)
66+
local.properties
67+
68+
# Proguard folder generated by Eclipse
69+
proguard/
70+
71+
# Log Files
72+
*.log
73+
74+
# Android Studio Navigation editor temp files
75+
.navigation/
76+
77+
# Android Studio captures folder
78+
captures/
79+
80+
# IntelliJ
81+
.idea/workspace.xml
82+
.idea/tasks.xml
83+
.idea/gradle.xml
84+
.idea/assetWizardSettings.xml
85+
.idea/dictionaries
86+
.idea/libraries
87+
.idea/caches
88+
89+
# Keystore files
90+
# Uncomment the following line if you do not want to check your keystore files in.
91+
#*.jks
92+
93+
# External native build folder generated in Android Studio 2.2 and later
94+
95+
# Google Services (e.g. APIs or Firebase)
96+
google-services.json
97+
98+
# Freeline
99+
freeline.py
100+
freeline/
101+
freeline_project_description.json
102+
103+
# fastlane
104+
fastlane/report.xml
105+
fastlane/Preview.html
106+
fastlane/screenshots
107+
fastlane/test_output
108+
fastlane/readme.md
109+
### Kotlin template
110+
# Compiled class file
111+
112+
# Log file
113+
114+
# BlueJ files
115+
*.ctxt
116+
117+
# Mobile Tools for Java (J2ME)
118+
.mtj.tmp/
119+
120+
# Package Files #
121+
*.jar
122+
*.war
123+
*.nar
124+
*.ear
125+
*.zip
126+
*.tar.gz
127+
*.rar
128+
129+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
130+
hs_err_pid*
131+
132+
133+
# Precompiled Headers
134+
135+
# Libraries
136+
137+
138+
139+
# Kernel Module Compile Results
140+
*.mod*
141+
*.cmd
142+
.tmp_versions/
143+
modules.order
144+
Module.symvers
145+
Mkfile.old
146+
dkms.conf
147+
### CUDA template
148+
*.i
149+
*.ii
150+
*.gpu
151+
*.ptx
152+
*.cubin
153+
*.fatbin
154+
### JetBrains template
155+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
156+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
157+
158+
# User-specific stuff
159+
.idea/**/workspace.xml
160+
.idea/**/tasks.xml
161+
.idea/**/dictionaries
162+
.idea/**/shelf
163+
164+
# Sensitive or high-churn files
165+
.idea/**/dataSources/
166+
.idea/**/dataSources.ids
167+
.idea/**/dataSources.local.xml
168+
.idea/**/sqlDataSources.xml
169+
.idea/**/dynamic.xml
170+
.idea/**/uiDesigner.xml
171+
172+
# Gradle
173+
.idea/**/gradle.xml
174+
.idea/**/libraries
175+
176+
# CMake
177+
cmake-build-debug/
178+
cmake-build-release/
179+
180+
# Mongo Explorer plugin
181+
.idea/**/mongoSettings.xml
182+
183+
# File-based project format
184+
*.iws

LICENSE

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2018, QuickBird Studios
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
* Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
31+
32+
License Agreement
33+
For Open Source Computer Vision Library
34+
(3-clause BSD License)
35+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
36+
37+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
38+
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
39+
Neither the names of the copyright holders nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission.
40+
This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall copyright holders or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# OpenCV Android
2+
3+
Easy way to integrate OpenCV into your Android project via Gradle.
4+
**No NDK dependency needed** - just include this library and you are good to go.
5+
6+
## 🚨 Breaking Changes
7+
* OpenCV Contribution's package naming has been changed to make it as per the naming guideline.
8+
* **Old**: ```opencv:VERSION-contrib```
9+
* **New**: ```opencv-contrib:VERSION```
10+
11+
### 🚀 Releases
12+
Each versions is available in only OpenCV as well as OpenCV with contributions.
13+
14+
##### 4.x versions
15+
* **4.5.3.0** ‼️
16+
* 4.5.2
17+
* 4.5.1
18+
* 4.5.0
19+
* 4.4.0
20+
21+
‼️ Please use `4.5.3.0` instead of `4.5.3`. They are both the same versions, however, `4.5.3` has some runtime issues on some of the Android versions while `4.5.3.0` works fine.
22+
23+
##### 3.4.x versions
24+
* **3.4.15**
25+
* 3.4.14
26+
* 3.4.13
27+
* 3.4.12
28+
* 3.4.5
29+
* 3.4.1
30+
31+
## 👩‍💻 How to Integrate 🧑‍💻
32+
* Add `mavenCentral` to your project's `build.gradle` file's **repositories** section if not already present.
33+
```groovy
34+
repositories {
35+
mavenCentral()
36+
}
37+
```
38+
39+
* Add either the normal or contributions version in the **dependencies** of your module.
40+
41+
``` groovy {
42+
// opencv
43+
implementation `com.quickbirdstudios:opencv:VERSION`
44+
45+
// opencv with contributions
46+
implementation `com.quickbirdstudios:opencv-contrib:VERSION`
47+
}
48+
```
49+
* Initialize OpenCV before using it.
50+
51+
```kotlin
52+
if (!OpenCVLoader.initDebug())
53+
Log.e("OpenCV", "Unable to load OpenCV!");
54+
else
55+
Log.d("OpenCV", "OpenCV loaded Successfully!");
56+
```
57+
58+
## ‼️ Want to use OpenCV as source Dependency?
59+
* Checkout the Repository. There will be an empty project with placeholder for the opencv source.
60+
* Download the source from your desired release.
61+
* Unzip the folder. The name of the folder will be `opencv_VERSION` or `opencv-contrib_VERSION`. Copy this folder to the project and keep it at the same level as the `app` folder.
62+
* Open `settings.gradle` and replace the VERSION with the OpenCV version you have downloaded.
63+
```groovy
64+
// Remove/comment out the one you aren't going to need
65+
include ":opencv_VERSION"
66+
include ":opencv-contrib_VERSION"
67+
```
68+
* Open app/build.gradle and replace the VERSION with the OpenCV version you have downloaded
69+
70+
```groovy
71+
// Remove/comment out the one you aren't going to need
72+
implementation(project(":opencv_VERSION"))
73+
implementation(project(":opencv-contrib_VERSION"))
74+
```
75+
* Sync and run the project. You should see the screen with the text `OpenCV Loaded Successfully`.
76+
77+
## 🛠 None of the released versions meet your requirements?
78+
In progress 👷‍

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'kotlin-android'
4+
}
5+
6+
android {
7+
compileSdk 30
8+
9+
defaultConfig {
10+
applicationId "com.quickbirdstudios.opencvexample"
11+
minSdk 21
12+
targetSdk 30
13+
versionCode 1
14+
versionName "1.0"
15+
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17+
}
18+
19+
buildTypes {
20+
release {
21+
minifyEnabled false
22+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23+
}
24+
}
25+
compileOptions {
26+
sourceCompatibility JavaVersion.VERSION_1_8
27+
targetCompatibility JavaVersion.VERSION_1_8
28+
}
29+
kotlinOptions {
30+
jvmTarget = '1.8'
31+
}
32+
33+
buildFeatures {
34+
viewBinding true
35+
}
36+
}
37+
38+
dependencies {
39+
40+
implementation 'androidx.core:core-ktx:1.6.0'
41+
implementation 'androidx.appcompat:appcompat:1.3.1'
42+
implementation 'com.google.android.material:material:1.4.0'
43+
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
44+
testImplementation 'junit:junit:4.+'
45+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
46+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
47+
48+
// Remove/comment out the one you aren't going to need
49+
implementation(project(":opencv_VERSION"))
50+
implementation(project(":opencv-contrib_VERSION"))
51+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

0 commit comments

Comments
 (0)