Skip to content

Commit 97551c8

Browse files
feat: mat type in to js value
1 parent 56c9957 commit 97551c8

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

cpp/FOCV_Object.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,12 @@ jsi::Object FOCV_Object::convertToJSI(jsi::Runtime& runtime, const jsi::Value* a
191191
}
192192

193193
mat.convertTo(mat, CV_8U);
194-
194+
195195
value.setProperty(runtime, "base64", jsi::String::createFromUtf8(runtime, ImageConverter::mat2str(mat, format)));
196196
value.setProperty(runtime, "size", jsi::Value(mat.size));
197197
value.setProperty(runtime, "cols", jsi::Value(mat.cols));
198198
value.setProperty(runtime, "rows", jsi::Value(mat.rows));
199+
value.setProperty(runtime, "type", jsi::Value(mat.type()));
199200
} break;
200201
case hashString("mat_vector", 10): {
201202
auto mats = *FOCV_Storage::get<std::vector<cv::Mat>>(id);
@@ -380,8 +381,6 @@ void FOCV_Object::addObjectToVector(jsi::Runtime& runtime, const jsi::Value* arg
380381
auto& array = *FOCV_Storage::get<std::vector<cv::Mat>>(vectorId);
381382
auto& object = *FOCV_Storage::get<cv::Mat>(objectId);
382383
array.push_back(std::move(object));
383-
384-
int x = 4;
385384
} break;
386385
case hashString("rect_vector", 11): {
387386
auto& array = *FOCV_Storage::get<std::vector<cv::Rect>>(vectorId);

docs/pages/apidetails.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ toJSValue(
8787
cols: number;
8888
rows: number;
8989
base64: string;
90+
type: DataTypes;
9091
};
9192
toJSValue(matVector: MatVector): {
9293
array: { size: number; cols: number; rows: number }[];

src/objects/Objects.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export type Objects = {
7676
cols: number;
7777
rows: number;
7878
base64: string;
79+
type: DataTypes;
7980
};
8081
toJSValue(matVector: MatVector): {
8182
array: { size: number; cols: number; rows: number }[];

0 commit comments

Comments
 (0)