Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/image.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13551,7 +13551,7 @@ defmodule Image do
completely different),

* [:mse](https://en.wikipedia.org/wiki/Mean_squared_error) which
is the mean squared error (default). The returned value is a float
is the mean squared error. The returned value is a float
indicating how similar the images are. A value of
`0.0` means the images are the same. The number itself it simply a
measure of the error difference between images. A larger number means
Expand Down Expand Up @@ -13614,7 +13614,11 @@ defmodule Image do
@doc since: "0.34.0"
@doc subject: "Operation"

@spec compare(Vimage.t(), Vimage.t(), Keyword.t()) ::
@spec compare(
image_1 :: Vimage.t(),
image_2 :: Vimage.t(),
options :: Options.Compare.compare_options()
) ::
{:ok, number, Vimage.t()} | {:error, error()}
def compare(%Vimage{} = image_1, %Vimage{} = image_2, options \\ []) when is_list(options) do
with {:ok, options} <- Options.Compare.validate_options(image_1, options),
Expand Down
17 changes: 11 additions & 6 deletions lib/image/options/compare.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ defmodule Image.Options.Compare do

"""
@type compare_option ::
{:color, Pixel.t() | :auto}
| {:threshold, non_neg_integer()}
| {:greater_than, Pixel.t()}
| {:less_than, Pixel.t()}
| {:sigma, float()}
| {:min_amplitude, float()}
{:metric, metric()}
| {:saturation, number()}
| {:brightness, number()}
| {:difference_boost, number()}
| {:difference_color, Pixel.t()}

@typedoc """
The comparison metric used by `Image.compare/3`.

"""
@type metric :: :ae | :mse | :rmse

@type compare_options :: [compare_option()]

Expand Down
Loading