BoofCV
BoofCV copied to clipboard
Providing SimpleCamera2Activity and VisualizeCamera2Activity as Fragments
Providing these two activities as Fragments would greatly increase the usability of these premade visualisation components. It would allow developers to include them in existing activities. If you still only want an activity you could then create one containing just the fragment.
This design made sense years ago but is definitely out of date now. It could be a bit before I personally have time to convert it into a fragment and other modern Android features. If someone sees this issue and would like to submit a PR that would be great!
Is it correct that I can't switch on torch mode in any subclass because the CaptureRequest.Builder mPreviewRequestBuilder and CameraOpen open etc. are private in SimpleCamera2Activity? Do I have to rewrite everything?
AFAIK I have to do sth. like
mPreviewRequestBuilder.set(CaptureRequest.FLASH_MODE, CaptureRequest.FLASH_MODE_TORCH) to switch on the flashlight.
... I found out how to overwrite configureCamera and call changeCameraConfiguration
@hurzl For next time try either creating a new issue or ask somewhere else, as this issue is about something completely different. Might also help others, who later have the same problem you had, to find the solution if it is located in a fitting issue and not just somewhere. ;)
This issue could probably be resolved easily with 'androidx.camera:camera-*', boofcv.android.ConvertBitmap. Using the ImageAnalyzer, you can use a PreviewView to point the camera, and analyze the images ConvertBitmap and qrCodePreciseDetector.detect(boofImage) qrCodePreciseDetector.detector.detections would have the detection results
I might be able to provide a sample, not sure where to put it, though.
@vogthenn Maybe as an example?
Won't make it into the next stable release but the one after this should have a complete rewrite using fragments. Writing the code for a commercial project and after it's stabilized I'm planning on donating it to this project. Will probably be a couple of months before it works its way into BoofCV.
Code seems to be able now. Copied the main class over and running into issues where I think some dependencies might be aar files only, which a Java project wouldn't like.
https://github.com/lessthanoptimal/BoofCV/tree/feature/fragments
That's the branch if anyone wants to try to help debug this build issue. Maybe the solution is to switch over to the Android plugin?
'./gradlew assemble' spews out a bunch of errors that look like this:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':integration:boofcv-android:compileKotlin'.
> Error while evaluating property 'filteredArgumentsMap' of task ':integration:boofcv-android:compileKotlin'
> Could not resolve all files for configuration ':integration:boofcv-android:compileClasspath'.
> Could not resolve androidx.core:core-ktx:1.9.0.
Required by:
project :integration:boofcv-android
> No matching variant of androidx.core:core-ktx:1.9.0 was found. The consumer was configured to find an API of a library compatible with Java 11, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
- Variant 'releaseVariantReleaseApiPublication' capability androidx.core:core-ktx:1.9.0 declares an API of a library, and its dependencies declared externally:
- Incompatible because this component declares a component, with the library elements 'aar' and the consumer needed a component, preferably in the form of class files
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
- Variant 'releaseVariantReleaseRuntimePublication' capability androidx.core:core-ktx:1.9.0 declares a runtime of a library, and its dependencies declared externally:
- Incompatible because this component declares a component, with the library elements 'aar' and the consumer needed a component, preferably in the form of class files
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
- Variant 'sourcesElements' capability androidx.core:core-ktx:1.9.0 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about its elements (required them preferably in the form of class files)
- Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
Good news! With help from @MaxDoss3 it appears to be building now. Going to try integrating it into a project and see if everything works as expected.