Skip to content

Commit

Permalink
Now SIFTdesc throws and exception when the input parameters are incom…
Browse files Browse the repository at this point in the history
…patible (kornia#598)

Co-authored-by: Edgar Riba <edgar.riba@gmail.com>
  • Loading branch information
ducha-aiki and edgarriba committed Jul 30, 2020
1 parent de399b2 commit 4d2efd8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kornia/feature/siftdesc.py
Expand Up @@ -41,6 +41,12 @@ def get_sift_bin_ksize_stride_pad(patch_size: int,
ksize: int = 2 * int(patch_size / (num_spatial_bins + 1))
stride: int = patch_size // num_spatial_bins
pad: int = ksize // 4
out_size: int = (patch_size + 2 * pad - (ksize - 1) - 1) // stride + 1
if out_size != num_spatial_bins:
raise ValueError(f"Patch size {patch_size} is incompatible with \
requested number of spatial bins {num_spatial_bins} \
for SIFT descriptor. Usually it happens when patch size is too small\
for num_spatial_bins specified")
return ksize, stride, pad


Expand Down

0 comments on commit 4d2efd8

Please sign in to comment.