An open API service indexing awesome lists of open source software.

https://github.com/suzusou/opencv-color-detection

This program uses OpenCV to process CameraX information.
https://github.com/suzusou/opencv-color-detection

android bitmap camerax camerax-api java mat opencv opencv-library

Last synced: about 2 months ago
JSON representation

This program uses OpenCV to process CameraX information.

Awesome Lists containing this project

README

          


OpenCV logo

OpenCV-Color-Detection

This program uses `OpenCV` to process `CameraX information`.
## Version
### OpenCV Version
OpenCV 3.4.1
compileSdkVersion 31
buildToolsVersion "29.0.2"
minSdkVersion 28
targetSdkVersion 31

### Android Version
compileSdkVersion 31
buildToolsVersion "30.0.3"
minSdkVersion 28
targetSdkVersion 31
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

## Setting
MainActivity Path : /app/src/main/java/com/example/opencvcolordetection/
``` Java
imageAnalysis = new ImageAnalysis.Builder().setTargetResolution(new Size(176, 144))
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST).build();
```
At setTargetResolution(new Size(x, y)), set the resolution.
``` Java
private class MyImageAnalyzer implements ImageAnalysis.Analyzer {
private Mat matPrevious = null;

@Override
public void analyze(@NonNull ImageProxy image) {

Mat matOrg = getMatFromImage(image);

Mat mat = fixMatRotation(matOrg);

if (matPrevious == null) matPrevious = mat;
matPrevious = mat;

Bitmap bitmap = Bitmap.createBitmap(matPrevious.cols(), matPrevious.rows(), Bitmap.Config.ARGB_8888);
Utils.matToBitmap(matPrevious, bitmap);

//Describe the process you want to process in this class

image.close();
}
```
In this case, if you continue to take the average of the `RGB`, you can see it in the log.  

## Difference
Processing speed has been increased by cutting the library files by about `one-third`.

## Finally
For more information, tap the logo above and visit the official website.
If you found this helpful, please give us a star.