Skip to content

Commit 3fd7798

Browse files
committed
minor changes, add build test for PR
1 parent ccba658 commit 3fd7798

File tree

3 files changed

+96
-45
lines changed

3 files changed

+96
-45
lines changed

.github/workflows/build_test_pr.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: build test release
2+
3+
on:
4+
push:
5+
# branches: ["conan"]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
env:
10+
ANDROID_NDK_VERSION: r26c
11+
OPENCV_VERSION: 4.9.0
12+
LIB_NAME: libopencv_dart
13+
14+
jobs:
15+
build-windows:
16+
name: build-windows
17+
runs-on: windows-latest
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
submodules: true
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.11"
26+
- name: build-opencv-dart
27+
run: |
28+
python3 -m pip install conan
29+
conan profile detect -f
30+
conan build . -b missing -s compiler.cppstd=20
31+
32+
- uses: actions/upload-artifact@v4
33+
name: upload-windows-x64
34+
with:
35+
path: build/publish/libopencv_dart-windows-x64.tar.gz
36+
name: libopencv_dart-windows-x64.tar.gz
37+
- uses: subosito/flutter-action@v2
38+
with:
39+
# flutter-version: '3.16.9'
40+
channel: "stable"
41+
- name: Run Test
42+
run: |
43+
$env:PATH = "${{github.workspace}}\windows;${env:PATH}"
44+
flutter pub get
45+
flutter test -x no-local-files

lib/src/contrib/img_hash.dart

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: constant_identifier_names
2+
13
library cv;
24

35
import '../core/base.dart';
@@ -12,45 +14,45 @@ abstract class ImgHashBase {
1214
void compute (InputArray inputArr, OutputArray outputArr);
1315
}
1416

15-
// PHash is implementation of the PHash algorithm.
17+
/// PHash is implementation of the PHash algorithm.
1618
class PHash implements ImgHashBase {
1719

18-
// Compare compares the hash value between a and b using PHash.
20+
/// Compare compares the hash value between a and b using PHash.
1921
//
20-
// For further information, see:
21-
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
22+
/// For further information, see:
23+
/// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
2224
@override
2325
double compare(InputArray hashOne, InputArray hashTwo) {
2426
return _bindings.pHashCompare(hashOne.ptr, hashTwo.ptr);
2527
}
2628

27-
// Compute computes hash of the input image using PHash.
29+
/// Compute computes hash of the input image using PHash.
2830
//
29-
// For further information, see:
30-
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
31+
/// For further information, see:
32+
/// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
3133
@override
3234
void compute(InputArray inputArr, OutputArray outputArr) {
3335
return _bindings.pHashCompute(inputArr.ptr, outputArr.ptr);
3436
}
3537
}
3638

3739

38-
// AverageHash is implementation of the AverageHash algorithm.
40+
/// AverageHash is implementation of the AverageHash algorithm.
3941
class AverageHash implements ImgHashBase {
4042

41-
// Compare compares the hash value between a and b using AverageHash.
43+
/// Compare compares the hash value between a and b using AverageHash.
4244
//
43-
// For further information, see:
44-
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
45+
/// For further information, see:
46+
/// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
4547
@override
4648
double compare(InputArray hashOne, InputArray hashTwo) {
4749
return _bindings.averageHashCompare(hashOne.ptr, hashTwo.ptr);
4850
}
4951

50-
// Compute computes hash of the input image using AverageHash.
52+
/// Compute computes hash of the input image using AverageHash.
5153
//
52-
// For further information, see:
53-
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
54+
/// For further information, see:
55+
/// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
5456
@override
5557
void compute(InputArray inputArr, OutputArray outputArr) {
5658
return _bindings.averageHashCompute(inputArr.ptr, outputArr.ptr);
@@ -65,26 +67,26 @@ enum BlockMeanHashMode
6567
}
6668

6769

68-
// BlockMeanHash is implementation of the BlockMeanHash algorithm.
70+
/// BlockMeanHash is implementation of the BlockMeanHash algorithm.
6971
class BlockMeanHash implements ImgHashBase {
7072

7173
BlockMeanHashMode mode = BlockMeanHashMode.BLOCK_MEAN_HASH_MODE_0;
7274

7375
BlockMeanHash({this.mode = BlockMeanHashMode.BLOCK_MEAN_HASH_MODE_0});
7476

75-
// Compare compares the hash value between a and b using BlockMeanHash.
77+
/// Compare compares the hash value between a and b using BlockMeanHash.
7678
//
77-
// For further information, see:
78-
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
79+
/// For further information, see:
80+
/// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
7981
@override
8082
double compare(InputArray hashOne, InputArray hashTwo) {
8183
return _bindings.blockMeanHashCompare(hashOne.ptr, hashTwo.ptr, mode.index);
8284
}
8385

84-
// Compute computes hash of the input image using BlockMeanHash.
86+
/// Compute computes hash of the input image using BlockMeanHash.
8587
//
86-
// For further information, see:
87-
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
88+
/// For further information, see:
89+
/// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
8890
@override
8991
void compute(InputArray inputArr, OutputArray outputArr) {
9092
return _bindings.blockMeanHashCompute(inputArr.ptr, outputArr.ptr, mode.index);
@@ -96,78 +98,78 @@ class BlockMeanHash implements ImgHashBase {
9698
}
9799

98100

99-
// ColorMomentHash is implementation of the ColorMomentHash algorithm.
101+
/// ColorMomentHash is implementation of the ColorMomentHash algorithm.
100102
class ColorMomentHash implements ImgHashBase {
101103

102-
// Compare compares the hash value between a and b using ColorMomentHash.
104+
/// Compare compares the hash value between a and b using ColorMomentHash.
103105
//
104-
// For further information, see:
105-
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
106+
/// For further information, see:
107+
/// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
106108
@override
107109
double compare(InputArray hashOne, InputArray hashTwo) {
108110
return _bindings.colorMomentHashCompare(hashOne.ptr, hashTwo.ptr);
109111
}
110112

111-
// Compute computes hash of the input image using ColorMomentHash.
113+
/// Compute computes hash of the input image using ColorMomentHash.
112114
//
113-
// For further information, see:
114-
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
115+
/// For further information, see:
116+
/// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
115117
@override
116118
void compute(InputArray inputArr, OutputArray outputArr) {
117119
return _bindings.colorMomentHashCompute(inputArr.ptr, outputArr.ptr);
118120
}
119121
}
120122

121123

122-
// MarrHildrethHash is implementation of the MarrHildrethHash algorithm.
124+
/// MarrHildrethHash is implementation of the MarrHildrethHash algorithm.
123125
class NewMarrHildrethHash implements ImgHashBase {
124126

125127
double alpha = 2.0;
126128
double scale = 1.0;
127129

128130
NewMarrHildrethHash({this.alpha = 2.0, this.scale = 1.0});
129131

130-
// Compare compares the hash value between a and b using MarrHildrethHash.
132+
/// Compare compares the hash value between a and b using MarrHildrethHash.
131133
//
132-
// For further information, see:
133-
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
134+
/// For further information, see:
135+
/// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
134136
@override
135137
double compare(InputArray hashOne, InputArray hashTwo) {
136138
return _bindings.marrHildrethHashCompare(hashOne.ptr, hashTwo.ptr, alpha, scale);
137139
}
138140

139-
// Compute computes hash of the input image using MarrHildrethHash.
141+
/// Compute computes hash of the input image using MarrHildrethHash.
140142
//
141-
// For further information, see:
142-
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
143+
/// For further information, see:
144+
/// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
143145
@override
144146
void compute(InputArray inputArr, OutputArray outputArr) {
145147
return _bindings.marrHildrethHashCompute(inputArr.ptr, outputArr.ptr, alpha, scale);
146148
}
147149
}
148150

149151

150-
// NewRadialVarianceHash is implementation of the NewRadialVarianceHash algorithm.
152+
/// NewRadialVarianceHash is implementation of the NewRadialVarianceHash algorithm.
151153
class NewRadialVarianceHash implements ImgHashBase {
152154

153155
double sigma = 1;
154156
int numOfAngleLine = 180;
155157

156158
NewRadialVarianceHash({this.sigma = 1, this.numOfAngleLine = 180});
157159

158-
// Compare compares the hash value between a and b using RadialVarianceHash.
160+
/// Compare compares the hash value between a and b using RadialVarianceHash.
159161
//
160-
// For further information, see:
161-
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
162+
/// For further information, see:
163+
/// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#a444a3e9ec792cf029385809393f84ad5
162164
@override
163165
double compare(InputArray hashOne, InputArray hashTwo) {
164166
return _bindings.radialVarianceHashCompare(hashOne.ptr, hashTwo.ptr, sigma, numOfAngleLine);
165167
}
166168

167-
// Compute computes hash of the input image using RadialVarianceHash.
169+
/// Compute computes hash of the input image using RadialVarianceHash.
168170
//
169-
// For further information, see:
170-
// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
171+
/// For further information, see:
172+
/// https://docs.opencv.org/master/de/d29/classcv_1_1img__hash_1_1ImgHashBase.html#ae2d9288db370089dfd8aab85d5e0b0f3
171173
@override
172174
void compute(InputArray inputArr, OutputArray outputArr) {
173175
return _bindings.radialVarianceHashCompute(inputArr.ptr, outputArr.ptr, sigma, numOfAngleLine);

src/img_hash.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
#ifndef _OPENCV3_IMG_HASH_H_
2-
#define _OPENCV3_IMG_HASH_H_
1+
/*
2+
Created by mdeleau.
3+
Licensed: Apache 2.0 license. Copyright (c) 2024 mdeleau.
4+
*/
5+
#ifndef OCV_DART_IMG_HASH_H_
6+
#define OCV_DART_IMG_HASH_H_
37

48
#ifdef __cplusplus
59
#include <opencv2/opencv.hpp>
@@ -26,4 +30,4 @@ double radialVarianceHashCompare(Mat a, Mat b, double sigma, int numOfAngleLine)
2630
}
2731
#endif
2832

29-
#endif //_OPENCV3_IMG_HASH_H_
33+
#endif //OCV_DART_IMG_HASH_H_

0 commit comments

Comments
 (0)