Skip to content

Commit

Permalink
added to_pointer in evision_mat
Browse files Browse the repository at this point in the history
Signed-off-by: Cocoa <[email protected]>
  • Loading branch information
cocoa-xu committed Jun 8, 2024
1 parent 7bb0303 commit d0ca509
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/evision_mat.erl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
'__from_struct__'(#evision_mat{ref=Ref}) ->
Ref.

to_pointer(Mat) when is_tuple(Mat), tuple_size(Mat) > 0, element(1, Mat) == evision_mat ->
MatRef = '__from_struct__'(Mat),
evision_nif:mat_at([{img, MatRef}, {mode, local}]).

to_pointer(Mat, Mode) when is_tuple(Mat), tuple_size(Mat) > 0, element(1, Mat) == evision_mat, is_atom(Mode) ->
MatRef = '__from_struct__'(Mat),
evision_nif:mat_at([{img, MatRef}, {mode, Mode}]).

full(Shape, Number, {T, L}) when is_tuple(Shape) ->
ToShape = [element(I, Shape) || I <- lists:seq(1, tuple_size(Shape))],
Ret = evision_nif:mat_full([{number, Number}, {t, T}, {l, L}, {shape, ToShape}]),
Expand Down

0 comments on commit d0ca509

Please sign in to comment.