cocoa-xu / evision

Evision: An OpenCV-Erlang/Elixir binding
https://evision.app
Apache License 2.0
322 stars 22 forks source link

Evision.SIFT.detectAndCompute incorrect typespecs #243

Closed davydog187 closed 4 weeks ago

davydog187 commented 1 month ago

Found another dialyzer issue:

Evision.SIFT.detectAndCompute(
  _sift :: {:error, binary()} | %Evision.SIFT{:ref => reference()},
  _gray ::
    {:error, binary()}
    | %Evision.Mat{
        :channels => integer(),
        :dims => integer(),
        :raw_type => integer(),
        :ref => reference(),
        :shape => tuple(),
        :type =>
          :f16
          | :f32
          | :f64
          | :s16
          | :s32
          | :s8
          | :u16
          | :u8
          | {:f, 16 | 32 | 64}
          | {:s, 8 | 16 | 32}
          | {:u, 8 | 16}
      },
  {:error, binary()}
  | %Evision.Mat{
      :channels => integer(),
      :dims => integer(),
      :raw_type => integer(),
      :ref => reference(),
      :shape => tuple(),
      :type =>
        :f16
        | :f32
        | :f64
        | :s16
        | :s32
        | :s8
        | :u16
        | :u8
        | {:f, 16 | 32 | 64}
        | {:s, 8 | 16 | 32}
        | {:u, 8 | 16}
    }
)

breaks the contract
(Evision.Feature2D.t(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in()) ::
  {[Evision.KeyPoint.t()], Evision.Mat.t()} | {:error, String.t()}

I'm assuming its another inheritence issue where Evision.SIFT.t() inherits from Evision.Feature2D.t(). Please close if its the same issue as #242

davydog187 commented 4 weeks ago

Fixed!