8 |
9 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Dan
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # VideoStab
2 |
3 | A simple video stabilisation for Android, based on:
4 | * https://learnopencv.com/video-stabilization-using-point-feature-matching-in-opencv/
5 | * https://github.com/spmallick/learnopencv/tree/master/VideoStabilization
6 |
7 | # How it works
8 |
9 | ## Analyse step
10 |
11 | It tries to detect the transformations between two consecutive frames: transition (X and Y) and rotation.
12 | Using this values it calculates a trajectory: for each frame it calculates the transition and rotation compared to the first frame.
13 |
14 | ## Stabilisation
15 |
16 | Using the trajectory, for each axe (X, Y, rotation) it will apply one of this algorithms:
17 | * none: keep values unchanged
18 | * reverse: tries to apply the reverse changes to put the frame in the same "position" as the first one
19 | * moving average: it will smooth the changes
20 | * distribute: it will evenly distribute the change between the first and the last frame (panning)
21 |
22 | Algorithm | X transformation | Y transformation | Rotation transformation
23 | -- | -- | -- | --
24 | Generic | moving average | moving average | moving average
25 | Generic (B) | moving average | moving average | reverse
26 | Still | reverse | reverse | reverse
27 | Horizontal panning | distribute | reverse | reverse
28 | Horizontal panning (B) | distribute | reverse | moving average
29 | Vertical panning | reverse | distribute | reverse
30 | Vertical panning (B) | reverse | distribute | moving average
31 | Panning | distribute | distribute | reverse
32 | Panning (B) | distribute | distribute | moving average
33 | No rotation | none | none | reverse
34 |
35 | # Interface
36 |
37 | 
38 | ## Toolbar
39 |
40 | 
41 |
42 | In order;
43 | * Open a video file
44 | * Save the current stabilized video
45 | * Settings
46 | * ... allow to open a series of images or an images folder (that will be considered as a video)
47 |
48 | ## Input video informations
49 |
50 | 
51 | * Resolution
52 | * Auto-detected FPS. NOTE: can be wrong in some cases
53 | * File name
54 |
55 | ## Stabilisation parameters
56 |
57 | 
58 |
59 | * Algorithm: see "How it works" section for more details
60 | * Strength: seconds to be used for moving average window (1, 2, 3 or 4 seconds)
61 | * Crop: because the frames can be moved and rorated you can have black regions. This can be cropped (Auto, 0%, 5%, 10%)
62 | * FPS: you can for a specific FPS if the auto detection failes
63 |
64 | ## Media
65 |
66 | 
67 |
68 | In order:
69 | * Play original video
70 | * Play stabilized video (it will apply the stabilisation if needed)
71 | * Stop the player
72 | * Edit stabilisation mask (used only for "Still" algorithm)
73 |
74 | ## Mask
75 |
76 | Some video have big moving element (like big clouds) that can false frame alignemnt.
77 |
78 | This screen allow to draw a mask for the first frame that specify items that suppose to be still.
79 |
80 | 
81 |
82 | The light part is the mask.
83 | You can clear the mask, fill (all pixels are used) and you can draw / erase.
84 | To draw / erase you must press and keep hold one of the buttons and with another edit the mask.
85 |
86 | See thre result: original (left), still without mask (middle) and still with the mask (right).
87 |
88 | 
89 |
90 | # Examples
91 |
92 | See the original vs stabilized video.
93 |
94 | ## Original vs Generic
95 |
96 | 
97 |
98 | ## Original vs Still
99 |
100 | 
101 |
102 | ## Original vs Horizontal panning
103 |
104 | 
105 |
106 | ## Original vs Vertical panning
107 |
108 | 
109 |
110 | ## Original vs Panning
111 |
112 | 
113 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | id 'kotlin-android'
4 | }
5 |
6 | android {
7 | signingConfigs {
8 | 'default' {
9 | File keystoreConfigFile = file('keystore.config')
10 | if (keystoreConfigFile.exists()) {
11 | Properties keystoreProps = new Properties()
12 | keystoreProps.load(new FileInputStream(file('keystore.config')))
13 |
14 | keyAlias keystoreProps['keyAlias']
15 | keyPassword keystoreProps['keyPassword']
16 | storePassword keystoreProps['storePassword']
17 | storeFile file(keystoreProps['storePath'])
18 | }
19 | }
20 | }
21 |
22 | compileSdkVersion 30
23 | buildToolsVersion "30.0.2"
24 |
25 | defaultConfig {
26 | applicationId "com.dan.videostab"
27 | minSdkVersion 28
28 | targetSdkVersion 30
29 | versionCode 9
30 | versionName '1.9'
31 |
32 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
33 | }
34 |
35 | buildTypes {
36 | debug {
37 | if (file('keystore.config').exists()) {
38 | signingConfig signingConfigs.'default'
39 | }
40 | }
41 | release {
42 | minifyEnabled true
43 | shrinkResources true
44 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
45 | }
46 | }
47 | buildFeatures {
48 | dataBinding true
49 | }
50 | kotlinOptions {
51 | jvmTarget = '1.8'
52 | }
53 | }
54 |
55 | dependencies {
56 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
57 | implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
58 | implementation 'androidx.core:core-ktx:1.6.0'
59 | implementation 'androidx.appcompat:appcompat:1.3.1'
60 | implementation 'com.google.android.material:material:1.4.0'
61 | implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
62 | implementation project(path: ':opencv')
63 | testImplementation 'junit:junit:4.13.2'
64 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
65 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
66 | implementation "androidx.documentfile:documentfile:1.0.1"
67 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2-native-mt"
68 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9"
69 | }
70 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
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
22 |
23 | -keepclassmembers class com.dan.videostab.Settings {
24 | public *;
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/dan/videostab/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.dan.videostab
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.dan.videostab", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
15 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/app/src/main/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/app/src/main/java/com/dan/videostab/AppFragment.kt:
--------------------------------------------------------------------------------
1 | package com.dan.videostab
2 |
3 | import androidx.fragment.app.Fragment
4 |
5 | open class AppFragment(val activity: MainActivity) : Fragment() {
6 |
7 | val settings = activity.settings
8 |
9 | fun runOnUiThread(action: ()->Unit) {
10 | activity.runOnUiThread(action)
11 | }
12 |
13 | open fun onBack(homeButton: Boolean) {
14 | }
15 |
16 | fun showToast(message: String) {
17 | runOnUiThread {
18 | activity.showToast(message)
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dan/videostab/BusyDialog.kt:
--------------------------------------------------------------------------------
1 | package com.dan.videostab
2 |
3 | import android.os.Bundle
4 | import android.os.Looper
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.ViewGroup
8 | import androidx.fragment.app.DialogFragment
9 | import com.dan.videostab.databinding.BusyDialogBinding
10 |
11 | class BusyDialog( private var message: String, private var progress: Int, private var total: Int): DialogFragment() {
12 |
13 | companion object {
14 | private const val FRAGMENT_TAG = "busy"
15 | private var currentDialog: BusyDialog? = null
16 | private lateinit var activity: MainActivity
17 |
18 | fun create(activity_: MainActivity) {
19 | activity = activity_
20 | }
21 |
22 | private fun runSafe( callback: ()->Unit ) {
23 | if (Looper.getMainLooper().isCurrentThread) {
24 | callback()
25 | } else {
26 | activity.runOnUiThread {
27 | callback()
28 | }
29 | }
30 | }
31 |
32 | fun show(message: String, progress: Int = -1, total: Int = -1) {
33 | runSafe {
34 | if (null == currentDialog) {
35 | val dialog = BusyDialog(message, progress, total)
36 | dialog.isCancelable = false
37 | dialog.show(activity.supportFragmentManager, FRAGMENT_TAG)
38 | currentDialog = dialog
39 | } else {
40 | currentDialog?.update(message, progress, total)
41 | }
42 | }
43 | }
44 |
45 | fun dismiss() {
46 | runSafe {
47 | currentDialog?.dismiss()
48 | currentDialog = null
49 | }
50 | }
51 |
52 | fun showCancel() {
53 | runSafe {
54 | currentDialog?.showCancel()
55 | }
56 | }
57 |
58 | fun isCanceled(): Boolean {
59 | return currentDialog?._isCanceled ?: false
60 | }
61 | }
62 |
63 | private var _binding: BusyDialogBinding? = null
64 | private var _isCanceled = false
65 | private var _showCancel = false
66 |
67 | fun showCancel() {
68 | _showCancel = true
69 | _binding?.let {
70 | it.buttonCancel.visibility = View.VISIBLE
71 | }
72 | }
73 |
74 | fun update(message: String, progress: Int = -1, total: Int = -1) {
75 | this.message = message
76 | this.progress = progress
77 | this.total = total
78 | update()
79 | }
80 |
81 | private fun update() {
82 | val infinite = progress < 0 || total <= 0 || progress > total
83 | val title = if (progress < 0) message else "$message ($progress)"
84 | _binding?.let {
85 | it.textBusyMessage.text = title
86 | if (infinite) {
87 | it.progressBar.isIndeterminate = true
88 | } else {
89 | it.progressBar.progress = 0
90 | it.progressBar.max = total
91 | it.progressBar.progress = progress
92 | it.progressBar.isIndeterminate = false
93 | }
94 | }
95 | }
96 |
97 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
98 | val binding = BusyDialogBinding.inflate( inflater )
99 | binding.textBusyMessage.text = message
100 | this._binding = binding
101 |
102 | binding.buttonCancel.setOnClickListener {
103 | _isCanceled = true
104 | binding.buttonCancel.isEnabled = false
105 | }
106 |
107 | if (_showCancel) {
108 | binding.buttonCancel.visibility = View.VISIBLE
109 | }
110 |
111 | update()
112 | return binding.root
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dan/videostab/FramesInput.kt:
--------------------------------------------------------------------------------
1 | package com.dan.videostab
2 |
3 | import android.net.Uri
4 | import org.opencv.core.Mat
5 |
6 | abstract class FramesInput {
7 | companion object {
8 | fun fixName(original: String?): String {
9 | if (null == original) return "unknown"
10 | return original.split('.')[0]
11 | }
12 | }
13 |
14 | abstract val fps: Int
15 | abstract val name: String
16 | abstract val width: Int
17 | abstract val height: Int
18 | abstract val imageUris: List?
19 | abstract val videoUri: Uri?
20 | abstract val size: Int
21 |
22 | abstract fun forEachFrame(callback: (Int, Int, Mat)->Boolean)
23 |
24 | fun firstFrame(): Mat {
25 | var firstFrame = Mat()
26 | forEachFrame { _, _, frame ->
27 | firstFrame = frame
28 | false
29 | }
30 | return firstFrame
31 | }
32 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dan/videostab/ImagesAsVideo.kt:
--------------------------------------------------------------------------------
1 | package com.dan.videostab
2 |
3 | import android.content.Context
4 | import android.graphics.*
5 | import android.net.Uri
6 | import android.util.AttributeSet
7 | import android.view.View
8 | import java.util.*
9 | import kotlin.concurrent.timer
10 |
11 |
12 |
13 | open class ImagesAsVideo @JvmOverloads constructor(
14 | context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
15 | ) : View(context, attrs, defStyleAttr) {
16 | private var _images: List? = null
17 | private var _fps: Int = 5
18 | private var _index: Int = 0
19 | private var _bitmap: Bitmap? = null
20 | private val _rect = Rect()
21 | private var _timer: Timer? = null
22 | private var _bitmapDisplayed = false
23 |
24 | fun setImages(images: List?, fps: Int = 0) {
25 | stopTimer()
26 | _images = images
27 | _index = 0
28 | _fps = when {
29 | fps < 5 -> 5
30 | fps > 30 -> 30
31 | else -> fps
32 | }
33 | updateBitmap()
34 | }
35 |
36 | fun play() {
37 | _index = 0
38 | updateBitmap()
39 | startTimer()
40 | }
41 |
42 | fun stop() {
43 | stopTimer()
44 | _index = 0
45 | updateBitmap()
46 | }
47 |
48 | private fun startTimer() {
49 | val period = 1000L / _fps
50 | _timer = timer(null, false, period, period) {
51 | if (_bitmapDisplayed) {
52 | nextFrame()
53 | }
54 | }
55 | }
56 |
57 | private fun stopTimer() {
58 | _timer?.cancel()
59 | _timer = null
60 | }
61 |
62 | private fun nextFrame() {
63 | val images = _images
64 | val index = _index
65 |
66 | if (null != images && images.isNotEmpty() && index >= 0 && index < (images.size-1)) {
67 | _index++
68 | updateBitmap()
69 | } else {
70 | stopTimer()
71 | }
72 | }
73 |
74 | private fun updateBitmap() {
75 | _bitmap = null
76 |
77 | val images = _images
78 | val context = this.context
79 | if (null != context && null != images && images.isNotEmpty()) {
80 | val index = _index
81 | if (index >= 0 && index < images.size) {
82 | try {
83 | val inputStream = context.contentResolver.openInputStream(images[index])
84 | if (null != inputStream) {
85 | _bitmap = BitmapFactory.decodeStream(inputStream)
86 | inputStream.close()
87 | }
88 | } catch (e: Exception) {
89 | e.printStackTrace()
90 | }
91 | }
92 | }
93 |
94 | _bitmapDisplayed = false
95 | invalidate()
96 | }
97 |
98 | override fun onDraw(canvas: Canvas?) {
99 | super.onDraw(canvas)
100 |
101 | _bitmapDisplayed = true
102 | if (null == canvas) return
103 |
104 | canvas.drawRGB(0,0,0)
105 |
106 | val bitmap = _bitmap ?: return
107 |
108 | var outputWidth = width
109 | var outputHeight = width * bitmap.height / bitmap.width
110 |
111 | if (outputHeight > height) {
112 | outputHeight = height
113 | outputWidth = height * bitmap.width / bitmap.height
114 | }
115 |
116 | val x = (width - outputWidth) / 2
117 | val y = (height - outputHeight) / 2
118 | _rect.set(x, y, x + outputWidth, y + outputHeight)
119 |
120 | canvas.drawBitmap(bitmap, null, _rect, null)
121 | }
122 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dan/videostab/OutputParams.kt:
--------------------------------------------------------------------------------
1 | package com.dan.videostab
2 |
3 | class OutputParams {
4 | companion object {
5 | const val VALUE_UNKNOWN = Int.MIN_VALUE
6 |
7 | const val COMPARE_NOT_CHANGED = 0
8 | const val COMPARE_CHANGED_ONLY_FPS = 1
9 | const val COMPARE_CHANGED = 2
10 |
11 | const val KEY_FPS = "FPS"
12 | const val KEY_ALGORITHM = "ALGORITHM"
13 | const val KEY_STRENGTH = "STRENGTH"
14 | const val KEY_CROP = "CROP"
15 | const val KEY_ALIGN = "ALIGN"
16 |
17 | private fun compare(a: Map, b: Map): Int {
18 | var fpsChanged = false
19 |
20 | a.forEach { (key, value) ->
21 | if (value != b.getOrDefault(key, VALUE_UNKNOWN)) {
22 | if (KEY_FPS == key) {
23 | fpsChanged = true
24 | } else {
25 | return COMPARE_CHANGED
26 | }
27 | }
28 | }
29 |
30 | return if (fpsChanged) COMPARE_CHANGED_ONLY_FPS else COMPARE_NOT_CHANGED
31 | }
32 | }
33 |
34 | private val _params = mutableMapOf()
35 |
36 | fun set(key: String, value: Int) {
37 | _params[key] = value
38 | }
39 |
40 | fun get(key: String): Int {
41 | return _params.getOrDefault(key, VALUE_UNKNOWN)
42 | }
43 |
44 | fun compareWith(other: OutputParams?): Int {
45 | if (null == other) return COMPARE_CHANGED
46 |
47 | val compare1 = compare(_params, other._params)
48 | if (COMPARE_CHANGED == compare1) return COMPARE_CHANGED
49 |
50 | val compare2 = compare(other._params, _params)
51 | if (COMPARE_CHANGED == compare2) return COMPARE_CHANGED
52 |
53 | if (COMPARE_CHANGED_ONLY_FPS == compare1 || COMPARE_CHANGED_ONLY_FPS == compare2) return COMPARE_CHANGED_ONLY_FPS
54 | return COMPARE_NOT_CHANGED
55 | }
56 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dan/videostab/Settings.kt:
--------------------------------------------------------------------------------
1 |
2 | package com.dan.videostab
3 |
4 | import android.app.Activity
5 | import android.content.Context
6 | import android.os.Environment
7 | import java.io.File
8 | import kotlin.reflect.KMutableProperty
9 | import kotlin.reflect.KVisibility
10 | import kotlin.reflect.full.createType
11 | import kotlin.reflect.full.declaredMemberProperties
12 |
13 | /**
14 | Settings: all public var fields will be saved
15 | */
16 | class Settings( private val activity: Activity) {
17 |
18 | companion object {
19 | const val ALGORITHM_GENERIC = 0
20 | const val ALGORITHM_GENERIC_B = 1
21 | const val ALGORITHM_STILL = 2
22 | const val ALGORITHM_HORIZONTAL_PANNING = 3
23 | const val ALGORITHM_HORIZONTAL_PANNING_B = 4
24 | const val ALGORITHM_VERTICAL_PANNING = 5
25 | const val ALGORITHM_VERTICAL_PANNING_B = 6
26 | const val ALGORITHM_PANNING = 7
27 | const val ALGORITHM_PANNING_B = 8
28 | const val ALGORITHM_NO_ROTATION = 9
29 |
30 | val SAVE_FOLDER = File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES), "VideoStab")
31 | }
32 |
33 | var algorithm: Int = ALGORITHM_GENERIC
34 | var strength: Int = 1
35 | var encodeH265 = true
36 | var keepAudio = false
37 |
38 | init {
39 | loadProperties()
40 | }
41 |
42 |
43 | private fun forEachSettingProperty( listener: (KMutableProperty<*>)->Unit ) {
44 | for( member in this::class.declaredMemberProperties ) {
45 | if (member.visibility == KVisibility.PUBLIC && member is KMutableProperty<*>) {
46 | listener.invoke(member)
47 | }
48 | }
49 | }
50 |
51 | private fun loadProperties() {
52 | val preferences = activity.getPreferences(Context.MODE_PRIVATE)
53 |
54 | forEachSettingProperty { property ->
55 | when( property.returnType ) {
56 | Boolean::class.createType() -> property.setter.call( this, preferences.getBoolean( property.name, property.getter.call(this) as Boolean ) )
57 | Int::class.createType() -> property.setter.call( this, preferences.getInt( property.name, property.getter.call(this) as Int ) )
58 | Long::class.createType() -> property.setter.call( this, preferences.getLong( property.name, property.getter.call(this) as Long ) )
59 | Float::class.createType() -> property.setter.call( this, preferences.getFloat( property.name, property.getter.call(this) as Float ) )
60 | String::class.createType() -> property.setter.call( this, preferences.getString( property.name, property.getter.call(this) as String ) )
61 | }
62 | }
63 | }
64 |
65 | fun saveProperties() {
66 | val preferences = activity.getPreferences(Context.MODE_PRIVATE)
67 | val editor = preferences.edit()
68 |
69 | forEachSettingProperty { property ->
70 | when( property.returnType ) {
71 | Boolean::class.createType() -> editor.putBoolean( property.name, property.getter.call(this) as Boolean )
72 | Int::class.createType() -> editor.putInt( property.name, property.getter.call(this) as Int )
73 | Long::class.createType() -> editor.putLong( property.name, property.getter.call(this) as Long )
74 | Float::class.createType() -> editor.putFloat( property.name, property.getter.call(this) as Float )
75 | String::class.createType() -> editor.putString( property.name, property.getter.call(this) as String )
76 | }
77 | }
78 |
79 | editor.apply()
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/app/src/main/java/com/dan/videostab/SettingsFragment.kt:
--------------------------------------------------------------------------------
1 | package com.dan.videostab
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import com.dan.videostab.databinding.SettingsFragmentBinding
8 |
9 |
10 | class SettingsFragment(activity: MainActivity ) : AppFragment(activity) {
11 |
12 | companion object {
13 | fun show(activity: MainActivity ) {
14 | activity.pushView("Settings", SettingsFragment( activity ))
15 | }
16 | }
17 |
18 | private lateinit var binding: SettingsFragmentBinding
19 |
20 | private fun updateView() {
21 | binding.switchEncode265.text = if (binding.switchEncode265.isChecked) "Encoder H265/HEVC" else "Encoder H264 (legacy)"
22 | binding.switchKeepAudio.text = if (binding.switchKeepAudio.isChecked) "Keep audio" else "Don't keep audio"
23 | }
24 |
25 | override fun onBack(homeButton: Boolean) {
26 | settings.encodeH265 = binding.switchEncode265.isChecked
27 | settings.keepAudio = binding.switchKeepAudio.isChecked
28 | settings.saveProperties()
29 | }
30 |
31 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
32 | binding = SettingsFragmentBinding.inflate( inflater )
33 |
34 | binding.switchEncode265.isChecked = settings.encodeH265
35 | binding.switchKeepAudio.isChecked = settings.keepAudio
36 |
37 | binding.switchEncode265.setOnCheckedChangeListener { _, _ -> updateView() }
38 | binding.switchKeepAudio.setOnCheckedChangeListener { _, _ -> updateView() }
39 |
40 | updateView()
41 |
42 | return binding.root
43 | }
44 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dan/videostab/TmpFiles.kt:
--------------------------------------------------------------------------------
1 | package com.dan.videostab
2 |
3 | import java.io.File
4 |
5 | class TmpFiles(private val path: String) {
6 | fun delete( startsWidth: String = "" ) {
7 | File(path).listFiles()?.forEach { file ->
8 | if (file.isFile) {
9 | val deleteFile = startsWidth.isEmpty() ||file.name.startsWith(startsWidth)
10 | if (deleteFile) file.delete()
11 | }
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dan/videostab/Trajectory.kt:
--------------------------------------------------------------------------------
1 | package com.dan.videostab
2 |
3 | import org.opencv.core.Mat
4 | import kotlin.math.cos
5 | import kotlin.math.sin
6 |
7 |
8 | class Trajectory(val x: List, val y: List, val a: List) {
9 | val size: Int
10 | get() = x.size
11 |
12 | fun getTransform(index: Int, T: Mat) {
13 | val a = this.a[index]
14 |
15 | T.put(0, 0, cos(a))
16 | T.put(0, 1, -sin(a))
17 | T.put(1, 0, sin(a))
18 | T.put(1, 1, cos(a))
19 |
20 | T.put(0, 2, x[index])
21 | T.put(1, 2, y[index])
22 | }
23 | }
24 |
25 |
26 | fun List.delta(to: List): List {
27 | val result = mutableListOf()
28 | for (index in this.indices) result.add(to[index] - this[index])
29 | return result.toList()
30 | }
31 |
32 |
33 | fun List.distribute(): List {
34 | val result = mutableListOf()
35 | val first = this.first()
36 | val last = this.last()
37 | for (index in this.indices) result.add( first + (last - first) * index / (size - 1) )
38 | return result.toList()
39 | }
40 |
41 |
42 | fun List.movingAverage(windowSize: Int): List {
43 | val result = mutableListOf()
44 |
45 | for(i in this.indices) {
46 | var sum = 0.0
47 | val from = if (i >= windowSize) (i - windowSize) else 0
48 | val to = if ((i + windowSize) < size) (i + windowSize) else (size - 1)
49 | val count = to - from + 1
50 | for(j in from..to) sum += this[j]
51 | result.add(sum / count)
52 | }
53 |
54 | return result.toList()
55 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/dan/videostab/VideoFramesInput.kt:
--------------------------------------------------------------------------------
1 | package com.dan.videostab
2 |
3 | import android.content.Context
4 | import android.net.Uri
5 | import androidx.documentfile.provider.DocumentFile
6 | import org.opencv.core.Mat
7 | import org.opencv.videoio.VideoCapture
8 | import org.opencv.videoio.Videoio.*
9 | import java.io.FileNotFoundException
10 |
11 | class VideoFramesInput( private val context: Context, private val _videoUri: Uri) : FramesInput() {
12 | companion object {
13 | private fun open(context: Context, uri: Uri): VideoCapture {
14 | val pfd = context.contentResolver.openFileDescriptor(uri, "r") ?: throw FileNotFoundException()
15 | val fd = pfd.detachFd()
16 | val videoCapture = VideoCapture(":$fd")
17 | pfd.close()
18 | if (!videoCapture.isOpened) throw FileNotFoundException()
19 | videoCapture.set(CAP_PROP_ORIENTATION_AUTO, 1.0 )
20 | return videoCapture
21 | }
22 | }
23 |
24 | private var _fps: Int = 0
25 | private val _name: String
26 | private var _width: Int = 0
27 | private var _height: Int = 0
28 | private var _size: Int = 0
29 |
30 | override val fps: Int
31 | get() = _fps
32 |
33 | override val name: String
34 | get() = _name
35 |
36 | override val width: Int
37 | get() = _width
38 |
39 | override val height: Int
40 | get() = _height
41 |
42 | override val size: Int
43 | get() = _size
44 |
45 | override val imageUris: List?
46 | get() = null
47 |
48 | override val videoUri: Uri
49 | get() = _videoUri
50 |
51 | init {
52 | val document = DocumentFile.fromSingleUri(context, _videoUri) ?: throw FileNotFoundException()
53 | _name = fixName(document.name)
54 | withVideoInput { videoInput ->
55 | _fps = videoInput.get(CAP_PROP_FPS).toInt()
56 | _width = videoInput.get(CAP_PROP_FRAME_WIDTH).toInt()
57 | _height = videoInput.get(CAP_PROP_FRAME_HEIGHT).toInt()
58 | _size = videoInput.get(CAP_PROP_FRAME_COUNT).toInt()
59 | }
60 |
61 | if (_size <= 0) _size = VideoTools.countFrames(context, _videoUri)
62 | }
63 |
64 | override fun forEachFrame(callback: (Int, Int, Mat) -> Boolean) {
65 | var counter = 0
66 | withVideoInput { videoInput ->
67 | val frame = Mat()
68 | while(counter < _size && videoInput.read(frame)) {
69 | if (!callback(counter, _size, frame)) {
70 | break
71 | }
72 | counter++
73 | }
74 | }
75 | }
76 |
77 | private fun withVideoInput(callback: (VideoCapture)->Unit) {
78 | val videoInput = open(context, _videoUri)
79 | callback(videoInput)
80 | videoInput.release()
81 | }
82 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/busy_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
15 |
22 |
23 |
33 |
34 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/mask_edit_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
16 |
17 |
25 |
26 |
35 |
36 |
37 |
41 |
42 |
51 |
52 |
62 |
63 |
64 |
65 |
70 |
71 |
78 |
79 |
89 |
90 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/settings_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
14 |
15 |
19 |
20 |
27 |
28 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/app_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3700B3
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | VideoStab
3 |
4 | Generic
5 | Generic (B)
6 | Still
7 | Horizontal panning
8 | Horizontal panning (B)
9 | Vertical panning
10 | Vertical panning (B)
11 | Panning
12 | Panning (B)
13 | No rotation
14 |
15 |
16 | Auto-detect
17 | 15
18 | 24
19 | 25
20 | 30
21 | 50
22 | 60
23 | 120
24 |
25 |
26 | Auto
27 | 0%
28 | 5%
29 | 10%
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/src/test/java/com/dan/videostab/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.dan.videostab
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | ext.kotlin_version = '1.5.10'
4 | repositories {
5 | google()
6 | jcenter()
7 | }
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:4.2.2'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 |
12 | // NOTE: Do not place your application dependencies here; they belong
13 | // in the individual module build.gradle files
14 | }
15 | }
16 |
17 | allprojects {
18 | repositories {
19 | google()
20 | jcenter()
21 | }
22 | }
23 |
24 | task clean(type: Delete) {
25 | delete rootProject.buildDir
26 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Jun 30 15:02:00 CEST 2022
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/opencv/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 30
5 | buildToolsVersion "30.0.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 24
9 | targetSdkVersion 30
10 | }
11 |
12 | buildTypes {
13 | release {
14 | minifyEnabled false
15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
16 | }
17 | }
18 | sourceSets {
19 | main {
20 | jni {
21 | srcDirs 'src/main/jni', 'src/main/jnilibs'
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/opencv/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/opencv/src/main/aidl/org/opencv/engine/OpenCVEngineInterface.aidl:
--------------------------------------------------------------------------------
1 | package org.opencv.engine;
2 |
3 | /**
4 | * Class provides a Java interface for OpenCV Engine Service. It's synchronous with native OpenCVEngine class.
5 | */
6 | interface OpenCVEngineInterface
7 | {
8 | /**
9 | * @return Returns service version.
10 | */
11 | int getEngineVersion();
12 |
13 | /**
14 | * Finds an installed OpenCV library.
15 | * @param OpenCV version.
16 | * @return Returns path to OpenCV native libs or an empty string if OpenCV can not be found.
17 | */
18 | String getLibPathByVersion(String version);
19 |
20 | /**
21 | * Tries to install defined version of OpenCV from Google Play Market.
22 | * @param OpenCV version.
23 | * @return Returns true if installation was successful or OpenCV package has been already installed.
24 | */
25 | boolean installVersion(String version);
26 |
27 | /**
28 | * Returns list of libraries in loading order, separated by semicolon.
29 | * @param OpenCV version.
30 | * @return Returns names of OpenCV libraries, separated by semicolon.
31 | */
32 | String getLibraryList(String version);
33 | }
34 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/android/CameraActivity.java:
--------------------------------------------------------------------------------
1 | package org.opencv.android;
2 |
3 | import android.annotation.TargetApi;
4 | import android.app.Activity;
5 | import android.content.Context;
6 | import android.content.pm.PackageManager;
7 | import android.os.Build;
8 | import android.util.AttributeSet;
9 | import android.view.View;
10 |
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | import static android.Manifest.permission.CAMERA;
15 |
16 | public class CameraActivity extends Activity {
17 |
18 | private static final int CAMERA_PERMISSION_REQUEST_CODE = 200;
19 |
20 | protected List extends CameraBridgeViewBase> getCameraViewList() {
21 | return new ArrayList();
22 | }
23 |
24 | protected void onCameraPermissionGranted() {
25 | List extends CameraBridgeViewBase> cameraViews = getCameraViewList();
26 | if (cameraViews == null) {
27 | return;
28 | }
29 | for (CameraBridgeViewBase cameraBridgeViewBase: cameraViews) {
30 | if (cameraBridgeViewBase != null) {
31 | cameraBridgeViewBase.setCameraPermissionGranted();
32 | }
33 | }
34 | }
35 |
36 | @Override
37 | protected void onStart() {
38 | super.onStart();
39 | boolean havePermission = true;
40 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
41 | if (checkSelfPermission(CAMERA) != PackageManager.PERMISSION_GRANTED) {
42 | requestPermissions(new String[]{CAMERA}, CAMERA_PERMISSION_REQUEST_CODE);
43 | havePermission = false;
44 | }
45 | }
46 | if (havePermission) {
47 | onCameraPermissionGranted();
48 | }
49 | }
50 |
51 | @Override
52 | @TargetApi(Build.VERSION_CODES.M)
53 | public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
54 | if (requestCode == CAMERA_PERMISSION_REQUEST_CODE && grantResults.length > 0
55 | && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
56 | onCameraPermissionGranted();
57 | }
58 | super.onRequestPermissionsResult(requestCode, permissions, grantResults);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/android/CameraGLSurfaceView.java:
--------------------------------------------------------------------------------
1 | package org.opencv.android;
2 |
3 | import org.opencv.R;
4 |
5 | import android.content.Context;
6 | import android.content.res.TypedArray;
7 | import android.opengl.GLSurfaceView;
8 | import android.util.AttributeSet;
9 | import android.util.Log;
10 | import android.view.SurfaceHolder;
11 |
12 | public class CameraGLSurfaceView extends GLSurfaceView {
13 |
14 | private static final String LOGTAG = "CameraGLSurfaceView";
15 |
16 | public interface CameraTextureListener {
17 | /**
18 | * This method is invoked when camera preview has started. After this method is invoked
19 | * the frames will start to be delivered to client via the onCameraFrame() callback.
20 | * @param width - the width of the frames that will be delivered
21 | * @param height - the height of the frames that will be delivered
22 | */
23 | public void onCameraViewStarted(int width, int height);
24 |
25 | /**
26 | * This method is invoked when camera preview has been stopped for some reason.
27 | * No frames will be delivered via onCameraFrame() callback after this method is called.
28 | */
29 | public void onCameraViewStopped();
30 |
31 | /**
32 | * This method is invoked when a new preview frame from Camera is ready.
33 | * @param texIn - the OpenGL texture ID that contains frame in RGBA format
34 | * @param texOut - the OpenGL texture ID that can be used to store modified frame image t display
35 | * @param width - the width of the frame
36 | * @param height - the height of the frame
37 | * @return `true` if `texOut` should be displayed, `false` - to show `texIn`
38 | */
39 | public boolean onCameraTexture(int texIn, int texOut, int width, int height);
40 | };
41 |
42 | private CameraTextureListener mTexListener;
43 | private CameraGLRendererBase mRenderer;
44 |
45 | public CameraGLSurfaceView(Context context, AttributeSet attrs) {
46 | super(context, attrs);
47 |
48 | TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
49 | int cameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);
50 | styledAttrs.recycle();
51 |
52 | if(android.os.Build.VERSION.SDK_INT >= 21)
53 | mRenderer = new Camera2Renderer(this);
54 | else
55 | mRenderer = new CameraRenderer(this);
56 |
57 | setCameraIndex(cameraIndex);
58 |
59 | setEGLContextClientVersion(2);
60 | setRenderer(mRenderer);
61 | setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
62 | }
63 |
64 | public void setCameraTextureListener(CameraTextureListener texListener)
65 | {
66 | mTexListener = texListener;
67 | }
68 |
69 | public CameraTextureListener getCameraTextureListener()
70 | {
71 | return mTexListener;
72 | }
73 |
74 | public void setCameraIndex(int cameraIndex) {
75 | mRenderer.setCameraIndex(cameraIndex);
76 | }
77 |
78 | public void setMaxCameraPreviewSize(int maxWidth, int maxHeight) {
79 | mRenderer.setMaxCameraPreviewSize(maxWidth, maxHeight);
80 | }
81 |
82 | @Override
83 | public void surfaceCreated(SurfaceHolder holder) {
84 | super.surfaceCreated(holder);
85 | }
86 |
87 | @Override
88 | public void surfaceDestroyed(SurfaceHolder holder) {
89 | mRenderer.mHaveSurface = false;
90 | super.surfaceDestroyed(holder);
91 | }
92 |
93 | @Override
94 | public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
95 | super.surfaceChanged(holder, format, w, h);
96 | }
97 |
98 | @Override
99 | public void onResume() {
100 | Log.i(LOGTAG, "onResume");
101 | super.onResume();
102 | mRenderer.onResume();
103 | }
104 |
105 | @Override
106 | public void onPause() {
107 | Log.i(LOGTAG, "onPause");
108 | mRenderer.onPause();
109 | super.onPause();
110 | }
111 |
112 | public void enableView() {
113 | mRenderer.enableView();
114 | }
115 |
116 | public void disableView() {
117 | mRenderer.disableView();
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/android/FpsMeter.java:
--------------------------------------------------------------------------------
1 | package org.opencv.android;
2 |
3 | import java.text.DecimalFormat;
4 |
5 | import org.opencv.core.Core;
6 |
7 | import android.graphics.Canvas;
8 | import android.graphics.Color;
9 | import android.graphics.Paint;
10 | import android.util.Log;
11 |
12 | public class FpsMeter {
13 | private static final String TAG = "FpsMeter";
14 | private static final int STEP = 20;
15 | private static final DecimalFormat FPS_FORMAT = new DecimalFormat("0.00");
16 |
17 | private int mFramesCounter;
18 | private double mFrequency;
19 | private long mprevFrameTime;
20 | private String mStrfps;
21 | Paint mPaint;
22 | boolean mIsInitialized = false;
23 | int mWidth = 0;
24 | int mHeight = 0;
25 |
26 | public void init() {
27 | mFramesCounter = 0;
28 | mFrequency = Core.getTickFrequency();
29 | mprevFrameTime = Core.getTickCount();
30 | mStrfps = "";
31 |
32 | mPaint = new Paint();
33 | mPaint.setColor(Color.BLUE);
34 | mPaint.setTextSize(20);
35 | }
36 |
37 | public void measure() {
38 | if (!mIsInitialized) {
39 | init();
40 | mIsInitialized = true;
41 | } else {
42 | mFramesCounter++;
43 | if (mFramesCounter % STEP == 0) {
44 | long time = Core.getTickCount();
45 | double fps = STEP * mFrequency / (time - mprevFrameTime);
46 | mprevFrameTime = time;
47 | if (mWidth != 0 && mHeight != 0)
48 | mStrfps = FPS_FORMAT.format(fps) + " FPS@" + Integer.valueOf(mWidth) + "x" + Integer.valueOf(mHeight);
49 | else
50 | mStrfps = FPS_FORMAT.format(fps) + " FPS";
51 | Log.i(TAG, mStrfps);
52 | }
53 | }
54 | }
55 |
56 | public void setResolution(int width, int height) {
57 | mWidth = width;
58 | mHeight = height;
59 | }
60 |
61 | public void draw(Canvas canvas, float offsetx, float offsety) {
62 | Log.d(TAG, mStrfps);
63 | canvas.drawText(mStrfps, offsetx, offsety, mPaint);
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/android/InstallCallbackInterface.java:
--------------------------------------------------------------------------------
1 | package org.opencv.android;
2 |
3 | /**
4 | * Installation callback interface.
5 | */
6 | public interface InstallCallbackInterface
7 | {
8 | /**
9 | * New package installation is required.
10 | */
11 | static final int NEW_INSTALLATION = 0;
12 | /**
13 | * Current package installation is in progress.
14 | */
15 | static final int INSTALLATION_PROGRESS = 1;
16 |
17 | /**
18 | * Target package name.
19 | * @return Return target package name.
20 | */
21 | public String getPackageName();
22 | /**
23 | * Installation is approved.
24 | */
25 | public void install();
26 | /**
27 | * Installation is canceled.
28 | */
29 | public void cancel();
30 | /**
31 | * Wait for package installation.
32 | */
33 | public void wait_install();
34 | };
35 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/android/LoaderCallbackInterface.java:
--------------------------------------------------------------------------------
1 | package org.opencv.android;
2 |
3 | /**
4 | * Interface for callback object in case of asynchronous initialization of OpenCV.
5 | */
6 | public interface LoaderCallbackInterface
7 | {
8 | /**
9 | * OpenCV initialization finished successfully.
10 | */
11 | static final int SUCCESS = 0;
12 | /**
13 | * Google Play Market cannot be invoked.
14 | */
15 | static final int MARKET_ERROR = 2;
16 | /**
17 | * OpenCV library installation has been canceled by the user.
18 | */
19 | static final int INSTALL_CANCELED = 3;
20 | /**
21 | * This version of OpenCV Manager Service is incompatible with the app. Possibly, a service update is required.
22 | */
23 | static final int INCOMPATIBLE_MANAGER_VERSION = 4;
24 | /**
25 | * OpenCV library initialization has failed.
26 | */
27 | static final int INIT_FAILED = 0xff;
28 |
29 | /**
30 | * Callback method, called after OpenCV library initialization.
31 | * @param status status of initialization (see initialization status constants).
32 | */
33 | public void onManagerConnected(int status);
34 |
35 | /**
36 | * Callback method, called in case the package installation is needed.
37 | * @param callback answer object with approve and cancel methods and the package description.
38 | */
39 | public void onPackageInstall(final int operation, InstallCallbackInterface callback);
40 | };
41 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/android/OpenCVLoader.java:
--------------------------------------------------------------------------------
1 | package org.opencv.android;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * Helper class provides common initialization methods for OpenCV library.
7 | */
8 | public class OpenCVLoader
9 | {
10 | /**
11 | * OpenCV Library version 2.4.2.
12 | */
13 | public static final String OPENCV_VERSION_2_4_2 = "2.4.2";
14 |
15 | /**
16 | * OpenCV Library version 2.4.3.
17 | */
18 | public static final String OPENCV_VERSION_2_4_3 = "2.4.3";
19 |
20 | /**
21 | * OpenCV Library version 2.4.4.
22 | */
23 | public static final String OPENCV_VERSION_2_4_4 = "2.4.4";
24 |
25 | /**
26 | * OpenCV Library version 2.4.5.
27 | */
28 | public static final String OPENCV_VERSION_2_4_5 = "2.4.5";
29 |
30 | /**
31 | * OpenCV Library version 2.4.6.
32 | */
33 | public static final String OPENCV_VERSION_2_4_6 = "2.4.6";
34 |
35 | /**
36 | * OpenCV Library version 2.4.7.
37 | */
38 | public static final String OPENCV_VERSION_2_4_7 = "2.4.7";
39 |
40 | /**
41 | * OpenCV Library version 2.4.8.
42 | */
43 | public static final String OPENCV_VERSION_2_4_8 = "2.4.8";
44 |
45 | /**
46 | * OpenCV Library version 2.4.9.
47 | */
48 | public static final String OPENCV_VERSION_2_4_9 = "2.4.9";
49 |
50 | /**
51 | * OpenCV Library version 2.4.10.
52 | */
53 | public static final String OPENCV_VERSION_2_4_10 = "2.4.10";
54 |
55 | /**
56 | * OpenCV Library version 2.4.11.
57 | */
58 | public static final String OPENCV_VERSION_2_4_11 = "2.4.11";
59 |
60 | /**
61 | * OpenCV Library version 2.4.12.
62 | */
63 | public static final String OPENCV_VERSION_2_4_12 = "2.4.12";
64 |
65 | /**
66 | * OpenCV Library version 2.4.13.
67 | */
68 | public static final String OPENCV_VERSION_2_4_13 = "2.4.13";
69 |
70 | /**
71 | * OpenCV Library version 3.0.0.
72 | */
73 | public static final String OPENCV_VERSION_3_0_0 = "3.0.0";
74 |
75 | /**
76 | * OpenCV Library version 3.1.0.
77 | */
78 | public static final String OPENCV_VERSION_3_1_0 = "3.1.0";
79 |
80 | /**
81 | * OpenCV Library version 3.2.0.
82 | */
83 | public static final String OPENCV_VERSION_3_2_0 = "3.2.0";
84 |
85 | /**
86 | * OpenCV Library version 3.3.0.
87 | */
88 | public static final String OPENCV_VERSION_3_3_0 = "3.3.0";
89 |
90 | /**
91 | * OpenCV Library version 3.4.0.
92 | */
93 | public static final String OPENCV_VERSION_3_4_0 = "3.4.0";
94 |
95 | /**
96 | * Current OpenCV Library version
97 | */
98 | public static final String OPENCV_VERSION = "4.6.0";
99 |
100 |
101 | /**
102 | * Loads and initializes OpenCV library from current application package. Roughly, it's an analog of system.loadLibrary("opencv_java").
103 | * @return Returns true is initialization of OpenCV was successful.
104 | */
105 | public static boolean initDebug()
106 | {
107 | return StaticHelper.initOpenCV(false);
108 | }
109 |
110 | /**
111 | * Loads and initializes OpenCV library from current application package. Roughly, it's an analog of system.loadLibrary("opencv_java").
112 | * @param InitCuda load and initialize CUDA runtime libraries.
113 | * @return Returns true is initialization of OpenCV was successful.
114 | */
115 | public static boolean initDebug(boolean InitCuda)
116 | {
117 | return StaticHelper.initOpenCV(InitCuda);
118 | }
119 |
120 | /**
121 | * Loads and initializes OpenCV library using OpenCV Engine service.
122 | * @param Version OpenCV library version.
123 | * @param AppContext application context for connecting to the service.
124 | * @param Callback object, that implements LoaderCallbackInterface for handling the connection status.
125 | * @return Returns true if initialization of OpenCV is successful.
126 | */
127 | public static boolean initAsync(String Version, Context AppContext,
128 | LoaderCallbackInterface Callback)
129 | {
130 | return AsyncServiceHelper.initOpenCV(Version, AppContext, Callback);
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/android/StaticHelper.java:
--------------------------------------------------------------------------------
1 | package org.opencv.android;
2 |
3 | import org.opencv.core.Core;
4 |
5 | import java.util.StringTokenizer;
6 | import android.util.Log;
7 |
8 | class StaticHelper {
9 |
10 | public static boolean initOpenCV(boolean InitCuda)
11 | {
12 | boolean result;
13 | String libs = "";
14 |
15 | if(InitCuda)
16 | {
17 | loadLibrary("cudart");
18 | loadLibrary("nppc");
19 | loadLibrary("nppi");
20 | loadLibrary("npps");
21 | loadLibrary("cufft");
22 | loadLibrary("cublas");
23 | }
24 |
25 | Log.d(TAG, "Trying to get library list");
26 |
27 | try
28 | {
29 | System.loadLibrary("opencv_info");
30 | libs = getLibraryList();
31 | }
32 | catch(UnsatisfiedLinkError e)
33 | {
34 | Log.e(TAG, "OpenCV error: Cannot load info library for OpenCV");
35 | }
36 |
37 | Log.d(TAG, "Library list: \"" + libs + "\"");
38 | Log.d(TAG, "First attempt to load libs");
39 | if (initOpenCVLibs(libs))
40 | {
41 | Log.d(TAG, "First attempt to load libs is OK");
42 | String eol = System.getProperty("line.separator");
43 | for (String str : Core.getBuildInformation().split(eol))
44 | Log.i(TAG, str);
45 |
46 | result = true;
47 | }
48 | else
49 | {
50 | Log.d(TAG, "First attempt to load libs fails");
51 | result = false;
52 | }
53 |
54 | return result;
55 | }
56 |
57 | private static boolean loadLibrary(String Name)
58 | {
59 | boolean result = true;
60 |
61 | Log.d(TAG, "Trying to load library " + Name);
62 | try
63 | {
64 | System.loadLibrary(Name);
65 | Log.d(TAG, "Library " + Name + " loaded");
66 | }
67 | catch(UnsatisfiedLinkError e)
68 | {
69 | Log.d(TAG, "Cannot load library \"" + Name + "\"");
70 | e.printStackTrace();
71 | result = false;
72 | }
73 |
74 | return result;
75 | }
76 |
77 | private static boolean initOpenCVLibs(String Libs)
78 | {
79 | Log.d(TAG, "Trying to init OpenCV libs");
80 |
81 | boolean result = true;
82 |
83 | if ((null != Libs) && (Libs.length() != 0))
84 | {
85 | Log.d(TAG, "Trying to load libs by dependency list");
86 | StringTokenizer splitter = new StringTokenizer(Libs, ";");
87 | while(splitter.hasMoreTokens())
88 | {
89 | result &= loadLibrary(splitter.nextToken());
90 | }
91 | }
92 | else
93 | {
94 | // If dependencies list is not defined or empty.
95 | result = loadLibrary("opencv_java4");
96 | }
97 |
98 | return result;
99 | }
100 |
101 | private static final String TAG = "OpenCV/StaticHelper";
102 |
103 | private static native String getLibraryList();
104 | }
105 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/Algorithm.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.core;
5 |
6 |
7 |
8 | // C++: class Algorithm
9 | /**
10 | * This is a base class for all more or less complex algorithms in OpenCV
11 | *
12 | * especially for classes of algorithms, for which there can be multiple implementations. The examples
13 | * are stereo correspondence (for which there are algorithms like block matching, semi-global block
14 | * matching, graph-cut etc.), background subtraction (which can be done using mixture-of-gaussians
15 | * models, codebook-based algorithm etc.), optical flow (block matching, Lucas-Kanade, Horn-Schunck
16 | * etc.).
17 | *
18 | * Here is example of SimpleBlobDetector use in your application via Algorithm interface:
19 | * SNIPPET: snippets/core_various.cpp Algorithm
20 | */
21 | public class Algorithm {
22 |
23 | protected final long nativeObj;
24 | protected Algorithm(long addr) { nativeObj = addr; }
25 |
26 | public long getNativeObjAddr() { return nativeObj; }
27 |
28 | // internal usage only
29 | public static Algorithm __fromPtr__(long addr) { return new Algorithm(addr); }
30 |
31 | //
32 | // C++: void cv::Algorithm::clear()
33 | //
34 |
35 | /**
36 | * Clears the algorithm state
37 | */
38 | public void clear() {
39 | clear_0(nativeObj);
40 | }
41 |
42 |
43 | //
44 | // C++: void cv::Algorithm::write(Ptr_FileStorage fs, String name = String())
45 | //
46 |
47 | // Unknown type 'Ptr_FileStorage' (I), skipping the function
48 |
49 |
50 | //
51 | // C++: void cv::Algorithm::read(FileNode fn)
52 | //
53 |
54 | // Unknown type 'FileNode' (I), skipping the function
55 |
56 |
57 | //
58 | // C++: bool cv::Algorithm::empty()
59 | //
60 |
61 | /**
62 | * Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read
63 | * @return automatically generated
64 | */
65 | public boolean empty() {
66 | return empty_0(nativeObj);
67 | }
68 |
69 |
70 | //
71 | // C++: void cv::Algorithm::save(String filename)
72 | //
73 |
74 | /**
75 | * Saves the algorithm to a file.
76 | * In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs).
77 | * @param filename automatically generated
78 | */
79 | public void save(String filename) {
80 | save_0(nativeObj, filename);
81 | }
82 |
83 |
84 | //
85 | // C++: String cv::Algorithm::getDefaultName()
86 | //
87 |
88 | /**
89 | * Returns the algorithm string identifier.
90 | * This string is used as top level xml/yml node tag when the object is saved to a file or string.
91 | * @return automatically generated
92 | */
93 | public String getDefaultName() {
94 | return getDefaultName_0(nativeObj);
95 | }
96 |
97 |
98 | @Override
99 | protected void finalize() throws Throwable {
100 | delete(nativeObj);
101 | }
102 |
103 |
104 |
105 | // C++: void cv::Algorithm::clear()
106 | private static native void clear_0(long nativeObj);
107 |
108 | // C++: bool cv::Algorithm::empty()
109 | private static native boolean empty_0(long nativeObj);
110 |
111 | // C++: void cv::Algorithm::save(String filename)
112 | private static native void save_0(long nativeObj, String filename);
113 |
114 | // C++: String cv::Algorithm::getDefaultName()
115 | private static native String getDefaultName_0(long nativeObj);
116 |
117 | // native support for java finalize()
118 | private static native void delete(long nativeObj);
119 |
120 | }
121 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/CvException.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | public class CvException extends RuntimeException {
4 |
5 | private static final long serialVersionUID = 1L;
6 |
7 | public CvException(String msg) {
8 | super(msg);
9 | }
10 |
11 | @Override
12 | public String toString() {
13 | return "CvException [" + super.toString() + "]";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/DMatch.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | //C++: class DMatch
4 |
5 | /**
6 | * Structure for matching: query descriptor index, train descriptor index, train
7 | * image index and distance between descriptors.
8 | */
9 | public class DMatch {
10 |
11 | /**
12 | * Query descriptor index.
13 | */
14 | public int queryIdx;
15 | /**
16 | * Train descriptor index.
17 | */
18 | public int trainIdx;
19 | /**
20 | * Train image index.
21 | */
22 | public int imgIdx;
23 |
24 | // javadoc: DMatch::distance
25 | public float distance;
26 |
27 | // javadoc: DMatch::DMatch()
28 | public DMatch() {
29 | this(-1, -1, Float.MAX_VALUE);
30 | }
31 |
32 | // javadoc: DMatch::DMatch(_queryIdx, _trainIdx, _distance)
33 | public DMatch(int _queryIdx, int _trainIdx, float _distance) {
34 | queryIdx = _queryIdx;
35 | trainIdx = _trainIdx;
36 | imgIdx = -1;
37 | distance = _distance;
38 | }
39 |
40 | // javadoc: DMatch::DMatch(_queryIdx, _trainIdx, _imgIdx, _distance)
41 | public DMatch(int _queryIdx, int _trainIdx, int _imgIdx, float _distance) {
42 | queryIdx = _queryIdx;
43 | trainIdx = _trainIdx;
44 | imgIdx = _imgIdx;
45 | distance = _distance;
46 | }
47 |
48 | public boolean lessThan(DMatch it) {
49 | return distance < it.distance;
50 | }
51 |
52 | @Override
53 | public String toString() {
54 | return "DMatch [queryIdx=" + queryIdx + ", trainIdx=" + trainIdx
55 | + ", imgIdx=" + imgIdx + ", distance=" + distance + "]";
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/KeyPoint.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | import org.opencv.core.Point;
4 |
5 | //javadoc: KeyPoint
6 | public class KeyPoint {
7 |
8 | /**
9 | * Coordinates of the keypoint.
10 | */
11 | public Point pt;
12 | /**
13 | * Diameter of the useful keypoint adjacent area.
14 | */
15 | public float size;
16 | /**
17 | * Computed orientation of the keypoint (-1 if not applicable).
18 | */
19 | public float angle;
20 | /**
21 | * The response, by which the strongest keypoints have been selected. Can
22 | * be used for further sorting or subsampling.
23 | */
24 | public float response;
25 | /**
26 | * Octave (pyramid layer), from which the keypoint has been extracted.
27 | */
28 | public int octave;
29 | /**
30 | * Object ID, that can be used to cluster keypoints by an object they
31 | * belong to.
32 | */
33 | public int class_id;
34 |
35 | // javadoc:KeyPoint::KeyPoint(x,y,_size,_angle,_response,_octave,_class_id)
36 | public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave, int _class_id) {
37 | pt = new Point(x, y);
38 | size = _size;
39 | angle = _angle;
40 | response = _response;
41 | octave = _octave;
42 | class_id = _class_id;
43 | }
44 |
45 | // javadoc: KeyPoint::KeyPoint()
46 | public KeyPoint() {
47 | this(0, 0, 0, -1, 0, 0, -1);
48 | }
49 |
50 | // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle, _response, _octave)
51 | public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave) {
52 | this(x, y, _size, _angle, _response, _octave, -1);
53 | }
54 |
55 | // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle, _response)
56 | public KeyPoint(float x, float y, float _size, float _angle, float _response) {
57 | this(x, y, _size, _angle, _response, 0, -1);
58 | }
59 |
60 | // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle)
61 | public KeyPoint(float x, float y, float _size, float _angle) {
62 | this(x, y, _size, _angle, 0, 0, -1);
63 | }
64 |
65 | // javadoc: KeyPoint::KeyPoint(x, y, _size)
66 | public KeyPoint(float x, float y, float _size) {
67 | this(x, y, _size, -1, 0, 0, -1);
68 | }
69 |
70 | @Override
71 | public String toString() {
72 | return "KeyPoint [pt=" + pt + ", size=" + size + ", angle=" + angle
73 | + ", response=" + response + ", octave=" + octave
74 | + ", class_id=" + class_id + "]";
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/MatMatMul.kt:
--------------------------------------------------------------------------------
1 | package org.opencv.core
2 |
3 | operator fun Mat.times(other: Mat): Mat = this.matMul(other)
4 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/MatOfByte.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 | public class MatOfByte extends Mat {
7 | // 8UC(x)
8 | private static final int _depth = CvType.CV_8U;
9 | private static final int _channels = 1;
10 |
11 | public MatOfByte() {
12 | super();
13 | }
14 |
15 | protected MatOfByte(long addr) {
16 | super(addr);
17 | if( !empty() && checkVector(_channels, _depth) < 0 )
18 | throw new IllegalArgumentException("Incompatible Mat");
19 | //FIXME: do we need release() here?
20 | }
21 |
22 | public static MatOfByte fromNativeAddr(long addr) {
23 | return new MatOfByte(addr);
24 | }
25 |
26 | public MatOfByte(Mat m) {
27 | super(m, Range.all());
28 | if( !empty() && checkVector(_channels, _depth) < 0 )
29 | throw new IllegalArgumentException("Incompatible Mat");
30 | //FIXME: do we need release() here?
31 | }
32 |
33 | public MatOfByte(byte...a) {
34 | super();
35 | fromArray(a);
36 | }
37 |
38 | public MatOfByte(int offset, int length, byte...a) {
39 | super();
40 | fromArray(offset, length, a);
41 | }
42 |
43 | public void alloc(int elemNumber) {
44 | if(elemNumber>0)
45 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
46 | }
47 |
48 | public void fromArray(byte...a) {
49 | if(a==null || a.length==0)
50 | return;
51 | int num = a.length / _channels;
52 | alloc(num);
53 | put(0, 0, a); //TODO: check ret val!
54 | }
55 |
56 | public void fromArray(int offset, int length, byte...a) {
57 | if (offset < 0)
58 | throw new IllegalArgumentException("offset < 0");
59 | if (a == null)
60 | throw new NullPointerException();
61 | if (length < 0 || length + offset > a.length)
62 | throw new IllegalArgumentException("invalid 'length' parameter: " + Integer.toString(length));
63 | if (a.length == 0)
64 | return;
65 | int num = length / _channels;
66 | alloc(num);
67 | put(0, 0, a, offset, length); //TODO: check ret val!
68 | }
69 |
70 | public byte[] toArray() {
71 | int num = checkVector(_channels, _depth);
72 | if(num < 0)
73 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
74 | byte[] a = new byte[num * _channels];
75 | if(num == 0)
76 | return a;
77 | get(0, 0, a); //TODO: check ret val!
78 | return a;
79 | }
80 |
81 | public void fromList(List lb) {
82 | if(lb==null || lb.size()==0)
83 | return;
84 | Byte ab[] = lb.toArray(new Byte[0]);
85 | byte a[] = new byte[ab.length];
86 | for(int i=0; i toList() {
92 | byte[] a = toArray();
93 | Byte ab[] = new Byte[a.length];
94 | for(int i=0; i0)
42 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
43 | }
44 |
45 |
46 | public void fromArray(DMatch...a) {
47 | if(a==null || a.length==0)
48 | return;
49 | int num = a.length;
50 | alloc(num);
51 | float buff[] = new float[num * _channels];
52 | for(int i=0; i ldm) {
75 | DMatch adm[] = ldm.toArray(new DMatch[0]);
76 | fromArray(adm);
77 | }
78 |
79 | public List toList() {
80 | DMatch[] adm = toArray();
81 | return Arrays.asList(adm);
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/MatOfDouble.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 | public class MatOfDouble extends Mat {
7 | // 64FC(x)
8 | private static final int _depth = CvType.CV_64F;
9 | private static final int _channels = 1;
10 |
11 | public MatOfDouble() {
12 | super();
13 | }
14 |
15 | protected MatOfDouble(long addr) {
16 | super(addr);
17 | if( !empty() && checkVector(_channels, _depth) < 0 )
18 | throw new IllegalArgumentException("Incompatible Mat");
19 | //FIXME: do we need release() here?
20 | }
21 |
22 | public static MatOfDouble fromNativeAddr(long addr) {
23 | return new MatOfDouble(addr);
24 | }
25 |
26 | public MatOfDouble(Mat m) {
27 | super(m, Range.all());
28 | if( !empty() && checkVector(_channels, _depth) < 0 )
29 | throw new IllegalArgumentException("Incompatible Mat");
30 | //FIXME: do we need release() here?
31 | }
32 |
33 | public MatOfDouble(double...a) {
34 | super();
35 | fromArray(a);
36 | }
37 |
38 | public void alloc(int elemNumber) {
39 | if(elemNumber>0)
40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
41 | }
42 |
43 | public void fromArray(double...a) {
44 | if(a==null || a.length==0)
45 | return;
46 | int num = a.length / _channels;
47 | alloc(num);
48 | put(0, 0, a); //TODO: check ret val!
49 | }
50 |
51 | public double[] toArray() {
52 | int num = checkVector(_channels, _depth);
53 | if(num < 0)
54 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
55 | double[] a = new double[num * _channels];
56 | if(num == 0)
57 | return a;
58 | get(0, 0, a); //TODO: check ret val!
59 | return a;
60 | }
61 |
62 | public void fromList(List lb) {
63 | if(lb==null || lb.size()==0)
64 | return;
65 | Double ab[] = lb.toArray(new Double[0]);
66 | double a[] = new double[ab.length];
67 | for(int i=0; i toList() {
73 | double[] a = toArray();
74 | Double ab[] = new Double[a.length];
75 | for(int i=0; i0)
40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
41 | }
42 |
43 | public void fromArray(float...a) {
44 | if(a==null || a.length==0)
45 | return;
46 | int num = a.length / _channels;
47 | alloc(num);
48 | put(0, 0, a); //TODO: check ret val!
49 | }
50 |
51 | public float[] toArray() {
52 | int num = checkVector(_channels, _depth);
53 | if(num < 0)
54 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
55 | float[] a = new float[num * _channels];
56 | if(num == 0)
57 | return a;
58 | get(0, 0, a); //TODO: check ret val!
59 | return a;
60 | }
61 |
62 | public void fromList(List lb) {
63 | if(lb==null || lb.size()==0)
64 | return;
65 | Float ab[] = lb.toArray(new Float[0]);
66 | float a[] = new float[ab.length];
67 | for(int i=0; i toList() {
73 | float[] a = toArray();
74 | Float ab[] = new Float[a.length];
75 | for(int i=0; i0)
40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
41 | }
42 |
43 | public void fromArray(float...a) {
44 | if(a==null || a.length==0)
45 | return;
46 | int num = a.length / _channels;
47 | alloc(num);
48 | put(0, 0, a); //TODO: check ret val!
49 | }
50 |
51 | public float[] toArray() {
52 | int num = checkVector(_channels, _depth);
53 | if(num < 0)
54 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
55 | float[] a = new float[num * _channels];
56 | if(num == 0)
57 | return a;
58 | get(0, 0, a); //TODO: check ret val!
59 | return a;
60 | }
61 |
62 | public void fromList(List lb) {
63 | if(lb==null || lb.size()==0)
64 | return;
65 | Float ab[] = lb.toArray(new Float[0]);
66 | float a[] = new float[ab.length];
67 | for(int i=0; i toList() {
73 | float[] a = toArray();
74 | Float ab[] = new Float[a.length];
75 | for(int i=0; i0)
40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
41 | }
42 |
43 | public void fromArray(float...a) {
44 | if(a==null || a.length==0)
45 | return;
46 | int num = a.length / _channels;
47 | alloc(num);
48 | put(0, 0, a); //TODO: check ret val!
49 | }
50 |
51 | public float[] toArray() {
52 | int num = checkVector(_channels, _depth);
53 | if(num < 0)
54 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
55 | float[] a = new float[num * _channels];
56 | if(num == 0)
57 | return a;
58 | get(0, 0, a); //TODO: check ret val!
59 | return a;
60 | }
61 |
62 | public void fromList(List lb) {
63 | if(lb==null || lb.size()==0)
64 | return;
65 | Float ab[] = lb.toArray(new Float[0]);
66 | float a[] = new float[ab.length];
67 | for(int i=0; i toList() {
73 | float[] a = toArray();
74 | Float ab[] = new Float[a.length];
75 | for(int i=0; i0)
41 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
42 | }
43 |
44 | public void fromArray(int...a) {
45 | if(a==null || a.length==0)
46 | return;
47 | int num = a.length / _channels;
48 | alloc(num);
49 | put(0, 0, a); //TODO: check ret val!
50 | }
51 |
52 | public int[] toArray() {
53 | int num = checkVector(_channels, _depth);
54 | if(num < 0)
55 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
56 | int[] a = new int[num * _channels];
57 | if(num == 0)
58 | return a;
59 | get(0, 0, a); //TODO: check ret val!
60 | return a;
61 | }
62 |
63 | public void fromList(List lb) {
64 | if(lb==null || lb.size()==0)
65 | return;
66 | Integer ab[] = lb.toArray(new Integer[0]);
67 | int a[] = new int[ab.length];
68 | for(int i=0; i toList() {
74 | int[] a = toArray();
75 | Integer ab[] = new Integer[a.length];
76 | for(int i=0; i0)
41 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
42 | }
43 |
44 | public void fromArray(int...a) {
45 | if(a==null || a.length==0)
46 | return;
47 | int num = a.length / _channels;
48 | alloc(num);
49 | put(0, 0, a); //TODO: check ret val!
50 | }
51 |
52 | public int[] toArray() {
53 | int num = checkVector(_channels, _depth);
54 | if(num < 0)
55 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
56 | int[] a = new int[num * _channels];
57 | if(num == 0)
58 | return a;
59 | get(0, 0, a); //TODO: check ret val!
60 | return a;
61 | }
62 |
63 | public void fromList(List lb) {
64 | if(lb==null || lb.size()==0)
65 | return;
66 | Integer ab[] = lb.toArray(new Integer[0]);
67 | int a[] = new int[ab.length];
68 | for(int i=0; i toList() {
74 | int[] a = toArray();
75 | Integer ab[] = new Integer[a.length];
76 | for(int i=0; i0)
42 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
43 | }
44 |
45 | public void fromArray(KeyPoint...a) {
46 | if(a==null || a.length==0)
47 | return;
48 | int num = a.length;
49 | alloc(num);
50 | float buff[] = new float[num * _channels];
51 | for(int i=0; i lkp) {
78 | KeyPoint akp[] = lkp.toArray(new KeyPoint[0]);
79 | fromArray(akp);
80 | }
81 |
82 | public List toList() {
83 | KeyPoint[] akp = toArray();
84 | return Arrays.asList(akp);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/MatOfPoint.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 | public class MatOfPoint extends Mat {
7 | // 32SC2
8 | private static final int _depth = CvType.CV_32S;
9 | private static final int _channels = 2;
10 |
11 | public MatOfPoint() {
12 | super();
13 | }
14 |
15 | protected MatOfPoint(long addr) {
16 | super(addr);
17 | if( !empty() && checkVector(_channels, _depth) < 0 )
18 | throw new IllegalArgumentException("Incompatible Mat");
19 | //FIXME: do we need release() here?
20 | }
21 |
22 | public static MatOfPoint fromNativeAddr(long addr) {
23 | return new MatOfPoint(addr);
24 | }
25 |
26 | public MatOfPoint(Mat m) {
27 | super(m, Range.all());
28 | if( !empty() && checkVector(_channels, _depth) < 0 )
29 | throw new IllegalArgumentException("Incompatible Mat");
30 | //FIXME: do we need release() here?
31 | }
32 |
33 | public MatOfPoint(Point...a) {
34 | super();
35 | fromArray(a);
36 | }
37 |
38 | public void alloc(int elemNumber) {
39 | if(elemNumber>0)
40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
41 | }
42 |
43 | public void fromArray(Point...a) {
44 | if(a==null || a.length==0)
45 | return;
46 | int num = a.length;
47 | alloc(num);
48 | int buff[] = new int[num * _channels];
49 | for(int i=0; i lp) {
70 | Point ap[] = lp.toArray(new Point[0]);
71 | fromArray(ap);
72 | }
73 |
74 | public List toList() {
75 | Point[] ap = toArray();
76 | return Arrays.asList(ap);
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/MatOfPoint2f.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 | public class MatOfPoint2f extends Mat {
7 | // 32FC2
8 | private static final int _depth = CvType.CV_32F;
9 | private static final int _channels = 2;
10 |
11 | public MatOfPoint2f() {
12 | super();
13 | }
14 |
15 | protected MatOfPoint2f(long addr) {
16 | super(addr);
17 | if( !empty() && checkVector(_channels, _depth) < 0 )
18 | throw new IllegalArgumentException("Incompatible Mat");
19 | //FIXME: do we need release() here?
20 | }
21 |
22 | public static MatOfPoint2f fromNativeAddr(long addr) {
23 | return new MatOfPoint2f(addr);
24 | }
25 |
26 | public MatOfPoint2f(Mat m) {
27 | super(m, Range.all());
28 | if( !empty() && checkVector(_channels, _depth) < 0 )
29 | throw new IllegalArgumentException("Incompatible Mat");
30 | //FIXME: do we need release() here?
31 | }
32 |
33 | public MatOfPoint2f(Point...a) {
34 | super();
35 | fromArray(a);
36 | }
37 |
38 | public void alloc(int elemNumber) {
39 | if(elemNumber>0)
40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
41 | }
42 |
43 | public void fromArray(Point...a) {
44 | if(a==null || a.length==0)
45 | return;
46 | int num = a.length;
47 | alloc(num);
48 | float buff[] = new float[num * _channels];
49 | for(int i=0; i lp) {
70 | Point ap[] = lp.toArray(new Point[0]);
71 | fromArray(ap);
72 | }
73 |
74 | public List toList() {
75 | Point[] ap = toArray();
76 | return Arrays.asList(ap);
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/MatOfPoint3.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 | public class MatOfPoint3 extends Mat {
7 | // 32SC3
8 | private static final int _depth = CvType.CV_32S;
9 | private static final int _channels = 3;
10 |
11 | public MatOfPoint3() {
12 | super();
13 | }
14 |
15 | protected MatOfPoint3(long addr) {
16 | super(addr);
17 | if( !empty() && checkVector(_channels, _depth) < 0 )
18 | throw new IllegalArgumentException("Incompatible Mat");
19 | //FIXME: do we need release() here?
20 | }
21 |
22 | public static MatOfPoint3 fromNativeAddr(long addr) {
23 | return new MatOfPoint3(addr);
24 | }
25 |
26 | public MatOfPoint3(Mat m) {
27 | super(m, Range.all());
28 | if( !empty() && checkVector(_channels, _depth) < 0 )
29 | throw new IllegalArgumentException("Incompatible Mat");
30 | //FIXME: do we need release() here?
31 | }
32 |
33 | public MatOfPoint3(Point3...a) {
34 | super();
35 | fromArray(a);
36 | }
37 |
38 | public void alloc(int elemNumber) {
39 | if(elemNumber>0)
40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
41 | }
42 |
43 | public void fromArray(Point3...a) {
44 | if(a==null || a.length==0)
45 | return;
46 | int num = a.length;
47 | alloc(num);
48 | int buff[] = new int[num * _channels];
49 | for(int i=0; i lp) {
71 | Point3 ap[] = lp.toArray(new Point3[0]);
72 | fromArray(ap);
73 | }
74 |
75 | public List toList() {
76 | Point3[] ap = toArray();
77 | return Arrays.asList(ap);
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/MatOfPoint3f.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 | public class MatOfPoint3f extends Mat {
7 | // 32FC3
8 | private static final int _depth = CvType.CV_32F;
9 | private static final int _channels = 3;
10 |
11 | public MatOfPoint3f() {
12 | super();
13 | }
14 |
15 | protected MatOfPoint3f(long addr) {
16 | super(addr);
17 | if( !empty() && checkVector(_channels, _depth) < 0 )
18 | throw new IllegalArgumentException("Incompatible Mat");
19 | //FIXME: do we need release() here?
20 | }
21 |
22 | public static MatOfPoint3f fromNativeAddr(long addr) {
23 | return new MatOfPoint3f(addr);
24 | }
25 |
26 | public MatOfPoint3f(Mat m) {
27 | super(m, Range.all());
28 | if( !empty() && checkVector(_channels, _depth) < 0 )
29 | throw new IllegalArgumentException("Incompatible Mat");
30 | //FIXME: do we need release() here?
31 | }
32 |
33 | public MatOfPoint3f(Point3...a) {
34 | super();
35 | fromArray(a);
36 | }
37 |
38 | public void alloc(int elemNumber) {
39 | if(elemNumber>0)
40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
41 | }
42 |
43 | public void fromArray(Point3...a) {
44 | if(a==null || a.length==0)
45 | return;
46 | int num = a.length;
47 | alloc(num);
48 | float buff[] = new float[num * _channels];
49 | for(int i=0; i lp) {
71 | Point3 ap[] = lp.toArray(new Point3[0]);
72 | fromArray(ap);
73 | }
74 |
75 | public List toList() {
76 | Point3[] ap = toArray();
77 | return Arrays.asList(ap);
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/MatOfRect.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 |
7 | public class MatOfRect extends Mat {
8 | // 32SC4
9 | private static final int _depth = CvType.CV_32S;
10 | private static final int _channels = 4;
11 |
12 | public MatOfRect() {
13 | super();
14 | }
15 |
16 | protected MatOfRect(long addr) {
17 | super(addr);
18 | if( !empty() && checkVector(_channels, _depth) < 0 )
19 | throw new IllegalArgumentException("Incompatible Mat");
20 | //FIXME: do we need release() here?
21 | }
22 |
23 | public static MatOfRect fromNativeAddr(long addr) {
24 | return new MatOfRect(addr);
25 | }
26 |
27 | public MatOfRect(Mat m) {
28 | super(m, Range.all());
29 | if( !empty() && checkVector(_channels, _depth) < 0 )
30 | throw new IllegalArgumentException("Incompatible Mat");
31 | //FIXME: do we need release() here?
32 | }
33 |
34 | public MatOfRect(Rect...a) {
35 | super();
36 | fromArray(a);
37 | }
38 |
39 | public void alloc(int elemNumber) {
40 | if(elemNumber>0)
41 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
42 | }
43 |
44 | public void fromArray(Rect...a) {
45 | if(a==null || a.length==0)
46 | return;
47 | int num = a.length;
48 | alloc(num);
49 | int buff[] = new int[num * _channels];
50 | for(int i=0; i lr) {
73 | Rect ap[] = lr.toArray(new Rect[0]);
74 | fromArray(ap);
75 | }
76 |
77 | public List toList() {
78 | Rect[] ar = toArray();
79 | return Arrays.asList(ar);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/MatOfRect2d.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 |
7 | public class MatOfRect2d extends Mat {
8 | // 64FC4
9 | private static final int _depth = CvType.CV_64F;
10 | private static final int _channels = 4;
11 |
12 | public MatOfRect2d() {
13 | super();
14 | }
15 |
16 | protected MatOfRect2d(long addr) {
17 | super(addr);
18 | if( !empty() && checkVector(_channels, _depth) < 0 )
19 | throw new IllegalArgumentException("Incompatible Mat");
20 | //FIXME: do we need release() here?
21 | }
22 |
23 | public static MatOfRect2d fromNativeAddr(long addr) {
24 | return new MatOfRect2d(addr);
25 | }
26 |
27 | public MatOfRect2d(Mat m) {
28 | super(m, Range.all());
29 | if( !empty() && checkVector(_channels, _depth) < 0 )
30 | throw new IllegalArgumentException("Incompatible Mat");
31 | //FIXME: do we need release() here?
32 | }
33 |
34 | public MatOfRect2d(Rect2d...a) {
35 | super();
36 | fromArray(a);
37 | }
38 |
39 | public void alloc(int elemNumber) {
40 | if(elemNumber>0)
41 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
42 | }
43 |
44 | public void fromArray(Rect2d...a) {
45 | if(a==null || a.length==0)
46 | return;
47 | int num = a.length;
48 | alloc(num);
49 | double buff[] = new double[num * _channels];
50 | for(int i=0; i lr) {
73 | Rect2d ap[] = lr.toArray(new Rect2d[0]);
74 | fromArray(ap);
75 | }
76 |
77 | public List toList() {
78 | Rect2d[] ar = toArray();
79 | return Arrays.asList(ar);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/MatOfRotatedRect.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 | import org.opencv.core.RotatedRect;
7 |
8 |
9 |
10 | public class MatOfRotatedRect extends Mat {
11 | // 32FC5
12 | private static final int _depth = CvType.CV_32F;
13 | private static final int _channels = 5;
14 |
15 | public MatOfRotatedRect() {
16 | super();
17 | }
18 |
19 | protected MatOfRotatedRect(long addr) {
20 | super(addr);
21 | if( !empty() && checkVector(_channels, _depth) < 0 )
22 | throw new IllegalArgumentException("Incompatible Mat");
23 | //FIXME: do we need release() here?
24 | }
25 |
26 | public static MatOfRotatedRect fromNativeAddr(long addr) {
27 | return new MatOfRotatedRect(addr);
28 | }
29 |
30 | public MatOfRotatedRect(Mat m) {
31 | super(m, Range.all());
32 | if( !empty() && checkVector(_channels, _depth) < 0 )
33 | throw new IllegalArgumentException("Incompatible Mat");
34 | //FIXME: do we need release() here?
35 | }
36 |
37 | public MatOfRotatedRect(RotatedRect...a) {
38 | super();
39 | fromArray(a);
40 | }
41 |
42 | public void alloc(int elemNumber) {
43 | if(elemNumber>0)
44 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
45 | }
46 |
47 | public void fromArray(RotatedRect...a) {
48 | if(a==null || a.length==0)
49 | return;
50 | int num = a.length;
51 | alloc(num);
52 | float buff[] = new float[num * _channels];
53 | for(int i=0; i lr) {
78 | RotatedRect ap[] = lr.toArray(new RotatedRect[0]);
79 | fromArray(ap);
80 | }
81 |
82 | public List toList() {
83 | RotatedRect[] ar = toArray();
84 | return Arrays.asList(ar);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/Point.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | //javadoc:Point_
4 | public class Point {
5 |
6 | public double x, y;
7 |
8 | public Point(double x, double y) {
9 | this.x = x;
10 | this.y = y;
11 | }
12 |
13 | public Point() {
14 | this(0, 0);
15 | }
16 |
17 | public Point(double[] vals) {
18 | this();
19 | set(vals);
20 | }
21 |
22 | public void set(double[] vals) {
23 | if (vals != null) {
24 | x = vals.length > 0 ? vals[0] : 0;
25 | y = vals.length > 1 ? vals[1] : 0;
26 | } else {
27 | x = 0;
28 | y = 0;
29 | }
30 | }
31 |
32 | public Point clone() {
33 | return new Point(x, y);
34 | }
35 |
36 | public double dot(Point p) {
37 | return x * p.x + y * p.y;
38 | }
39 |
40 | @Override
41 | public int hashCode() {
42 | final int prime = 31;
43 | int result = 1;
44 | long temp;
45 | temp = Double.doubleToLongBits(x);
46 | result = prime * result + (int) (temp ^ (temp >>> 32));
47 | temp = Double.doubleToLongBits(y);
48 | result = prime * result + (int) (temp ^ (temp >>> 32));
49 | return result;
50 | }
51 |
52 | @Override
53 | public boolean equals(Object obj) {
54 | if (this == obj) return true;
55 | if (!(obj instanceof Point)) return false;
56 | Point it = (Point) obj;
57 | return x == it.x && y == it.y;
58 | }
59 |
60 | public boolean inside(Rect r) {
61 | return r.contains(this);
62 | }
63 |
64 | @Override
65 | public String toString() {
66 | return "{" + x + ", " + y + "}";
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/Point3.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | //javadoc:Point3_
4 | public class Point3 {
5 |
6 | public double x, y, z;
7 |
8 | public Point3(double x, double y, double z) {
9 | this.x = x;
10 | this.y = y;
11 | this.z = z;
12 | }
13 |
14 | public Point3() {
15 | this(0, 0, 0);
16 | }
17 |
18 | public Point3(Point p) {
19 | x = p.x;
20 | y = p.y;
21 | z = 0;
22 | }
23 |
24 | public Point3(double[] vals) {
25 | this();
26 | set(vals);
27 | }
28 |
29 | public void set(double[] vals) {
30 | if (vals != null) {
31 | x = vals.length > 0 ? vals[0] : 0;
32 | y = vals.length > 1 ? vals[1] : 0;
33 | z = vals.length > 2 ? vals[2] : 0;
34 | } else {
35 | x = 0;
36 | y = 0;
37 | z = 0;
38 | }
39 | }
40 |
41 | public Point3 clone() {
42 | return new Point3(x, y, z);
43 | }
44 |
45 | public double dot(Point3 p) {
46 | return x * p.x + y * p.y + z * p.z;
47 | }
48 |
49 | public Point3 cross(Point3 p) {
50 | return new Point3(y * p.z - z * p.y, z * p.x - x * p.z, x * p.y - y * p.x);
51 | }
52 |
53 | @Override
54 | public int hashCode() {
55 | final int prime = 31;
56 | int result = 1;
57 | long temp;
58 | temp = Double.doubleToLongBits(x);
59 | result = prime * result + (int) (temp ^ (temp >>> 32));
60 | temp = Double.doubleToLongBits(y);
61 | result = prime * result + (int) (temp ^ (temp >>> 32));
62 | temp = Double.doubleToLongBits(z);
63 | result = prime * result + (int) (temp ^ (temp >>> 32));
64 | return result;
65 | }
66 |
67 | @Override
68 | public boolean equals(Object obj) {
69 | if (this == obj) return true;
70 | if (!(obj instanceof Point3)) return false;
71 | Point3 it = (Point3) obj;
72 | return x == it.x && y == it.y && z == it.z;
73 | }
74 |
75 | @Override
76 | public String toString() {
77 | return "{" + x + ", " + y + ", " + z + "}";
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/Range.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | //javadoc:Range
4 | public class Range {
5 |
6 | public int start, end;
7 |
8 | public Range(int s, int e) {
9 | this.start = s;
10 | this.end = e;
11 | }
12 |
13 | public Range() {
14 | this(0, 0);
15 | }
16 |
17 | public Range(double[] vals) {
18 | set(vals);
19 | }
20 |
21 | public void set(double[] vals) {
22 | if (vals != null) {
23 | start = vals.length > 0 ? (int) vals[0] : 0;
24 | end = vals.length > 1 ? (int) vals[1] : 0;
25 | } else {
26 | start = 0;
27 | end = 0;
28 | }
29 |
30 | }
31 |
32 | public int size() {
33 | return empty() ? 0 : end - start;
34 | }
35 |
36 | public boolean empty() {
37 | return end <= start;
38 | }
39 |
40 | public static Range all() {
41 | return new Range(Integer.MIN_VALUE, Integer.MAX_VALUE);
42 | }
43 |
44 | public Range intersection(Range r1) {
45 | Range r = new Range(Math.max(r1.start, this.start), Math.min(r1.end, this.end));
46 | r.end = Math.max(r.end, r.start);
47 | return r;
48 | }
49 |
50 | public Range shift(int delta) {
51 | return new Range(start + delta, end + delta);
52 | }
53 |
54 | public Range clone() {
55 | return new Range(start, end);
56 | }
57 |
58 | @Override
59 | public int hashCode() {
60 | final int prime = 31;
61 | int result = 1;
62 | long temp;
63 | temp = Double.doubleToLongBits(start);
64 | result = prime * result + (int) (temp ^ (temp >>> 32));
65 | temp = Double.doubleToLongBits(end);
66 | result = prime * result + (int) (temp ^ (temp >>> 32));
67 | return result;
68 | }
69 |
70 | @Override
71 | public boolean equals(Object obj) {
72 | if (this == obj) return true;
73 | if (!(obj instanceof Range)) return false;
74 | Range it = (Range) obj;
75 | return start == it.start && end == it.end;
76 | }
77 |
78 | @Override
79 | public String toString() {
80 | return "[" + start + ", " + end + ")";
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/Rect.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | //javadoc:Rect_
4 | public class Rect {
5 |
6 | public int x, y, width, height;
7 |
8 | public Rect(int x, int y, int width, int height) {
9 | this.x = x;
10 | this.y = y;
11 | this.width = width;
12 | this.height = height;
13 | }
14 |
15 | public Rect() {
16 | this(0, 0, 0, 0);
17 | }
18 |
19 | public Rect(Point p1, Point p2) {
20 | x = (int) (p1.x < p2.x ? p1.x : p2.x);
21 | y = (int) (p1.y < p2.y ? p1.y : p2.y);
22 | width = (int) (p1.x > p2.x ? p1.x : p2.x) - x;
23 | height = (int) (p1.y > p2.y ? p1.y : p2.y) - y;
24 | }
25 |
26 | public Rect(Point p, Size s) {
27 | this((int) p.x, (int) p.y, (int) s.width, (int) s.height);
28 | }
29 |
30 | public Rect(double[] vals) {
31 | set(vals);
32 | }
33 |
34 | public void set(double[] vals) {
35 | if (vals != null) {
36 | x = vals.length > 0 ? (int) vals[0] : 0;
37 | y = vals.length > 1 ? (int) vals[1] : 0;
38 | width = vals.length > 2 ? (int) vals[2] : 0;
39 | height = vals.length > 3 ? (int) vals[3] : 0;
40 | } else {
41 | x = 0;
42 | y = 0;
43 | width = 0;
44 | height = 0;
45 | }
46 | }
47 |
48 | public Rect clone() {
49 | return new Rect(x, y, width, height);
50 | }
51 |
52 | public Point tl() {
53 | return new Point(x, y);
54 | }
55 |
56 | public Point br() {
57 | return new Point(x + width, y + height);
58 | }
59 |
60 | public Size size() {
61 | return new Size(width, height);
62 | }
63 |
64 | public double area() {
65 | return width * height;
66 | }
67 |
68 | public boolean empty() {
69 | return width <= 0 || height <= 0;
70 | }
71 |
72 | public boolean contains(Point p) {
73 | return x <= p.x && p.x < x + width && y <= p.y && p.y < y + height;
74 | }
75 |
76 | @Override
77 | public int hashCode() {
78 | final int prime = 31;
79 | int result = 1;
80 | long temp;
81 | temp = Double.doubleToLongBits(height);
82 | result = prime * result + (int) (temp ^ (temp >>> 32));
83 | temp = Double.doubleToLongBits(width);
84 | result = prime * result + (int) (temp ^ (temp >>> 32));
85 | temp = Double.doubleToLongBits(x);
86 | result = prime * result + (int) (temp ^ (temp >>> 32));
87 | temp = Double.doubleToLongBits(y);
88 | result = prime * result + (int) (temp ^ (temp >>> 32));
89 | return result;
90 | }
91 |
92 | @Override
93 | public boolean equals(Object obj) {
94 | if (this == obj) return true;
95 | if (!(obj instanceof Rect)) return false;
96 | Rect it = (Rect) obj;
97 | return x == it.x && y == it.y && width == it.width && height == it.height;
98 | }
99 |
100 | @Override
101 | public String toString() {
102 | return "{" + x + ", " + y + ", " + width + "x" + height + "}";
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/Rect2d.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | //javadoc:Rect2d_
4 | public class Rect2d {
5 |
6 | public double x, y, width, height;
7 |
8 | public Rect2d(double x, double y, double width, double height) {
9 | this.x = x;
10 | this.y = y;
11 | this.width = width;
12 | this.height = height;
13 | }
14 |
15 | public Rect2d() {
16 | this(0, 0, 0, 0);
17 | }
18 |
19 | public Rect2d(Point p1, Point p2) {
20 | x = (double) (p1.x < p2.x ? p1.x : p2.x);
21 | y = (double) (p1.y < p2.y ? p1.y : p2.y);
22 | width = (double) (p1.x > p2.x ? p1.x : p2.x) - x;
23 | height = (double) (p1.y > p2.y ? p1.y : p2.y) - y;
24 | }
25 |
26 | public Rect2d(Point p, Size s) {
27 | this((double) p.x, (double) p.y, (double) s.width, (double) s.height);
28 | }
29 |
30 | public Rect2d(double[] vals) {
31 | set(vals);
32 | }
33 |
34 | public void set(double[] vals) {
35 | if (vals != null) {
36 | x = vals.length > 0 ? (double) vals[0] : 0;
37 | y = vals.length > 1 ? (double) vals[1] : 0;
38 | width = vals.length > 2 ? (double) vals[2] : 0;
39 | height = vals.length > 3 ? (double) vals[3] : 0;
40 | } else {
41 | x = 0;
42 | y = 0;
43 | width = 0;
44 | height = 0;
45 | }
46 | }
47 |
48 | public Rect2d clone() {
49 | return new Rect2d(x, y, width, height);
50 | }
51 |
52 | public Point tl() {
53 | return new Point(x, y);
54 | }
55 |
56 | public Point br() {
57 | return new Point(x + width, y + height);
58 | }
59 |
60 | public Size size() {
61 | return new Size(width, height);
62 | }
63 |
64 | public double area() {
65 | return width * height;
66 | }
67 |
68 | public boolean empty() {
69 | return width <= 0 || height <= 0;
70 | }
71 |
72 | public boolean contains(Point p) {
73 | return x <= p.x && p.x < x + width && y <= p.y && p.y < y + height;
74 | }
75 |
76 | @Override
77 | public int hashCode() {
78 | final int prime = 31;
79 | int result = 1;
80 | long temp;
81 | temp = Double.doubleToLongBits(height);
82 | result = prime * result + (int) (temp ^ (temp >>> 32));
83 | temp = Double.doubleToLongBits(width);
84 | result = prime * result + (int) (temp ^ (temp >>> 32));
85 | temp = Double.doubleToLongBits(x);
86 | result = prime * result + (int) (temp ^ (temp >>> 32));
87 | temp = Double.doubleToLongBits(y);
88 | result = prime * result + (int) (temp ^ (temp >>> 32));
89 | return result;
90 | }
91 |
92 | @Override
93 | public boolean equals(Object obj) {
94 | if (this == obj) return true;
95 | if (!(obj instanceof Rect2d)) return false;
96 | Rect2d it = (Rect2d) obj;
97 | return x == it.x && y == it.y && width == it.width && height == it.height;
98 | }
99 |
100 | @Override
101 | public String toString() {
102 | return "{" + x + ", " + y + ", " + width + "x" + height + "}";
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/RotatedRect.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | //javadoc:RotatedRect_
4 | public class RotatedRect {
5 |
6 | public Point center;
7 | public Size size;
8 | public double angle;
9 |
10 | public RotatedRect() {
11 | this.center = new Point();
12 | this.size = new Size();
13 | this.angle = 0;
14 | }
15 |
16 | public RotatedRect(Point c, Size s, double a) {
17 | this.center = c.clone();
18 | this.size = s.clone();
19 | this.angle = a;
20 | }
21 |
22 | public RotatedRect(double[] vals) {
23 | this();
24 | set(vals);
25 | }
26 |
27 | public void set(double[] vals) {
28 | if (vals != null) {
29 | center.x = vals.length > 0 ? (double) vals[0] : 0;
30 | center.y = vals.length > 1 ? (double) vals[1] : 0;
31 | size.width = vals.length > 2 ? (double) vals[2] : 0;
32 | size.height = vals.length > 3 ? (double) vals[3] : 0;
33 | angle = vals.length > 4 ? (double) vals[4] : 0;
34 | } else {
35 | center.x = 0;
36 | center.y = 0;
37 | size.width = 0;
38 | size.height = 0;
39 | angle = 0;
40 | }
41 | }
42 |
43 | public void points(Point pt[])
44 | {
45 | double _angle = angle * Math.PI / 180.0;
46 | double b = (double) Math.cos(_angle) * 0.5f;
47 | double a = (double) Math.sin(_angle) * 0.5f;
48 |
49 | pt[0] = new Point(
50 | center.x - a * size.height - b * size.width,
51 | center.y + b * size.height - a * size.width);
52 |
53 | pt[1] = new Point(
54 | center.x + a * size.height - b * size.width,
55 | center.y - b * size.height - a * size.width);
56 |
57 | pt[2] = new Point(
58 | 2 * center.x - pt[0].x,
59 | 2 * center.y - pt[0].y);
60 |
61 | pt[3] = new Point(
62 | 2 * center.x - pt[1].x,
63 | 2 * center.y - pt[1].y);
64 | }
65 |
66 | public Rect boundingRect()
67 | {
68 | Point pt[] = new Point[4];
69 | points(pt);
70 | Rect r = new Rect((int) Math.floor(Math.min(Math.min(Math.min(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
71 | (int) Math.floor(Math.min(Math.min(Math.min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)),
72 | (int) Math.ceil(Math.max(Math.max(Math.max(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
73 | (int) Math.ceil(Math.max(Math.max(Math.max(pt[0].y, pt[1].y), pt[2].y), pt[3].y)));
74 | r.width -= r.x - 1;
75 | r.height -= r.y - 1;
76 | return r;
77 | }
78 |
79 | public RotatedRect clone() {
80 | return new RotatedRect(center, size, angle);
81 | }
82 |
83 | @Override
84 | public int hashCode() {
85 | final int prime = 31;
86 | int result = 1;
87 | long temp;
88 | temp = Double.doubleToLongBits(center.x);
89 | result = prime * result + (int) (temp ^ (temp >>> 32));
90 | temp = Double.doubleToLongBits(center.y);
91 | result = prime * result + (int) (temp ^ (temp >>> 32));
92 | temp = Double.doubleToLongBits(size.width);
93 | result = prime * result + (int) (temp ^ (temp >>> 32));
94 | temp = Double.doubleToLongBits(size.height);
95 | result = prime * result + (int) (temp ^ (temp >>> 32));
96 | temp = Double.doubleToLongBits(angle);
97 | result = prime * result + (int) (temp ^ (temp >>> 32));
98 | return result;
99 | }
100 |
101 | @Override
102 | public boolean equals(Object obj) {
103 | if (this == obj) return true;
104 | if (!(obj instanceof RotatedRect)) return false;
105 | RotatedRect it = (RotatedRect) obj;
106 | return center.equals(it.center) && size.equals(it.size) && angle == it.angle;
107 | }
108 |
109 | @Override
110 | public String toString() {
111 | return "{ " + center + " " + size + " * " + angle + " }";
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/Scalar.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | //javadoc:Scalar_
4 | public class Scalar {
5 |
6 | public double val[];
7 |
8 | public Scalar(double v0, double v1, double v2, double v3) {
9 | val = new double[] { v0, v1, v2, v3 };
10 | }
11 |
12 | public Scalar(double v0, double v1, double v2) {
13 | val = new double[] { v0, v1, v2, 0 };
14 | }
15 |
16 | public Scalar(double v0, double v1) {
17 | val = new double[] { v0, v1, 0, 0 };
18 | }
19 |
20 | public Scalar(double v0) {
21 | val = new double[] { v0, 0, 0, 0 };
22 | }
23 |
24 | public Scalar(double[] vals) {
25 | if (vals != null && vals.length == 4)
26 | val = vals.clone();
27 | else {
28 | val = new double[4];
29 | set(vals);
30 | }
31 | }
32 |
33 | public void set(double[] vals) {
34 | if (vals != null) {
35 | val[0] = vals.length > 0 ? vals[0] : 0;
36 | val[1] = vals.length > 1 ? vals[1] : 0;
37 | val[2] = vals.length > 2 ? vals[2] : 0;
38 | val[3] = vals.length > 3 ? vals[3] : 0;
39 | } else
40 | val[0] = val[1] = val[2] = val[3] = 0;
41 | }
42 |
43 | public static Scalar all(double v) {
44 | return new Scalar(v, v, v, v);
45 | }
46 |
47 | public Scalar clone() {
48 | return new Scalar(val);
49 | }
50 |
51 | public Scalar mul(Scalar it, double scale) {
52 | return new Scalar(val[0] * it.val[0] * scale, val[1] * it.val[1] * scale,
53 | val[2] * it.val[2] * scale, val[3] * it.val[3] * scale);
54 | }
55 |
56 | public Scalar mul(Scalar it) {
57 | return mul(it, 1);
58 | }
59 |
60 | public Scalar conj() {
61 | return new Scalar(val[0], -val[1], -val[2], -val[3]);
62 | }
63 |
64 | public boolean isReal() {
65 | return val[1] == 0 && val[2] == 0 && val[3] == 0;
66 | }
67 |
68 | @Override
69 | public int hashCode() {
70 | final int prime = 31;
71 | int result = 1;
72 | result = prime * result + java.util.Arrays.hashCode(val);
73 | return result;
74 | }
75 |
76 | @Override
77 | public boolean equals(Object obj) {
78 | if (this == obj) return true;
79 | if (!(obj instanceof Scalar)) return false;
80 | Scalar it = (Scalar) obj;
81 | if (!java.util.Arrays.equals(val, it.val)) return false;
82 | return true;
83 | }
84 |
85 | @Override
86 | public String toString() {
87 | return "[" + val[0] + ", " + val[1] + ", " + val[2] + ", " + val[3] + "]";
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/Size.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | //javadoc:Size_
4 | public class Size {
5 |
6 | public double width, height;
7 |
8 | public Size(double width, double height) {
9 | this.width = width;
10 | this.height = height;
11 | }
12 |
13 | public Size() {
14 | this(0, 0);
15 | }
16 |
17 | public Size(Point p) {
18 | width = p.x;
19 | height = p.y;
20 | }
21 |
22 | public Size(double[] vals) {
23 | set(vals);
24 | }
25 |
26 | public void set(double[] vals) {
27 | if (vals != null) {
28 | width = vals.length > 0 ? vals[0] : 0;
29 | height = vals.length > 1 ? vals[1] : 0;
30 | } else {
31 | width = 0;
32 | height = 0;
33 | }
34 | }
35 |
36 | public double area() {
37 | return width * height;
38 | }
39 |
40 | public boolean empty() {
41 | return width <= 0 || height <= 0;
42 | }
43 |
44 | public Size clone() {
45 | return new Size(width, height);
46 | }
47 |
48 | @Override
49 | public int hashCode() {
50 | final int prime = 31;
51 | int result = 1;
52 | long temp;
53 | temp = Double.doubleToLongBits(height);
54 | result = prime * result + (int) (temp ^ (temp >>> 32));
55 | temp = Double.doubleToLongBits(width);
56 | result = prime * result + (int) (temp ^ (temp >>> 32));
57 | return result;
58 | }
59 |
60 | @Override
61 | public boolean equals(Object obj) {
62 | if (this == obj) return true;
63 | if (!(obj instanceof Size)) return false;
64 | Size it = (Size) obj;
65 | return width == it.width && height == it.height;
66 | }
67 |
68 | @Override
69 | public String toString() {
70 | return (int)width + "x" + (int)height;
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/TermCriteria.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | //javadoc:TermCriteria
4 | public class TermCriteria {
5 |
6 | /**
7 | * The maximum number of iterations or elements to compute
8 | */
9 | public static final int COUNT = 1;
10 | /**
11 | * The maximum number of iterations or elements to compute
12 | */
13 | public static final int MAX_ITER = COUNT;
14 | /**
15 | * The desired accuracy threshold or change in parameters at which the iterative algorithm is terminated.
16 | */
17 | public static final int EPS = 2;
18 |
19 | public int type;
20 | public int maxCount;
21 | public double epsilon;
22 |
23 | /**
24 | * Termination criteria for iterative algorithms.
25 | *
26 | * @param type
27 | * the type of termination criteria: COUNT, EPS or COUNT + EPS.
28 | * @param maxCount
29 | * the maximum number of iterations/elements.
30 | * @param epsilon
31 | * the desired accuracy.
32 | */
33 | public TermCriteria(int type, int maxCount, double epsilon) {
34 | this.type = type;
35 | this.maxCount = maxCount;
36 | this.epsilon = epsilon;
37 | }
38 |
39 | /**
40 | * Termination criteria for iterative algorithms.
41 | */
42 | public TermCriteria() {
43 | this(0, 0, 0.0);
44 | }
45 |
46 | public TermCriteria(double[] vals) {
47 | set(vals);
48 | }
49 |
50 | public void set(double[] vals) {
51 | if (vals != null) {
52 | type = vals.length > 0 ? (int) vals[0] : 0;
53 | maxCount = vals.length > 1 ? (int) vals[1] : 0;
54 | epsilon = vals.length > 2 ? (double) vals[2] : 0;
55 | } else {
56 | type = 0;
57 | maxCount = 0;
58 | epsilon = 0;
59 | }
60 | }
61 |
62 | public TermCriteria clone() {
63 | return new TermCriteria(type, maxCount, epsilon);
64 | }
65 |
66 | @Override
67 | public int hashCode() {
68 | final int prime = 31;
69 | int result = 1;
70 | long temp;
71 | temp = Double.doubleToLongBits(type);
72 | result = prime * result + (int) (temp ^ (temp >>> 32));
73 | temp = Double.doubleToLongBits(maxCount);
74 | result = prime * result + (int) (temp ^ (temp >>> 32));
75 | temp = Double.doubleToLongBits(epsilon);
76 | result = prime * result + (int) (temp ^ (temp >>> 32));
77 | return result;
78 | }
79 |
80 | @Override
81 | public boolean equals(Object obj) {
82 | if (this == obj) return true;
83 | if (!(obj instanceof TermCriteria)) return false;
84 | TermCriteria it = (TermCriteria) obj;
85 | return type == it.type && maxCount == it.maxCount && epsilon == it.epsilon;
86 | }
87 |
88 | @Override
89 | public String toString() {
90 | return "{ type: " + type + ", maxCount: " + maxCount + ", epsilon: " + epsilon + "}";
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/core/TickMeter.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.core;
5 |
6 |
7 |
8 | // C++: class TickMeter
9 | /**
10 | * a Class to measure passing time.
11 | *
12 | * The class computes passing time by counting the number of ticks per second. That is, the following code computes the
13 | * execution time in seconds:
14 | * SNIPPET: snippets/core_various.cpp TickMeter_total
15 | *
16 | * It is also possible to compute the average time over multiple runs:
17 | * SNIPPET: snippets/core_various.cpp TickMeter_average
18 | *
19 | * SEE: getTickCount, getTickFrequency
20 | */
21 | public class TickMeter {
22 |
23 | protected final long nativeObj;
24 | protected TickMeter(long addr) { nativeObj = addr; }
25 |
26 | public long getNativeObjAddr() { return nativeObj; }
27 |
28 | // internal usage only
29 | public static TickMeter __fromPtr__(long addr) { return new TickMeter(addr); }
30 |
31 | //
32 | // C++: cv::TickMeter::TickMeter()
33 | //
34 |
35 | public TickMeter() {
36 | nativeObj = TickMeter_0();
37 | }
38 |
39 |
40 | //
41 | // C++: void cv::TickMeter::start()
42 | //
43 |
44 | public void start() {
45 | start_0(nativeObj);
46 | }
47 |
48 |
49 | //
50 | // C++: void cv::TickMeter::stop()
51 | //
52 |
53 | public void stop() {
54 | stop_0(nativeObj);
55 | }
56 |
57 |
58 | //
59 | // C++: int64 cv::TickMeter::getTimeTicks()
60 | //
61 |
62 | public long getTimeTicks() {
63 | return getTimeTicks_0(nativeObj);
64 | }
65 |
66 |
67 | //
68 | // C++: double cv::TickMeter::getTimeMicro()
69 | //
70 |
71 | public double getTimeMicro() {
72 | return getTimeMicro_0(nativeObj);
73 | }
74 |
75 |
76 | //
77 | // C++: double cv::TickMeter::getTimeMilli()
78 | //
79 |
80 | public double getTimeMilli() {
81 | return getTimeMilli_0(nativeObj);
82 | }
83 |
84 |
85 | //
86 | // C++: double cv::TickMeter::getTimeSec()
87 | //
88 |
89 | public double getTimeSec() {
90 | return getTimeSec_0(nativeObj);
91 | }
92 |
93 |
94 | //
95 | // C++: int64 cv::TickMeter::getCounter()
96 | //
97 |
98 | public long getCounter() {
99 | return getCounter_0(nativeObj);
100 | }
101 |
102 |
103 | //
104 | // C++: double cv::TickMeter::getFPS()
105 | //
106 |
107 | public double getFPS() {
108 | return getFPS_0(nativeObj);
109 | }
110 |
111 |
112 | //
113 | // C++: double cv::TickMeter::getAvgTimeSec()
114 | //
115 |
116 | public double getAvgTimeSec() {
117 | return getAvgTimeSec_0(nativeObj);
118 | }
119 |
120 |
121 | //
122 | // C++: double cv::TickMeter::getAvgTimeMilli()
123 | //
124 |
125 | public double getAvgTimeMilli() {
126 | return getAvgTimeMilli_0(nativeObj);
127 | }
128 |
129 |
130 | //
131 | // C++: void cv::TickMeter::reset()
132 | //
133 |
134 | public void reset() {
135 | reset_0(nativeObj);
136 | }
137 |
138 |
139 | @Override
140 | protected void finalize() throws Throwable {
141 | delete(nativeObj);
142 | }
143 |
144 |
145 |
146 | // C++: cv::TickMeter::TickMeter()
147 | private static native long TickMeter_0();
148 |
149 | // C++: void cv::TickMeter::start()
150 | private static native void start_0(long nativeObj);
151 |
152 | // C++: void cv::TickMeter::stop()
153 | private static native void stop_0(long nativeObj);
154 |
155 | // C++: int64 cv::TickMeter::getTimeTicks()
156 | private static native long getTimeTicks_0(long nativeObj);
157 |
158 | // C++: double cv::TickMeter::getTimeMicro()
159 | private static native double getTimeMicro_0(long nativeObj);
160 |
161 | // C++: double cv::TickMeter::getTimeMilli()
162 | private static native double getTimeMilli_0(long nativeObj);
163 |
164 | // C++: double cv::TickMeter::getTimeSec()
165 | private static native double getTimeSec_0(long nativeObj);
166 |
167 | // C++: int64 cv::TickMeter::getCounter()
168 | private static native long getCounter_0(long nativeObj);
169 |
170 | // C++: double cv::TickMeter::getFPS()
171 | private static native double getFPS_0(long nativeObj);
172 |
173 | // C++: double cv::TickMeter::getAvgTimeSec()
174 | private static native double getAvgTimeSec_0(long nativeObj);
175 |
176 | // C++: double cv::TickMeter::getAvgTimeMilli()
177 | private static native double getAvgTimeMilli_0(long nativeObj);
178 |
179 | // C++: void cv::TickMeter::reset()
180 | private static native void reset_0(long nativeObj);
181 |
182 | // native support for java finalize()
183 | private static native void delete(long nativeObj);
184 |
185 | }
186 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/engine/OpenCVEngineInterface.aidl:
--------------------------------------------------------------------------------
1 | package org.opencv.engine;
2 |
3 | /**
4 | * Class provides a Java interface for OpenCV Engine Service. It's synchronous with native OpenCVEngine class.
5 | */
6 | interface OpenCVEngineInterface
7 | {
8 | /**
9 | * @return Returns service version.
10 | */
11 | int getEngineVersion();
12 |
13 | /**
14 | * Finds an installed OpenCV library.
15 | * @param OpenCV version.
16 | * @return Returns path to OpenCV native libs or an empty string if OpenCV can not be found.
17 | */
18 | String getLibPathByVersion(String version);
19 |
20 | /**
21 | * Tries to install defined version of OpenCV from Google Play Market.
22 | * @param OpenCV version.
23 | * @return Returns true if installation was successful or OpenCV package has been already installed.
24 | */
25 | boolean installVersion(String version);
26 |
27 | /**
28 | * Returns list of libraries in loading order, separated by semicolon.
29 | * @param OpenCV version.
30 | * @return Returns names of OpenCV libraries, separated by semicolon.
31 | */
32 | String getLibraryList(String version);
33 | }
34 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/features2d/BOWImgDescriptorExtractor.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.features2d;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 | import org.opencv.core.Mat;
9 | import org.opencv.core.MatOfKeyPoint;
10 | import org.opencv.utils.Converters;
11 |
12 | // C++: class BOWImgDescriptorExtractor
13 | /**
14 | * Class to compute an image descriptor using the *bag of visual words*.
15 | *
16 | * Such a computation consists of the following steps:
17 | *
18 | * 1. Compute descriptors for a given image and its keypoints set.
19 | * 2. Find the nearest visual words from the vocabulary for each keypoint descriptor.
20 | * 3. Compute the bag-of-words image descriptor as is a normalized histogram of vocabulary words
21 | * encountered in the image. The i-th bin of the histogram is a frequency of i-th word of the
22 | * vocabulary in the given image.
23 | */
24 | public class BOWImgDescriptorExtractor {
25 |
26 | protected final long nativeObj;
27 | protected BOWImgDescriptorExtractor(long addr) { nativeObj = addr; }
28 |
29 | public long getNativeObjAddr() { return nativeObj; }
30 |
31 | // internal usage only
32 | public static BOWImgDescriptorExtractor __fromPtr__(long addr) { return new BOWImgDescriptorExtractor(addr); }
33 |
34 | //
35 | // C++: cv::BOWImgDescriptorExtractor::BOWImgDescriptorExtractor(Ptr_DescriptorExtractor dextractor, Ptr_DescriptorMatcher dmatcher)
36 | //
37 |
38 | // Unknown type 'Ptr_DescriptorExtractor' (I), skipping the function
39 |
40 |
41 | //
42 | // C++: void cv::BOWImgDescriptorExtractor::setVocabulary(Mat vocabulary)
43 | //
44 |
45 | /**
46 | * Sets a visual vocabulary.
47 | *
48 | * @param vocabulary Vocabulary (can be trained using the inheritor of BOWTrainer ). Each row of the
49 | * vocabulary is a visual word (cluster center).
50 | */
51 | public void setVocabulary(Mat vocabulary) {
52 | setVocabulary_0(nativeObj, vocabulary.nativeObj);
53 | }
54 |
55 |
56 | //
57 | // C++: Mat cv::BOWImgDescriptorExtractor::getVocabulary()
58 | //
59 |
60 | /**
61 | * Returns the set vocabulary.
62 | * @return automatically generated
63 | */
64 | public Mat getVocabulary() {
65 | return new Mat(getVocabulary_0(nativeObj));
66 | }
67 |
68 |
69 | //
70 | // C++: void cv::BOWImgDescriptorExtractor::compute2(Mat image, vector_KeyPoint keypoints, Mat& imgDescriptor)
71 | //
72 |
73 | /**
74 | *
75 | * @param imgDescriptor Computed output image descriptor.
76 | * pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster (word of vocabulary)
77 | * returned if it is non-zero.
78 | * @param image automatically generated
79 | * @param keypoints automatically generated
80 | */
81 | public void compute(Mat image, MatOfKeyPoint keypoints, Mat imgDescriptor) {
82 | Mat keypoints_mat = keypoints;
83 | compute_0(nativeObj, image.nativeObj, keypoints_mat.nativeObj, imgDescriptor.nativeObj);
84 | }
85 |
86 |
87 | //
88 | // C++: int cv::BOWImgDescriptorExtractor::descriptorSize()
89 | //
90 |
91 | /**
92 | * Returns an image descriptor size if the vocabulary is set. Otherwise, it returns 0.
93 | * @return automatically generated
94 | */
95 | public int descriptorSize() {
96 | return descriptorSize_0(nativeObj);
97 | }
98 |
99 |
100 | //
101 | // C++: int cv::BOWImgDescriptorExtractor::descriptorType()
102 | //
103 |
104 | /**
105 | * Returns an image descriptor type.
106 | * @return automatically generated
107 | */
108 | public int descriptorType() {
109 | return descriptorType_0(nativeObj);
110 | }
111 |
112 |
113 | @Override
114 | protected void finalize() throws Throwable {
115 | delete(nativeObj);
116 | }
117 |
118 |
119 |
120 | // C++: void cv::BOWImgDescriptorExtractor::setVocabulary(Mat vocabulary)
121 | private static native void setVocabulary_0(long nativeObj, long vocabulary_nativeObj);
122 |
123 | // C++: Mat cv::BOWImgDescriptorExtractor::getVocabulary()
124 | private static native long getVocabulary_0(long nativeObj);
125 |
126 | // C++: void cv::BOWImgDescriptorExtractor::compute2(Mat image, vector_KeyPoint keypoints, Mat& imgDescriptor)
127 | private static native void compute_0(long nativeObj, long image_nativeObj, long keypoints_mat_nativeObj, long imgDescriptor_nativeObj);
128 |
129 | // C++: int cv::BOWImgDescriptorExtractor::descriptorSize()
130 | private static native int descriptorSize_0(long nativeObj);
131 |
132 | // C++: int cv::BOWImgDescriptorExtractor::descriptorType()
133 | private static native int descriptorType_0(long nativeObj);
134 |
135 | // native support for java finalize()
136 | private static native void delete(long nativeObj);
137 |
138 | }
139 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/features2d/BOWKMeansTrainer.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.features2d;
5 |
6 | import org.opencv.core.Mat;
7 | import org.opencv.core.TermCriteria;
8 | import org.opencv.features2d.BOWTrainer;
9 |
10 | // C++: class BOWKMeansTrainer
11 | /**
12 | * kmeans -based class to train visual vocabulary using the *bag of visual words* approach. :
13 | */
14 | public class BOWKMeansTrainer extends BOWTrainer {
15 |
16 | protected BOWKMeansTrainer(long addr) { super(addr); }
17 |
18 | // internal usage only
19 | public static BOWKMeansTrainer __fromPtr__(long addr) { return new BOWKMeansTrainer(addr); }
20 |
21 | //
22 | // C++: cv::BOWKMeansTrainer::BOWKMeansTrainer(int clusterCount, TermCriteria termcrit = TermCriteria(), int attempts = 3, int flags = KMEANS_PP_CENTERS)
23 | //
24 |
25 | /**
26 | * The constructor.
27 | *
28 | * SEE: cv::kmeans
29 | * @param clusterCount automatically generated
30 | * @param termcrit automatically generated
31 | * @param attempts automatically generated
32 | * @param flags automatically generated
33 | */
34 | public BOWKMeansTrainer(int clusterCount, TermCriteria termcrit, int attempts, int flags) {
35 | super(BOWKMeansTrainer_0(clusterCount, termcrit.type, termcrit.maxCount, termcrit.epsilon, attempts, flags));
36 | }
37 |
38 | /**
39 | * The constructor.
40 | *
41 | * SEE: cv::kmeans
42 | * @param clusterCount automatically generated
43 | * @param termcrit automatically generated
44 | * @param attempts automatically generated
45 | */
46 | public BOWKMeansTrainer(int clusterCount, TermCriteria termcrit, int attempts) {
47 | super(BOWKMeansTrainer_1(clusterCount, termcrit.type, termcrit.maxCount, termcrit.epsilon, attempts));
48 | }
49 |
50 | /**
51 | * The constructor.
52 | *
53 | * SEE: cv::kmeans
54 | * @param clusterCount automatically generated
55 | * @param termcrit automatically generated
56 | */
57 | public BOWKMeansTrainer(int clusterCount, TermCriteria termcrit) {
58 | super(BOWKMeansTrainer_2(clusterCount, termcrit.type, termcrit.maxCount, termcrit.epsilon));
59 | }
60 |
61 | /**
62 | * The constructor.
63 | *
64 | * SEE: cv::kmeans
65 | * @param clusterCount automatically generated
66 | */
67 | public BOWKMeansTrainer(int clusterCount) {
68 | super(BOWKMeansTrainer_3(clusterCount));
69 | }
70 |
71 |
72 | //
73 | // C++: Mat cv::BOWKMeansTrainer::cluster()
74 | //
75 |
76 | public Mat cluster() {
77 | return new Mat(cluster_0(nativeObj));
78 | }
79 |
80 |
81 | //
82 | // C++: Mat cv::BOWKMeansTrainer::cluster(Mat descriptors)
83 | //
84 |
85 | public Mat cluster(Mat descriptors) {
86 | return new Mat(cluster_1(nativeObj, descriptors.nativeObj));
87 | }
88 |
89 |
90 | @Override
91 | protected void finalize() throws Throwable {
92 | delete(nativeObj);
93 | }
94 |
95 |
96 |
97 | // C++: cv::BOWKMeansTrainer::BOWKMeansTrainer(int clusterCount, TermCriteria termcrit = TermCriteria(), int attempts = 3, int flags = KMEANS_PP_CENTERS)
98 | private static native long BOWKMeansTrainer_0(int clusterCount, int termcrit_type, int termcrit_maxCount, double termcrit_epsilon, int attempts, int flags);
99 | private static native long BOWKMeansTrainer_1(int clusterCount, int termcrit_type, int termcrit_maxCount, double termcrit_epsilon, int attempts);
100 | private static native long BOWKMeansTrainer_2(int clusterCount, int termcrit_type, int termcrit_maxCount, double termcrit_epsilon);
101 | private static native long BOWKMeansTrainer_3(int clusterCount);
102 |
103 | // C++: Mat cv::BOWKMeansTrainer::cluster()
104 | private static native long cluster_0(long nativeObj);
105 |
106 | // C++: Mat cv::BOWKMeansTrainer::cluster(Mat descriptors)
107 | private static native long cluster_1(long nativeObj, long descriptors_nativeObj);
108 |
109 | // native support for java finalize()
110 | private static native void delete(long nativeObj);
111 |
112 | }
113 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/features2d/BOWTrainer.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.features2d;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 | import org.opencv.core.Mat;
9 | import org.opencv.utils.Converters;
10 |
11 | // C++: class BOWTrainer
12 | /**
13 | * Abstract base class for training the *bag of visual words* vocabulary from a set of descriptors.
14 | *
15 | * For details, see, for example, *Visual Categorization with Bags of Keypoints* by Gabriella Csurka,
16 | * Christopher R. Dance, Lixin Fan, Jutta Willamowski, Cedric Bray, 2004. :
17 | */
18 | public class BOWTrainer {
19 |
20 | protected final long nativeObj;
21 | protected BOWTrainer(long addr) { nativeObj = addr; }
22 |
23 | public long getNativeObjAddr() { return nativeObj; }
24 |
25 | // internal usage only
26 | public static BOWTrainer __fromPtr__(long addr) { return new BOWTrainer(addr); }
27 |
28 | //
29 | // C++: void cv::BOWTrainer::add(Mat descriptors)
30 | //
31 |
32 | /**
33 | * Adds descriptors to a training set.
34 | *
35 | * @param descriptors Descriptors to add to a training set. Each row of the descriptors matrix is a
36 | * descriptor.
37 | *
38 | * The training set is clustered using clustermethod to construct the vocabulary.
39 | */
40 | public void add(Mat descriptors) {
41 | add_0(nativeObj, descriptors.nativeObj);
42 | }
43 |
44 |
45 | //
46 | // C++: vector_Mat cv::BOWTrainer::getDescriptors()
47 | //
48 |
49 | /**
50 | * Returns a training set of descriptors.
51 | * @return automatically generated
52 | */
53 | public List getDescriptors() {
54 | List retVal = new ArrayList();
55 | Mat retValMat = new Mat(getDescriptors_0(nativeObj));
56 | Converters.Mat_to_vector_Mat(retValMat, retVal);
57 | return retVal;
58 | }
59 |
60 |
61 | //
62 | // C++: int cv::BOWTrainer::descriptorsCount()
63 | //
64 |
65 | /**
66 | * Returns the count of all descriptors stored in the training set.
67 | * @return automatically generated
68 | */
69 | public int descriptorsCount() {
70 | return descriptorsCount_0(nativeObj);
71 | }
72 |
73 |
74 | //
75 | // C++: void cv::BOWTrainer::clear()
76 | //
77 |
78 | public void clear() {
79 | clear_0(nativeObj);
80 | }
81 |
82 |
83 | //
84 | // C++: Mat cv::BOWTrainer::cluster()
85 | //
86 |
87 | public Mat cluster() {
88 | return new Mat(cluster_0(nativeObj));
89 | }
90 |
91 |
92 | //
93 | // C++: Mat cv::BOWTrainer::cluster(Mat descriptors)
94 | //
95 |
96 | /**
97 | * Clusters train descriptors.
98 | *
99 | * @param descriptors Descriptors to cluster. Each row of the descriptors matrix is a descriptor.
100 | * Descriptors are not added to the inner train descriptor set.
101 | *
102 | * The vocabulary consists of cluster centers. So, this method returns the vocabulary. In the first
103 | * variant of the method, train descriptors stored in the object are clustered. In the second variant,
104 | * input descriptors are clustered.
105 | * @return automatically generated
106 | */
107 | public Mat cluster(Mat descriptors) {
108 | return new Mat(cluster_1(nativeObj, descriptors.nativeObj));
109 | }
110 |
111 |
112 | @Override
113 | protected void finalize() throws Throwable {
114 | delete(nativeObj);
115 | }
116 |
117 |
118 |
119 | // C++: void cv::BOWTrainer::add(Mat descriptors)
120 | private static native void add_0(long nativeObj, long descriptors_nativeObj);
121 |
122 | // C++: vector_Mat cv::BOWTrainer::getDescriptors()
123 | private static native long getDescriptors_0(long nativeObj);
124 |
125 | // C++: int cv::BOWTrainer::descriptorsCount()
126 | private static native int descriptorsCount_0(long nativeObj);
127 |
128 | // C++: void cv::BOWTrainer::clear()
129 | private static native void clear_0(long nativeObj);
130 |
131 | // C++: Mat cv::BOWTrainer::cluster()
132 | private static native long cluster_0(long nativeObj);
133 |
134 | // C++: Mat cv::BOWTrainer::cluster(Mat descriptors)
135 | private static native long cluster_1(long nativeObj, long descriptors_nativeObj);
136 |
137 | // native support for java finalize()
138 | private static native void delete(long nativeObj);
139 |
140 | }
141 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/features2d/FlannBasedMatcher.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.features2d;
5 |
6 | import org.opencv.features2d.DescriptorMatcher;
7 | import org.opencv.features2d.FlannBasedMatcher;
8 |
9 | // C++: class FlannBasedMatcher
10 | /**
11 | * Flann-based descriptor matcher.
12 | *
13 | * This matcher trains cv::flann::Index on a train descriptor collection and calls its nearest search
14 | * methods to find the best matches. So, this matcher may be faster when matching a large train
15 | * collection than the brute force matcher. FlannBasedMatcher does not support masking permissible
16 | * matches of descriptor sets because flann::Index does not support this. :
17 | */
18 | public class FlannBasedMatcher extends DescriptorMatcher {
19 |
20 | protected FlannBasedMatcher(long addr) { super(addr); }
21 |
22 | // internal usage only
23 | public static FlannBasedMatcher __fromPtr__(long addr) { return new FlannBasedMatcher(addr); }
24 |
25 | //
26 | // C++: cv::FlannBasedMatcher::FlannBasedMatcher(Ptr_flann_IndexParams indexParams = makePtr(), Ptr_flann_SearchParams searchParams = makePtr())
27 | //
28 |
29 | public FlannBasedMatcher() {
30 | super(FlannBasedMatcher_0());
31 | }
32 |
33 |
34 | //
35 | // C++: static Ptr_FlannBasedMatcher cv::FlannBasedMatcher::create()
36 | //
37 |
38 | public static FlannBasedMatcher create() {
39 | return FlannBasedMatcher.__fromPtr__(create_0());
40 | }
41 |
42 |
43 | @Override
44 | protected void finalize() throws Throwable {
45 | delete(nativeObj);
46 | }
47 |
48 |
49 |
50 | // C++: cv::FlannBasedMatcher::FlannBasedMatcher(Ptr_flann_IndexParams indexParams = makePtr(), Ptr_flann_SearchParams searchParams = makePtr())
51 | private static native long FlannBasedMatcher_0();
52 |
53 | // C++: static Ptr_FlannBasedMatcher cv::FlannBasedMatcher::create()
54 | private static native long create_0();
55 |
56 | // native support for java finalize()
57 | private static native void delete(long nativeObj);
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/features2d/SimpleBlobDetector.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.features2d;
5 |
6 | import org.opencv.features2d.Feature2D;
7 | import org.opencv.features2d.SimpleBlobDetector;
8 | import org.opencv.features2d.SimpleBlobDetector_Params;
9 |
10 | // C++: class SimpleBlobDetector
11 | /**
12 | * Class for extracting blobs from an image. :
13 | *
14 | * The class implements a simple algorithm for extracting blobs from an image:
15 | *
16 | * 1. Convert the source image to binary images by applying thresholding with several thresholds from
17 | * minThreshold (inclusive) to maxThreshold (exclusive) with distance thresholdStep between
18 | * neighboring thresholds.
19 | * 2. Extract connected components from every binary image by findContours and calculate their
20 | * centers.
21 | * 3. Group centers from several binary images by their coordinates. Close centers form one group that
22 | * corresponds to one blob, which is controlled by the minDistBetweenBlobs parameter.
23 | * 4. From the groups, estimate final centers of blobs and their radiuses and return as locations and
24 | * sizes of keypoints.
25 | *
26 | * This class performs several filtrations of returned blobs. You should set filterBy\* to true/false
27 | * to turn on/off corresponding filtration. Available filtrations:
28 | *
29 | *
30 | *
31 | * By color. This filter compares the intensity of a binary image at the center of a blob to
32 | * blobColor. If they differ, the blob is filtered out. Use blobColor = 0 to extract dark blobs
33 | * and blobColor = 255 to extract light blobs.
34 | *
35 | *
36 | * By area. Extracted blobs have an area between minArea (inclusive) and maxArea (exclusive).
37 | *
38 | *
39 | * By circularity. Extracted blobs have circularity
40 | * (\(\frac{4*\pi*Area}{perimeter * perimeter}\)) between minCircularity (inclusive) and
41 | * maxCircularity (exclusive).
42 | *
43 | *
44 | * By ratio of the minimum inertia to maximum inertia. Extracted blobs have this ratio
45 | * between minInertiaRatio (inclusive) and maxInertiaRatio (exclusive).
46 | *
47 | *
48 | * By convexity. Extracted blobs have convexity (area / area of blob convex hull) between
49 | * minConvexity (inclusive) and maxConvexity (exclusive).
50 | *
51 | *
52 | *
53 | * Default values of parameters are tuned to extract dark circular blobs.
54 | */
55 | public class SimpleBlobDetector extends Feature2D {
56 |
57 | protected SimpleBlobDetector(long addr) { super(addr); }
58 |
59 | // internal usage only
60 | public static SimpleBlobDetector __fromPtr__(long addr) { return new SimpleBlobDetector(addr); }
61 |
62 | //
63 | // C++: static Ptr_SimpleBlobDetector cv::SimpleBlobDetector::create(SimpleBlobDetector_Params parameters = SimpleBlobDetector::Params())
64 | //
65 |
66 | public static SimpleBlobDetector create(SimpleBlobDetector_Params parameters) {
67 | return SimpleBlobDetector.__fromPtr__(create_0(parameters.nativeObj));
68 | }
69 |
70 | public static SimpleBlobDetector create() {
71 | return SimpleBlobDetector.__fromPtr__(create_1());
72 | }
73 |
74 |
75 | //
76 | // C++: String cv::SimpleBlobDetector::getDefaultName()
77 | //
78 |
79 | public String getDefaultName() {
80 | return getDefaultName_0(nativeObj);
81 | }
82 |
83 |
84 | @Override
85 | protected void finalize() throws Throwable {
86 | delete(nativeObj);
87 | }
88 |
89 |
90 |
91 | // C++: static Ptr_SimpleBlobDetector cv::SimpleBlobDetector::create(SimpleBlobDetector_Params parameters = SimpleBlobDetector::Params())
92 | private static native long create_0(long parameters_nativeObj);
93 | private static native long create_1();
94 |
95 | // C++: String cv::SimpleBlobDetector::getDefaultName()
96 | private static native String getDefaultName_0(long nativeObj);
97 |
98 | // native support for java finalize()
99 | private static native void delete(long nativeObj);
100 |
101 | }
102 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/imgproc/CLAHE.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.imgproc;
5 |
6 | import org.opencv.core.Algorithm;
7 | import org.opencv.core.Mat;
8 | import org.opencv.core.Size;
9 |
10 | // C++: class CLAHE
11 | /**
12 | * Base class for Contrast Limited Adaptive Histogram Equalization.
13 | */
14 | public class CLAHE extends Algorithm {
15 |
16 | protected CLAHE(long addr) { super(addr); }
17 |
18 | // internal usage only
19 | public static CLAHE __fromPtr__(long addr) { return new CLAHE(addr); }
20 |
21 | //
22 | // C++: void cv::CLAHE::apply(Mat src, Mat& dst)
23 | //
24 |
25 | /**
26 | * Equalizes the histogram of a grayscale image using Contrast Limited Adaptive Histogram Equalization.
27 | *
28 | * @param src Source image of type CV_8UC1 or CV_16UC1.
29 | * @param dst Destination image.
30 | */
31 | public void apply(Mat src, Mat dst) {
32 | apply_0(nativeObj, src.nativeObj, dst.nativeObj);
33 | }
34 |
35 |
36 | //
37 | // C++: void cv::CLAHE::setClipLimit(double clipLimit)
38 | //
39 |
40 | /**
41 | * Sets threshold for contrast limiting.
42 | *
43 | * @param clipLimit threshold value.
44 | */
45 | public void setClipLimit(double clipLimit) {
46 | setClipLimit_0(nativeObj, clipLimit);
47 | }
48 |
49 |
50 | //
51 | // C++: double cv::CLAHE::getClipLimit()
52 | //
53 |
54 | public double getClipLimit() {
55 | return getClipLimit_0(nativeObj);
56 | }
57 |
58 |
59 | //
60 | // C++: void cv::CLAHE::setTilesGridSize(Size tileGridSize)
61 | //
62 |
63 | /**
64 | * Sets size of grid for histogram equalization. Input image will be divided into
65 | * equally sized rectangular tiles.
66 | *
67 | * @param tileGridSize defines the number of tiles in row and column.
68 | */
69 | public void setTilesGridSize(Size tileGridSize) {
70 | setTilesGridSize_0(nativeObj, tileGridSize.width, tileGridSize.height);
71 | }
72 |
73 |
74 | //
75 | // C++: Size cv::CLAHE::getTilesGridSize()
76 | //
77 |
78 | public Size getTilesGridSize() {
79 | return new Size(getTilesGridSize_0(nativeObj));
80 | }
81 |
82 |
83 | //
84 | // C++: void cv::CLAHE::collectGarbage()
85 | //
86 |
87 | public void collectGarbage() {
88 | collectGarbage_0(nativeObj);
89 | }
90 |
91 |
92 | @Override
93 | protected void finalize() throws Throwable {
94 | delete(nativeObj);
95 | }
96 |
97 |
98 |
99 | // C++: void cv::CLAHE::apply(Mat src, Mat& dst)
100 | private static native void apply_0(long nativeObj, long src_nativeObj, long dst_nativeObj);
101 |
102 | // C++: void cv::CLAHE::setClipLimit(double clipLimit)
103 | private static native void setClipLimit_0(long nativeObj, double clipLimit);
104 |
105 | // C++: double cv::CLAHE::getClipLimit()
106 | private static native double getClipLimit_0(long nativeObj);
107 |
108 | // C++: void cv::CLAHE::setTilesGridSize(Size tileGridSize)
109 | private static native void setTilesGridSize_0(long nativeObj, double tileGridSize_width, double tileGridSize_height);
110 |
111 | // C++: Size cv::CLAHE::getTilesGridSize()
112 | private static native double[] getTilesGridSize_0(long nativeObj);
113 |
114 | // C++: void cv::CLAHE::collectGarbage()
115 | private static native void collectGarbage_0(long nativeObj);
116 |
117 | // native support for java finalize()
118 | private static native void delete(long nativeObj);
119 |
120 | }
121 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/imgproc/GeneralizedHoughBallard.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.imgproc;
5 |
6 | import org.opencv.imgproc.GeneralizedHough;
7 |
8 | // C++: class GeneralizedHoughBallard
9 | /**
10 | * finds arbitrary template in the grayscale image using Generalized Hough Transform
11 | *
12 | * Detects position only without translation and rotation CITE: Ballard1981 .
13 | */
14 | public class GeneralizedHoughBallard extends GeneralizedHough {
15 |
16 | protected GeneralizedHoughBallard(long addr) { super(addr); }
17 |
18 | // internal usage only
19 | public static GeneralizedHoughBallard __fromPtr__(long addr) { return new GeneralizedHoughBallard(addr); }
20 |
21 | //
22 | // C++: void cv::GeneralizedHoughBallard::setLevels(int levels)
23 | //
24 |
25 | public void setLevels(int levels) {
26 | setLevels_0(nativeObj, levels);
27 | }
28 |
29 |
30 | //
31 | // C++: int cv::GeneralizedHoughBallard::getLevels()
32 | //
33 |
34 | public int getLevels() {
35 | return getLevels_0(nativeObj);
36 | }
37 |
38 |
39 | //
40 | // C++: void cv::GeneralizedHoughBallard::setVotesThreshold(int votesThreshold)
41 | //
42 |
43 | public void setVotesThreshold(int votesThreshold) {
44 | setVotesThreshold_0(nativeObj, votesThreshold);
45 | }
46 |
47 |
48 | //
49 | // C++: int cv::GeneralizedHoughBallard::getVotesThreshold()
50 | //
51 |
52 | public int getVotesThreshold() {
53 | return getVotesThreshold_0(nativeObj);
54 | }
55 |
56 |
57 | @Override
58 | protected void finalize() throws Throwable {
59 | delete(nativeObj);
60 | }
61 |
62 |
63 |
64 | // C++: void cv::GeneralizedHoughBallard::setLevels(int levels)
65 | private static native void setLevels_0(long nativeObj, int levels);
66 |
67 | // C++: int cv::GeneralizedHoughBallard::getLevels()
68 | private static native int getLevels_0(long nativeObj);
69 |
70 | // C++: void cv::GeneralizedHoughBallard::setVotesThreshold(int votesThreshold)
71 | private static native void setVotesThreshold_0(long nativeObj, int votesThreshold);
72 |
73 | // C++: int cv::GeneralizedHoughBallard::getVotesThreshold()
74 | private static native int getVotesThreshold_0(long nativeObj);
75 |
76 | // native support for java finalize()
77 | private static native void delete(long nativeObj);
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/video/BackgroundSubtractor.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.video;
5 |
6 | import org.opencv.core.Algorithm;
7 | import org.opencv.core.Mat;
8 |
9 | // C++: class BackgroundSubtractor
10 | /**
11 | * Base class for background/foreground segmentation. :
12 | *
13 | * The class is only used to define the common interface for the whole family of background/foreground
14 | * segmentation algorithms.
15 | */
16 | public class BackgroundSubtractor extends Algorithm {
17 |
18 | protected BackgroundSubtractor(long addr) { super(addr); }
19 |
20 | // internal usage only
21 | public static BackgroundSubtractor __fromPtr__(long addr) { return new BackgroundSubtractor(addr); }
22 |
23 | //
24 | // C++: void cv::BackgroundSubtractor::apply(Mat image, Mat& fgmask, double learningRate = -1)
25 | //
26 |
27 | /**
28 | * Computes a foreground mask.
29 | *
30 | * @param image Next video frame.
31 | * @param fgmask The output foreground mask as an 8-bit binary image.
32 | * @param learningRate The value between 0 and 1 that indicates how fast the background model is
33 | * learnt. Negative parameter value makes the algorithm to use some automatically chosen learning
34 | * rate. 0 means that the background model is not updated at all, 1 means that the background model
35 | * is completely reinitialized from the last frame.
36 | */
37 | public void apply(Mat image, Mat fgmask, double learningRate) {
38 | apply_0(nativeObj, image.nativeObj, fgmask.nativeObj, learningRate);
39 | }
40 |
41 | /**
42 | * Computes a foreground mask.
43 | *
44 | * @param image Next video frame.
45 | * @param fgmask The output foreground mask as an 8-bit binary image.
46 | * learnt. Negative parameter value makes the algorithm to use some automatically chosen learning
47 | * rate. 0 means that the background model is not updated at all, 1 means that the background model
48 | * is completely reinitialized from the last frame.
49 | */
50 | public void apply(Mat image, Mat fgmask) {
51 | apply_1(nativeObj, image.nativeObj, fgmask.nativeObj);
52 | }
53 |
54 |
55 | //
56 | // C++: void cv::BackgroundSubtractor::getBackgroundImage(Mat& backgroundImage)
57 | //
58 |
59 | /**
60 | * Computes a background image.
61 | *
62 | * @param backgroundImage The output background image.
63 | *
64 | * Note: Sometimes the background image can be very blurry, as it contain the average background
65 | * statistics.
66 | */
67 | public void getBackgroundImage(Mat backgroundImage) {
68 | getBackgroundImage_0(nativeObj, backgroundImage.nativeObj);
69 | }
70 |
71 |
72 | @Override
73 | protected void finalize() throws Throwable {
74 | delete(nativeObj);
75 | }
76 |
77 |
78 |
79 | // C++: void cv::BackgroundSubtractor::apply(Mat image, Mat& fgmask, double learningRate = -1)
80 | private static native void apply_0(long nativeObj, long image_nativeObj, long fgmask_nativeObj, double learningRate);
81 | private static native void apply_1(long nativeObj, long image_nativeObj, long fgmask_nativeObj);
82 |
83 | // C++: void cv::BackgroundSubtractor::getBackgroundImage(Mat& backgroundImage)
84 | private static native void getBackgroundImage_0(long nativeObj, long backgroundImage_nativeObj);
85 |
86 | // native support for java finalize()
87 | private static native void delete(long nativeObj);
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/video/DenseOpticalFlow.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.video;
5 |
6 | import org.opencv.core.Algorithm;
7 | import org.opencv.core.Mat;
8 |
9 | // C++: class DenseOpticalFlow
10 | /**
11 | * Base class for dense optical flow algorithms
12 | */
13 | public class DenseOpticalFlow extends Algorithm {
14 |
15 | protected DenseOpticalFlow(long addr) { super(addr); }
16 |
17 | // internal usage only
18 | public static DenseOpticalFlow __fromPtr__(long addr) { return new DenseOpticalFlow(addr); }
19 |
20 | //
21 | // C++: void cv::DenseOpticalFlow::calc(Mat I0, Mat I1, Mat& flow)
22 | //
23 |
24 | /**
25 | * Calculates an optical flow.
26 | *
27 | * @param I0 first 8-bit single-channel input image.
28 | * @param I1 second input image of the same size and the same type as prev.
29 | * @param flow computed flow image that has the same size as prev and type CV_32FC2.
30 | */
31 | public void calc(Mat I0, Mat I1, Mat flow) {
32 | calc_0(nativeObj, I0.nativeObj, I1.nativeObj, flow.nativeObj);
33 | }
34 |
35 |
36 | //
37 | // C++: void cv::DenseOpticalFlow::collectGarbage()
38 | //
39 |
40 | /**
41 | * Releases all inner buffers.
42 | */
43 | public void collectGarbage() {
44 | collectGarbage_0(nativeObj);
45 | }
46 |
47 |
48 | @Override
49 | protected void finalize() throws Throwable {
50 | delete(nativeObj);
51 | }
52 |
53 |
54 |
55 | // C++: void cv::DenseOpticalFlow::calc(Mat I0, Mat I1, Mat& flow)
56 | private static native void calc_0(long nativeObj, long I0_nativeObj, long I1_nativeObj, long flow_nativeObj);
57 |
58 | // C++: void cv::DenseOpticalFlow::collectGarbage()
59 | private static native void collectGarbage_0(long nativeObj);
60 |
61 | // native support for java finalize()
62 | private static native void delete(long nativeObj);
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/video/SparseOpticalFlow.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.video;
5 |
6 | import org.opencv.core.Algorithm;
7 | import org.opencv.core.Mat;
8 |
9 | // C++: class SparseOpticalFlow
10 | /**
11 | * Base interface for sparse optical flow algorithms.
12 | */
13 | public class SparseOpticalFlow extends Algorithm {
14 |
15 | protected SparseOpticalFlow(long addr) { super(addr); }
16 |
17 | // internal usage only
18 | public static SparseOpticalFlow __fromPtr__(long addr) { return new SparseOpticalFlow(addr); }
19 |
20 | //
21 | // C++: void cv::SparseOpticalFlow::calc(Mat prevImg, Mat nextImg, Mat prevPts, Mat& nextPts, Mat& status, Mat& err = cv::Mat())
22 | //
23 |
24 | /**
25 | * Calculates a sparse optical flow.
26 | *
27 | * @param prevImg First input image.
28 | * @param nextImg Second input image of the same size and the same type as prevImg.
29 | * @param prevPts Vector of 2D points for which the flow needs to be found.
30 | * @param nextPts Output vector of 2D points containing the calculated new positions of input features in the second image.
31 | * @param status Output status vector. Each element of the vector is set to 1 if the
32 | * flow for the corresponding features has been found. Otherwise, it is set to 0.
33 | * @param err Optional output vector that contains error response for each point (inverse confidence).
34 | */
35 | public void calc(Mat prevImg, Mat nextImg, Mat prevPts, Mat nextPts, Mat status, Mat err) {
36 | calc_0(nativeObj, prevImg.nativeObj, nextImg.nativeObj, prevPts.nativeObj, nextPts.nativeObj, status.nativeObj, err.nativeObj);
37 | }
38 |
39 | /**
40 | * Calculates a sparse optical flow.
41 | *
42 | * @param prevImg First input image.
43 | * @param nextImg Second input image of the same size and the same type as prevImg.
44 | * @param prevPts Vector of 2D points for which the flow needs to be found.
45 | * @param nextPts Output vector of 2D points containing the calculated new positions of input features in the second image.
46 | * @param status Output status vector. Each element of the vector is set to 1 if the
47 | * flow for the corresponding features has been found. Otherwise, it is set to 0.
48 | */
49 | public void calc(Mat prevImg, Mat nextImg, Mat prevPts, Mat nextPts, Mat status) {
50 | calc_1(nativeObj, prevImg.nativeObj, nextImg.nativeObj, prevPts.nativeObj, nextPts.nativeObj, status.nativeObj);
51 | }
52 |
53 |
54 | @Override
55 | protected void finalize() throws Throwable {
56 | delete(nativeObj);
57 | }
58 |
59 |
60 |
61 | // C++: void cv::SparseOpticalFlow::calc(Mat prevImg, Mat nextImg, Mat prevPts, Mat& nextPts, Mat& status, Mat& err = cv::Mat())
62 | private static native void calc_0(long nativeObj, long prevImg_nativeObj, long nextImg_nativeObj, long prevPts_nativeObj, long nextPts_nativeObj, long status_nativeObj, long err_nativeObj);
63 | private static native void calc_1(long nativeObj, long prevImg_nativeObj, long nextImg_nativeObj, long prevPts_nativeObj, long nextPts_nativeObj, long status_nativeObj);
64 |
65 | // native support for java finalize()
66 | private static native void delete(long nativeObj);
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/video/Tracker.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.video;
5 |
6 | import org.opencv.core.Mat;
7 | import org.opencv.core.Rect;
8 |
9 | // C++: class Tracker
10 | /**
11 | * Base abstract class for the long-term tracker
12 | */
13 | public class Tracker {
14 |
15 | protected final long nativeObj;
16 | protected Tracker(long addr) { nativeObj = addr; }
17 |
18 | public long getNativeObjAddr() { return nativeObj; }
19 |
20 | // internal usage only
21 | public static Tracker __fromPtr__(long addr) { return new Tracker(addr); }
22 |
23 | //
24 | // C++: void cv::Tracker::init(Mat image, Rect boundingBox)
25 | //
26 |
27 | /**
28 | * Initialize the tracker with a known bounding box that surrounded the target
29 | * @param image The initial frame
30 | * @param boundingBox The initial bounding box
31 | */
32 | public void init(Mat image, Rect boundingBox) {
33 | init_0(nativeObj, image.nativeObj, boundingBox.x, boundingBox.y, boundingBox.width, boundingBox.height);
34 | }
35 |
36 |
37 | //
38 | // C++: bool cv::Tracker::update(Mat image, Rect& boundingBox)
39 | //
40 |
41 | /**
42 | * Update the tracker, find the new most likely bounding box for the target
43 | * @param image The current frame
44 | * @param boundingBox The bounding box that represent the new target location, if true was returned, not
45 | * modified otherwise
46 | *
47 | * @return True means that target was located and false means that tracker cannot locate target in
48 | * current frame. Note, that latter *does not* imply that tracker has failed, maybe target is indeed
49 | * missing from the frame (say, out of sight)
50 | */
51 | public boolean update(Mat image, Rect boundingBox) {
52 | double[] boundingBox_out = new double[4];
53 | boolean retVal = update_0(nativeObj, image.nativeObj, boundingBox_out);
54 | if(boundingBox!=null){ boundingBox.x = (int)boundingBox_out[0]; boundingBox.y = (int)boundingBox_out[1]; boundingBox.width = (int)boundingBox_out[2]; boundingBox.height = (int)boundingBox_out[3]; }
55 | return retVal;
56 | }
57 |
58 |
59 | @Override
60 | protected void finalize() throws Throwable {
61 | delete(nativeObj);
62 | }
63 |
64 |
65 |
66 | // C++: void cv::Tracker::init(Mat image, Rect boundingBox)
67 | private static native void init_0(long nativeObj, long image_nativeObj, int boundingBox_x, int boundingBox_y, int boundingBox_width, int boundingBox_height);
68 |
69 | // C++: bool cv::Tracker::update(Mat image, Rect& boundingBox)
70 | private static native boolean update_0(long nativeObj, long image_nativeObj, double[] boundingBox_out);
71 |
72 | // native support for java finalize()
73 | private static native void delete(long nativeObj);
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/video/TrackerDaSiamRPN.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.video;
5 |
6 | import org.opencv.video.Tracker;
7 | import org.opencv.video.TrackerDaSiamRPN;
8 | import org.opencv.video.TrackerDaSiamRPN_Params;
9 |
10 | // C++: class TrackerDaSiamRPN
11 |
12 | public class TrackerDaSiamRPN extends Tracker {
13 |
14 | protected TrackerDaSiamRPN(long addr) { super(addr); }
15 |
16 | // internal usage only
17 | public static TrackerDaSiamRPN __fromPtr__(long addr) { return new TrackerDaSiamRPN(addr); }
18 |
19 | //
20 | // C++: static Ptr_TrackerDaSiamRPN cv::TrackerDaSiamRPN::create(TrackerDaSiamRPN_Params parameters = TrackerDaSiamRPN::Params())
21 | //
22 |
23 | /**
24 | * Constructor
25 | * @param parameters DaSiamRPN parameters TrackerDaSiamRPN::Params
26 | * @return automatically generated
27 | */
28 | public static TrackerDaSiamRPN create(TrackerDaSiamRPN_Params parameters) {
29 | return TrackerDaSiamRPN.__fromPtr__(create_0(parameters.nativeObj));
30 | }
31 |
32 | /**
33 | * Constructor
34 | * @return automatically generated
35 | */
36 | public static TrackerDaSiamRPN create() {
37 | return TrackerDaSiamRPN.__fromPtr__(create_1());
38 | }
39 |
40 |
41 | //
42 | // C++: float cv::TrackerDaSiamRPN::getTrackingScore()
43 | //
44 |
45 | /**
46 | * Return tracking score
47 | * @return automatically generated
48 | */
49 | public float getTrackingScore() {
50 | return getTrackingScore_0(nativeObj);
51 | }
52 |
53 |
54 | @Override
55 | protected void finalize() throws Throwable {
56 | delete(nativeObj);
57 | }
58 |
59 |
60 |
61 | // C++: static Ptr_TrackerDaSiamRPN cv::TrackerDaSiamRPN::create(TrackerDaSiamRPN_Params parameters = TrackerDaSiamRPN::Params())
62 | private static native long create_0(long parameters_nativeObj);
63 | private static native long create_1();
64 |
65 | // C++: float cv::TrackerDaSiamRPN::getTrackingScore()
66 | private static native float getTrackingScore_0(long nativeObj);
67 |
68 | // native support for java finalize()
69 | private static native void delete(long nativeObj);
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/video/TrackerDaSiamRPN_Params.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.video;
5 |
6 |
7 |
8 | // C++: class Params
9 |
10 | public class TrackerDaSiamRPN_Params {
11 |
12 | protected final long nativeObj;
13 | protected TrackerDaSiamRPN_Params(long addr) { nativeObj = addr; }
14 |
15 | public long getNativeObjAddr() { return nativeObj; }
16 |
17 | // internal usage only
18 | public static TrackerDaSiamRPN_Params __fromPtr__(long addr) { return new TrackerDaSiamRPN_Params(addr); }
19 |
20 | //
21 | // C++: cv::TrackerDaSiamRPN::Params::Params()
22 | //
23 |
24 | public TrackerDaSiamRPN_Params() {
25 | nativeObj = TrackerDaSiamRPN_Params_0();
26 | }
27 |
28 |
29 | //
30 | // C++: string TrackerDaSiamRPN_Params::model
31 | //
32 |
33 | public String get_model() {
34 | return get_model_0(nativeObj);
35 | }
36 |
37 |
38 | //
39 | // C++: void TrackerDaSiamRPN_Params::model
40 | //
41 |
42 | public void set_model(String model) {
43 | set_model_0(nativeObj, model);
44 | }
45 |
46 |
47 | //
48 | // C++: string TrackerDaSiamRPN_Params::kernel_cls1
49 | //
50 |
51 | public String get_kernel_cls1() {
52 | return get_kernel_cls1_0(nativeObj);
53 | }
54 |
55 |
56 | //
57 | // C++: void TrackerDaSiamRPN_Params::kernel_cls1
58 | //
59 |
60 | public void set_kernel_cls1(String kernel_cls1) {
61 | set_kernel_cls1_0(nativeObj, kernel_cls1);
62 | }
63 |
64 |
65 | //
66 | // C++: string TrackerDaSiamRPN_Params::kernel_r1
67 | //
68 |
69 | public String get_kernel_r1() {
70 | return get_kernel_r1_0(nativeObj);
71 | }
72 |
73 |
74 | //
75 | // C++: void TrackerDaSiamRPN_Params::kernel_r1
76 | //
77 |
78 | public void set_kernel_r1(String kernel_r1) {
79 | set_kernel_r1_0(nativeObj, kernel_r1);
80 | }
81 |
82 |
83 | //
84 | // C++: int TrackerDaSiamRPN_Params::backend
85 | //
86 |
87 | public int get_backend() {
88 | return get_backend_0(nativeObj);
89 | }
90 |
91 |
92 | //
93 | // C++: void TrackerDaSiamRPN_Params::backend
94 | //
95 |
96 | public void set_backend(int backend) {
97 | set_backend_0(nativeObj, backend);
98 | }
99 |
100 |
101 | //
102 | // C++: int TrackerDaSiamRPN_Params::target
103 | //
104 |
105 | public int get_target() {
106 | return get_target_0(nativeObj);
107 | }
108 |
109 |
110 | //
111 | // C++: void TrackerDaSiamRPN_Params::target
112 | //
113 |
114 | public void set_target(int target) {
115 | set_target_0(nativeObj, target);
116 | }
117 |
118 |
119 | @Override
120 | protected void finalize() throws Throwable {
121 | delete(nativeObj);
122 | }
123 |
124 |
125 |
126 | // C++: cv::TrackerDaSiamRPN::Params::Params()
127 | private static native long TrackerDaSiamRPN_Params_0();
128 |
129 | // C++: string TrackerDaSiamRPN_Params::model
130 | private static native String get_model_0(long nativeObj);
131 |
132 | // C++: void TrackerDaSiamRPN_Params::model
133 | private static native void set_model_0(long nativeObj, String model);
134 |
135 | // C++: string TrackerDaSiamRPN_Params::kernel_cls1
136 | private static native String get_kernel_cls1_0(long nativeObj);
137 |
138 | // C++: void TrackerDaSiamRPN_Params::kernel_cls1
139 | private static native void set_kernel_cls1_0(long nativeObj, String kernel_cls1);
140 |
141 | // C++: string TrackerDaSiamRPN_Params::kernel_r1
142 | private static native String get_kernel_r1_0(long nativeObj);
143 |
144 | // C++: void TrackerDaSiamRPN_Params::kernel_r1
145 | private static native void set_kernel_r1_0(long nativeObj, String kernel_r1);
146 |
147 | // C++: int TrackerDaSiamRPN_Params::backend
148 | private static native int get_backend_0(long nativeObj);
149 |
150 | // C++: void TrackerDaSiamRPN_Params::backend
151 | private static native void set_backend_0(long nativeObj, int backend);
152 |
153 | // C++: int TrackerDaSiamRPN_Params::target
154 | private static native int get_target_0(long nativeObj);
155 |
156 | // C++: void TrackerDaSiamRPN_Params::target
157 | private static native void set_target_0(long nativeObj, int target);
158 |
159 | // native support for java finalize()
160 | private static native void delete(long nativeObj);
161 |
162 | }
163 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/video/TrackerGOTURN.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.video;
5 |
6 | import org.opencv.video.Tracker;
7 | import org.opencv.video.TrackerGOTURN;
8 | import org.opencv.video.TrackerGOTURN_Params;
9 |
10 | // C++: class TrackerGOTURN
11 | /**
12 | * the GOTURN (Generic Object Tracking Using Regression Networks) tracker
13 | *
14 | * GOTURN (CITE: GOTURN) is kind of trackers based on Convolutional Neural Networks (CNN). While taking all advantages of CNN trackers,
15 | * GOTURN is much faster due to offline training without online fine-tuning nature.
16 | * GOTURN tracker addresses the problem of single target tracking: given a bounding box label of an object in the first frame of the video,
17 | * we track that object through the rest of the video. NOTE: Current method of GOTURN does not handle occlusions; however, it is fairly
18 | * robust to viewpoint changes, lighting changes, and deformations.
19 | * Inputs of GOTURN are two RGB patches representing Target and Search patches resized to 227x227.
20 | * Outputs of GOTURN are predicted bounding box coordinates, relative to Search patch coordinate system, in format X1,Y1,X2,Y2.
21 | * Original paper is here: <http://davheld.github.io/GOTURN/GOTURN.pdf>
22 | * As long as original authors implementation: <https://github.com/davheld/GOTURN#train-the-tracker>
23 | * Implementation of training algorithm is placed in separately here due to 3d-party dependencies:
24 | * <https://github.com/Auron-X/GOTURN_Training_Toolkit>
25 | * GOTURN architecture goturn.prototxt and trained model goturn.caffemodel are accessible on opencv_extra GitHub repository.
26 | */
27 | public class TrackerGOTURN extends Tracker {
28 |
29 | protected TrackerGOTURN(long addr) { super(addr); }
30 |
31 | // internal usage only
32 | public static TrackerGOTURN __fromPtr__(long addr) { return new TrackerGOTURN(addr); }
33 |
34 | //
35 | // C++: static Ptr_TrackerGOTURN cv::TrackerGOTURN::create(TrackerGOTURN_Params parameters = TrackerGOTURN::Params())
36 | //
37 |
38 | /**
39 | * Constructor
40 | * @param parameters GOTURN parameters TrackerGOTURN::Params
41 | * @return automatically generated
42 | */
43 | public static TrackerGOTURN create(TrackerGOTURN_Params parameters) {
44 | return TrackerGOTURN.__fromPtr__(create_0(parameters.nativeObj));
45 | }
46 |
47 | /**
48 | * Constructor
49 | * @return automatically generated
50 | */
51 | public static TrackerGOTURN create() {
52 | return TrackerGOTURN.__fromPtr__(create_1());
53 | }
54 |
55 |
56 | @Override
57 | protected void finalize() throws Throwable {
58 | delete(nativeObj);
59 | }
60 |
61 |
62 |
63 | // C++: static Ptr_TrackerGOTURN cv::TrackerGOTURN::create(TrackerGOTURN_Params parameters = TrackerGOTURN::Params())
64 | private static native long create_0(long parameters_nativeObj);
65 | private static native long create_1();
66 |
67 | // native support for java finalize()
68 | private static native void delete(long nativeObj);
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/video/TrackerGOTURN_Params.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.video;
5 |
6 |
7 |
8 | // C++: class Params
9 |
10 | public class TrackerGOTURN_Params {
11 |
12 | protected final long nativeObj;
13 | protected TrackerGOTURN_Params(long addr) { nativeObj = addr; }
14 |
15 | public long getNativeObjAddr() { return nativeObj; }
16 |
17 | // internal usage only
18 | public static TrackerGOTURN_Params __fromPtr__(long addr) { return new TrackerGOTURN_Params(addr); }
19 |
20 | //
21 | // C++: cv::TrackerGOTURN::Params::Params()
22 | //
23 |
24 | public TrackerGOTURN_Params() {
25 | nativeObj = TrackerGOTURN_Params_0();
26 | }
27 |
28 |
29 | //
30 | // C++: string TrackerGOTURN_Params::modelTxt
31 | //
32 |
33 | public String get_modelTxt() {
34 | return get_modelTxt_0(nativeObj);
35 | }
36 |
37 |
38 | //
39 | // C++: void TrackerGOTURN_Params::modelTxt
40 | //
41 |
42 | public void set_modelTxt(String modelTxt) {
43 | set_modelTxt_0(nativeObj, modelTxt);
44 | }
45 |
46 |
47 | //
48 | // C++: string TrackerGOTURN_Params::modelBin
49 | //
50 |
51 | public String get_modelBin() {
52 | return get_modelBin_0(nativeObj);
53 | }
54 |
55 |
56 | //
57 | // C++: void TrackerGOTURN_Params::modelBin
58 | //
59 |
60 | public void set_modelBin(String modelBin) {
61 | set_modelBin_0(nativeObj, modelBin);
62 | }
63 |
64 |
65 | @Override
66 | protected void finalize() throws Throwable {
67 | delete(nativeObj);
68 | }
69 |
70 |
71 |
72 | // C++: cv::TrackerGOTURN::Params::Params()
73 | private static native long TrackerGOTURN_Params_0();
74 |
75 | // C++: string TrackerGOTURN_Params::modelTxt
76 | private static native String get_modelTxt_0(long nativeObj);
77 |
78 | // C++: void TrackerGOTURN_Params::modelTxt
79 | private static native void set_modelTxt_0(long nativeObj, String modelTxt);
80 |
81 | // C++: string TrackerGOTURN_Params::modelBin
82 | private static native String get_modelBin_0(long nativeObj);
83 |
84 | // C++: void TrackerGOTURN_Params::modelBin
85 | private static native void set_modelBin_0(long nativeObj, String modelBin);
86 |
87 | // native support for java finalize()
88 | private static native void delete(long nativeObj);
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/video/TrackerMIL.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.video;
5 |
6 | import org.opencv.video.Tracker;
7 | import org.opencv.video.TrackerMIL;
8 | import org.opencv.video.TrackerMIL_Params;
9 |
10 | // C++: class TrackerMIL
11 | /**
12 | * The MIL algorithm trains a classifier in an online manner to separate the object from the
13 | * background.
14 | *
15 | * Multiple Instance Learning avoids the drift problem for a robust tracking. The implementation is
16 | * based on CITE: MIL .
17 | *
18 | * Original code can be found here <http://vision.ucsd.edu/~bbabenko/project_miltrack.shtml>
19 | */
20 | public class TrackerMIL extends Tracker {
21 |
22 | protected TrackerMIL(long addr) { super(addr); }
23 |
24 | // internal usage only
25 | public static TrackerMIL __fromPtr__(long addr) { return new TrackerMIL(addr); }
26 |
27 | //
28 | // C++: static Ptr_TrackerMIL cv::TrackerMIL::create(TrackerMIL_Params parameters = TrackerMIL::Params())
29 | //
30 |
31 | /**
32 | * Create MIL tracker instance
33 | * @param parameters MIL parameters TrackerMIL::Params
34 | * @return automatically generated
35 | */
36 | public static TrackerMIL create(TrackerMIL_Params parameters) {
37 | return TrackerMIL.__fromPtr__(create_0(parameters.nativeObj));
38 | }
39 |
40 | /**
41 | * Create MIL tracker instance
42 | * @return automatically generated
43 | */
44 | public static TrackerMIL create() {
45 | return TrackerMIL.__fromPtr__(create_1());
46 | }
47 |
48 |
49 | @Override
50 | protected void finalize() throws Throwable {
51 | delete(nativeObj);
52 | }
53 |
54 |
55 |
56 | // C++: static Ptr_TrackerMIL cv::TrackerMIL::create(TrackerMIL_Params parameters = TrackerMIL::Params())
57 | private static native long create_0(long parameters_nativeObj);
58 | private static native long create_1();
59 |
60 | // native support for java finalize()
61 | private static native void delete(long nativeObj);
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/opencv/src/main/jniLibs/arm64-v8a/libc++_shared.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/opencv/src/main/jniLibs/arm64-v8a/libc++_shared.so
--------------------------------------------------------------------------------
/opencv/src/main/jniLibs/arm64-v8a/libopencv_java4.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/opencv/src/main/jniLibs/arm64-v8a/libopencv_java4.so
--------------------------------------------------------------------------------
/opencv/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/sample/generic.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/sample/generic.mp4
--------------------------------------------------------------------------------
/sample/h-pan.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/sample/h-pan.mp4
--------------------------------------------------------------------------------
/sample/mask.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/sample/mask.mp4
--------------------------------------------------------------------------------
/sample/no_mask.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/sample/no_mask.mp4
--------------------------------------------------------------------------------
/sample/original-vs-generic.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/sample/original-vs-generic.gif
--------------------------------------------------------------------------------
/sample/original-vs-h-pan.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/sample/original-vs-h-pan.gif
--------------------------------------------------------------------------------
/sample/original-vs-pan.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/sample/original-vs-pan.gif
--------------------------------------------------------------------------------
/sample/original-vs-still.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/sample/original-vs-still.gif
--------------------------------------------------------------------------------
/sample/original-vs-v-pan.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/sample/original-vs-v-pan.gif
--------------------------------------------------------------------------------
/sample/original.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/sample/original.mp4
--------------------------------------------------------------------------------
/sample/original_for_mask.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/sample/original_for_mask.mp4
--------------------------------------------------------------------------------
/sample/original_vs_no_mask_vs_mask.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/sample/original_vs_no_mask_vs_mask.gif
--------------------------------------------------------------------------------
/sample/pan.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/sample/pan.mp4
--------------------------------------------------------------------------------
/sample/still.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/sample/still.mp4
--------------------------------------------------------------------------------
/sample/v-pan.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/sample/v-pan.mp4
--------------------------------------------------------------------------------
/screenshot/edit-mask.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/screenshot/edit-mask.jpg
--------------------------------------------------------------------------------
/screenshot/input-info.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/screenshot/input-info.jpg
--------------------------------------------------------------------------------
/screenshot/main-screen.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/screenshot/main-screen.jpg
--------------------------------------------------------------------------------
/screenshot/media.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/screenshot/media.jpg
--------------------------------------------------------------------------------
/screenshot/parameters.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/screenshot/parameters.jpg
--------------------------------------------------------------------------------
/screenshot/toolbar.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/danopdev/VideoStab/da3e7aa6bc0df4a1f01cda4d8e495a32b0695d0a/screenshot/toolbar.jpg
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 | rootProject.name = "VideoStab"
3 | include ':opencv'
4 |
--------------------------------------------------------------------------------