Crate image_match

Source

Functions§

cosine_similarity
Computes the cosine of the angle between two feature vectors. Those vectors must have been both produced by calls to an un-tuned signature function or identical calls to a tuned version. Per the source paper and out own research, when using the un-tuned signature calculation a cosine of 0.6 or greater indicates significant similarity.
get_buffer_signature
Produces a 544 signed byte signature for a provided image that’s encoded as an array of conceptually grouped RGBA bytes with the provided width. The result is designed to be compared to other vectors computed by a call to this method using [cosine-similarity(a, b)].
get_tuned_buffer_signature
Produces a variable length signed byte signature for a provided image, encoded as an array of conceptually grouped RGBA bytes with the provided width. The result is designed to be compared to other vectors computed by a call to this method with identical tuning parameters using [cosine-similarity(a, b)]. crop is a value in [0, 0.5] indicating what percentage of the image to crop on all sides before grid placement. Note that this percentage is based not on the raw width but a calculation of color density. grid_size indicates how many points to place on the image for measurement in the resulting signature. Changing grid_size will alter the length of the signature to 8 * (grid_size - 1)^2 - 12 * (grid_size - 3) - 20.The average_square_width_fn controls the size of the box around each grid point that’s averaged to produce that grid point’s brightness value. The paper proposes max(2, floor(0.5 + min(cropped_width, cropped_height) / 20)) but provides no information about how that was chosen.