When drawing circles a linetype of CV_AA does not cause the resulting drawing to be anti-aliased (Bug #4159)
Description
To reproduce using Python:
import numpy as np import cv2 test_img = np.zeros((10,10)) print test_img cv2.circle(test_img, (5,5), 2, 100, 2, cv2.cv.CV_AA) print test_img
The result is a circle drawn with values of 100, but no anti-aliased 0-to-100 values, despite the line specification. Output copied below for reference:
[[ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]] [[ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [ 0. 0. 0. 0. 100. 100. 100. 0. 0. 0.] [ 0. 0. 0. 100. 100. 100. 100. 100. 0. 0.] [ 0. 0. 100. 100. 100. 100. 100. 100. 100. 0.] [ 0. 0. 100. 100. 100. 100. 100. 100. 100. 0.] [ 0. 0. 100. 100. 100. 100. 100. 100. 100. 0.] [ 0. 0. 0. 100. 100. 100. 100. 100. 0. 0.] [ 0. 0. 0. 0. 100. 100. 100. 0. 0. 0.] [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]]
Associated revisions
Merge pull request #4159 from alalek:vector_processing
History
Updated by Nisarg Thakkar about 10 years ago
This has been fixed in 2.4.10 and a pull request has been sent for 3.0.
https://github.com/Itseez/opencv/pull/3309
- Status changed from New to Done
- % Done changed from 0 to 100
Updated by Nisarg Thakkar about 10 years ago
Sorry, that was a different bug
- Status changed from Done to Open
- % Done changed from 100 to 0
Updated by Nisarg Thakkar about 10 years ago
You should change your code to :
test_img = np.zeros((10,10), np.uint8)
Updated by Dave Williams about 10 years ago
Nisarg Thakkar wrote:
You should change your code to :
[...]
That fixes it, thanks!
Let me know if there is any way to infer this type of required type from the documentation. It seems like CvArr's have different restrictions on them depending on what function they are being passed to, restrictions that for the life of me I can't intuit from the docs.
- Status changed from Open to Cancelled