javacv icon indicating copy to clipboard operation
javacv copied to clipboard

Problems with linking, Image stitching

Open ankhafizov opened this issue 9 months ago • 4 comments

Greetings! I found this library the most convinient wa for image stitching since this function did not implemented in traditional org.opencv. Btw, I am writing an app for android

Meanwhile, I encountered the folowwing error with stitching while other functions work correctly: image

Probably it is connected with installation process. So my gradle:

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}

android {
    namespace 'com.digtp.minearologyscanner'
    compileSdk 34

    defaultConfig {
        applicationId "com.digtp.minearologyscanner"
        minSdk 28
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        viewBinding true
    }
}

configurations {
    javacpp
}

task javacppExtract(type: Copy) {
    dependsOn configurations.javacpp

    from { configurations.javacpp.collect { zipTree(it) } }
    include "lib/**"
    into "$buildDir/javacpp/"
    android.sourceSets.main.jniLibs.srcDirs += ["$buildDir/javacpp/lib/"]

    tasks.getByName('preBuild').dependsOn javacppExtract
}

dependencies {
    implementation 'androidx.core:core-ktx:1.12.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.10.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.7.5'
    implementation 'androidx.navigation:navigation-ui-ktx:2.7.5'
    implementation project(path: ':opencv')
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation group: 'org.bytedeco', name: 'javacv', version: '1.5.9'
    javacpp group: 'org.bytedeco', name: 'openblas-platform', version: '0.3.23-1.5.9'
    javacpp group: 'org.bytedeco', name: 'opencv-platform', version: '4.7.0-1.5.9'
    javacpp group: 'org.bytedeco', name: 'ffmpeg-platform', version: '6.0-1.5.9'
}

ankhafizov avatar Nov 07 '23 12:11 ankhafizov

There's a working sample project here, if that's what you're looking for: https://github.com/bytedeco/sample-projects/tree/master/JavaCV-android-example

saudet avatar Nov 07 '23 12:11 saudet

I am looking for ny insights how to tackle my problem with, i.e. stitching and linking ro opencl (screenshot above). As I see, the graddle file is similar to https://github.com/bytedeco/sample-projects/blob/master/JavaCV-android-example/app/build.gradle

ankhafizov avatar Nov 07 '23 14:11 ankhafizov

The errors about OpenCL are just warnings, you can ignore them.

saudet avatar Nov 07 '23 14:11 saudet

Thank you a lot! Really, the crash of my app was because of the RAM memory lack when 16 images was put to Stitcher simultaneously. Crashed without any callback. Probably, callback for memory exception will be a greate feature

ankhafizov avatar Nov 07 '23 16:11 ankhafizov