Skip to content

Commit

Permalink
发布v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jenly1314 committed Dec 31, 2023
1 parent 1f411a1 commit fe79be0
Show file tree
Hide file tree
Showing 25 changed files with 244 additions and 359 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ orbs:

jobs:
build:
executor: android/android

docker:
- image: cimg/android:2023.08
steps:
- checkout
- run:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Build with Gradle
run: ./gradlew build
83 changes: 28 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ Camera:为各个子库提供相机预览分析的核心库
repositories {
//...
mavenCentral()
maven { url 'https://jitpack.io' }
}
```

Expand All @@ -109,44 +108,46 @@ Camera:为各个子库提供相机预览分析的核心库
```gradle
//公共库 (*必须) (1.3.0新增:当使用到MLKit下面的子库时,需依赖公共库)
implementation 'com.github.jenly1314.MLKit:mlkit-common:2.0.1'
implementation 'com.github.jenly1314.MLKit:mlkit-common:2.1.0'
//--------------------------
//条码识别 (可选)
implementation 'com.github.jenly1314.MLKit:mlkit-barcode-scanning:2.0.1'
implementation 'com.github.jenly1314.MLKit:mlkit-barcode-scanning:2.1.0'
//人脸检测 (可选)
implementation 'com.github.jenly1314.MLKit:mlkit-face-detection:2.0.1'
implementation 'com.github.jenly1314.MLKit:mlkit-face-detection:2.1.0'
//人脸网格检测 (可选)
implementation 'com.github.jenly1314.MLKit:mlkit-face-mesh-detection:2.0.1'
implementation 'com.github.jenly1314.MLKit:mlkit-face-mesh-detection:2.1.0'
//图像标签 (可选)
implementation 'com.github.jenly1314.MLKit:mlkit-image-labeling:2.0.1'
implementation 'com.github.jenly1314.MLKit:mlkit-image-labeling:2.1.0'
//对象检测 (可选)
implementation 'com.github.jenly1314.MLKit:mlkit-object-detection:2.0.1'
implementation 'com.github.jenly1314.MLKit:mlkit-object-detection:2.1.0'
//姿势检测 (可选)
implementation 'com.github.jenly1314.MLKit:mlkit-pose-detection:2.0.1'
implementation 'com.github.jenly1314.MLKit:mlkit-pose-detection:2.1.0'
//姿势检测精确版 (可选)
implementation 'com.github.jenly1314.MLKit:mlkit-pose-detection-accurate:2.0.1'
implementation 'com.github.jenly1314.MLKit:mlkit-pose-detection-accurate:2.1.0'
//自拍分割 (可选)
implementation 'com.github.jenly1314.MLKit:mlkit-segmentation-selfie:2.0.1'
implementation 'com.github.jenly1314.MLKit:mlkit-segmentation-selfie:2.1.0'
//文字识别 (可选)
implementation 'com.github.jenly1314.MLKit:mlkit-text-recognition:2.0.1'
implementation 'com.github.jenly1314.MLKit:mlkit-text-recognition:2.1.0'
```

### 温馨提示

#### 关于MLKit版本与编译的SDK版本要求

> 使用 **v2.x** 以上版本时,要求 **compileSdkVersion >= 33**
> 使用 **v2.1.x** 以上版本时,要求 **compileSdkVersion >= 34**
> 使用 **v2.0.x** 以上版本时,要求 **compileSdkVersion >= 33**
> 如果 **compileSdkVersion < 33** 请使用 [**v1.x版本**](https://github.com/jenly1314/MLKit/tree/1.x/)
Expand Down Expand Up @@ -196,15 +197,15 @@ Camera:为各个子库提供相机预览分析的核心库
* 2D格式:Aztec, Data Matrix, PDF417, QR Code

```kotlin
BarcodeDecoder.process(bitmap, object : OnAnalyzeListener<List<Barcode>?> {
override fun onSuccess(result: List<Barcode>) {
// 分析成功
}

override fun onFailure(e: Exception?) {
// 分析失败
}
})
BarcodeDecoder.process(bitmap).addOnSuccessListener(this) {
if (it.isNotEmpty()) {
// TODO 成功;此处可获取识别的结果
} else {
// TODO 没有结果
}
}.addOnFailureListener(this) {
// TODO 失败;出现异常
}
```

### 各个module的使用示例
Expand Down Expand Up @@ -328,6 +329,11 @@ compileOptions {

## 版本记录

#### v2.1.0:2023-12-31
* 更新CameraScan至v1.1.0
* 更新compileSdkVersion至34
* 更新Gradle至v8.0

#### v2.0.1:2023-9-13
* 更新CameraScan至v1.0.1
* 更新ViewfinderView至v1.1.0
Expand All @@ -344,40 +350,7 @@ compileOptions {
* 更新MLKit相关依赖库版本
* 更新CameraX至v1.2.2

#### v1.3.0:2023-2-23
* 新增公共库(mlkit-common)
* 优化注释
* 更新CameraX至v1.2.1
* 更新Gradle至v7.5

#### v1.2.0:2022-12-11
* 新增人脸网格检测(mlkit-face-mesh-detection)
* 更新MLKit相关依赖库版本
* 更新CameraX至v1.2.0
* 更新compileSdkVersion至33

#### v1.1.0:2022-6-1
* 更新MLKit相关依赖库版本
* 更新CameraX至v1.2.0-rc01
* 更新compileSdkVersion至31
* 更新Gradle至v7.2

#### v1.0.3:2021-10-18
* 更新CameraX至v1.0.2
* ViewfinderView新增支持显示结果点相关
* 新增扫二维码有多个结果时可选实现示例(类似于新版微信效果)
* 文字识别(text recognition)改为静态(即:使用v2)

#### v1.0.2:2021-8-4
* 更新CameraX至v1.0.1
* 优化CameraConfig的一些默认配置

#### v1.0.1:2021-7-2
* 更新MLKit相关依赖库版本
* 优化细节

#### v1.0.0:2021-4-7
* MLKit初始版本
#### [查看更多版本记录](change_log.md)

## 赞赏

Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 10,
"versionName": "2.0.1",
"versionCode": 11,
"versionName": "2.1.0",
"outputFile": "app-release.apk"
}
],
Expand Down
114 changes: 65 additions & 49 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
android:name="android.hardware.camera"
android:required="false" />

<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.FLASHLIGHT"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.FLASHLIGHT" />

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />

<application
android:allowBackup="true"
Expand All @@ -21,84 +23,98 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MLKit">
<activity android:name=".MainActivity"
android:screenOrientation="portrait"
android:exported="true">
<activity
android:name=".MainActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name=".barcode.MultipleQRCodeScanningActivity"
android:screenOrientation="portrait"
<activity
android:name=".barcode.MultipleQRCodeScanningActivity"
android:exported="false"
android:theme="@style/CameraScanTheme"/>

<activity android:name=".barcode.QRCodeScanningActivity"
android:screenOrientation="portrait"
android:exported="false"
android:theme="@style/CameraScanTheme"/>
android:theme="@style/CameraScanTheme" />

<activity android:name=".barcode.BarcodeScanningActivity"
android:screenOrientation="portrait"
<activity
android:name=".barcode.QRCodeScanningActivity"
android:exported="false"
android:theme="@style/CameraScanTheme"/>

<activity android:name=".face.FaceDetectionActivity"
android:screenOrientation="portrait"
android:exported="false"
android:theme="@style/CameraScanTheme"/>
android:theme="@style/CameraScanTheme" />

<activity android:name=".face.MultipleFaceDetectionActivity"
android:screenOrientation="portrait"
<activity
android:name=".barcode.BarcodeScanningActivity"
android:exported="false"
android:theme="@style/CameraScanTheme"/>

<activity android:name=".face.FaceMeshDetectionActivity"
android:screenOrientation="portrait"
android:exported="false"
android:theme="@style/CameraScanTheme"/>
android:theme="@style/CameraScanTheme" />

<activity android:name=".image.ImageLabelingActivity"
android:screenOrientation="portrait"
<activity
android:name=".face.FaceDetectionActivity"
android:exported="false"
android:theme="@style/CameraScanTheme"/>

<activity android:name=".object.ObjectDetectionActivity"
android:screenOrientation="portrait"
android:exported="false"
android:theme="@style/CameraScanTheme"/>
android:theme="@style/CameraScanTheme" />

<activity android:name=".object.MultipleObjectDetectionActivity"
android:screenOrientation="portrait"
<activity
android:name=".face.MultipleFaceDetectionActivity"
android:exported="false"
android:theme="@style/CameraScanTheme"/>
android:screenOrientation="portrait"
android:theme="@style/CameraScanTheme" />

<activity android:name=".pose.PoseDetectionActivity"
<activity
android:name=".face.FaceMeshDetectionActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/CameraScanTheme" />

<activity
android:name=".image.ImageLabelingActivity"
android:exported="false"
android:theme="@style/CameraScanTheme"/>
android:screenOrientation="portrait"
android:theme="@style/CameraScanTheme" />

<activity android:name=".pose.AccuratePoseDetectionActivity"
<activity
android:name=".object.ObjectDetectionActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/CameraScanTheme" />

<activity
android:name=".object.MultipleObjectDetectionActivity"
android:exported="false"
android:theme="@style/CameraScanTheme"/>
android:screenOrientation="portrait"
android:theme="@style/CameraScanTheme" />

<activity android:name=".segmentation.SelfieSegmentationActivity"
<activity
android:name=".pose.PoseDetectionActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/CameraScanTheme" />

<activity
android:name=".pose.AccuratePoseDetectionActivity"
android:exported="false"
android:theme="@style/CameraScanTheme"/>
android:screenOrientation="portrait"
android:theme="@style/CameraScanTheme" />

<activity android:name=".text.TextRecognitionActivity"
<activity
android:name=".segmentation.SelfieSegmentationActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/CameraScanTheme" />

<activity
android:name=".text.TextRecognitionActivity"
android:exported="false"
android:theme="@style/CameraScanTheme"/>
android:screenOrientation="portrait"
android:theme="@style/CameraScanTheme" />

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
android:value="@integer/google_play_services_version" />

<meta-data
android:name="com.google.firebase.ml.vision.DEPENDENCIES"
Expand Down
22 changes: 1 addition & 21 deletions app/src/main/java/com/king/mlkit/vision/app/Function.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,7 @@ import com.king.camera.scan.util.LogUtils
/**
* @author <a href="mailto:[email protected]">Jenly</a>
*/
fun Bitmap.drawBitmap(block: (canvas: Canvas,paint: Paint) -> Unit): Bitmap {
var result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
try {
val canvas = Canvas(result)
canvas.drawBitmap(this, 0f, 0f, null)
val paint = Paint()
paint.strokeWidth = 4f
paint.style = Paint.Style.FILL_AND_STROKE
paint.color = Color.RED

block(canvas,paint)

canvas.save()
canvas.restore()
} catch (e: Exception) {
LogUtils.w(e.message)
}
return result
}

fun Bitmap.drawRect(block: (canvas: Canvas,paint: Paint) -> Unit): Bitmap {
fun Bitmap.drawRect(block: (canvas: Canvas, paint: Paint) -> Unit): Bitmap {
var result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
try {
val canvas = Canvas(result)
Expand Down
Loading

0 comments on commit fe79be0

Please sign in to comment.