"torchvision/vscode:/vscode.git/clone" did not exist on "2804c122ffca5d42451a4bb9845ad5e2fe7286fd"
Unverified Commit 8dfe58d1 authored by Qiaofei Li's avatar Qiaofei Li Committed by GitHub
Browse files

Fix TypeError: Scalar value for argument borderValue is longer than 4 (#535)

* fix TypeError: Scalar value for argument borderValue is longer than 4

* add comments for imshear with case that border_value has more than 3 elements
parent cfd337bb
......@@ -520,7 +520,12 @@ def imshear(img,
shear_matrix = _get_shear_matrix(magnitude, direction)
sheared = cv2.warpAffine(
img,
shear_matrix, (width, height),
borderValue=border_value,
shear_matrix,
(width, height),
# Note case when the number elements in `border_value`
# greater than 3 (e.g. shearing masks whose channels large
# than 3) will raise TypeError in `cv2.warpAffine`.
# Here simply slice the first 3 values in `border_value`.
borderValue=border_value[:3],
flags=cv2_interp_codes[interpolation])
return sheared
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment