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.
- Host: GitHub
- URL: https://github.com/suzusou/opencv-color-detection
- Owner: suzusou
- Created: 2022-07-04T08:09:20.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-01-30T05:18:26.000Z (over 1 year ago)
- Last Synced: 2025-05-08T04:55:32.843Z (5 months ago)
- Topics: android, bitmap, camerax, camerax-api, java, mat, opencv, opencv-library
- Language: Java
- Homepage: https://github.com/suzusou
- Size: 72.3 MB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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 classimage.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.