-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Edge Drawing Improvements #2907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Edge Drawing Improvements #2907
Conversation
0d8a72e
to
ace1239
Compare
51b69b8
to
693db65
Compare
@alalek please review |
693db65
to
98a17f3
Compare
@@ -251,6 +332,9 @@ void EdgeDrawingImpl::write(cv::FileStorage& fs) const | |||
EdgeDrawingImpl::EdgeDrawingImpl() | |||
{ | |||
params = EdgeDrawing::Params(); | |||
nfa = new NFALUT(1, 1/2, 1, 1); | |||
dH = new double[MAX_GRAD_VALUE]; | |||
grads = new int[MAX_GRAD_VALUE]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new
Where are these objects destroyed?
dH, grads
Consider using std::vector
for these fields.
@@ -337,6 +338,13 @@ EdgeDrawingImpl::EdgeDrawingImpl() | |||
grads = new int[MAX_GRAD_VALUE]; | |||
} | |||
|
|||
EdgeDrawingImpl::~EdgeDrawingImpl() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it enough for now ? i am planning to work on optimizing all code later.
429d82c
to
f483d27
Compare
0802e7e
to
f483d27
Compare
f483d27
to
8dad620
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for updates!
Could you please reduce amount of default performance test cases?
|
||
/* 4. Allocate and initialize arguments for tested function */ | ||
std::string filename = getDataPath("perf/1680x1050.png"); | ||
Mat src = imread(filename, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0
Please avoid using of magic numbers. Use IMREAD_GRAYSCALE
instead.
int gx = 0; | ||
int gy = 0; | ||
|
||
switch (op) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, "constant" mode switch in inner body of two loops may cause some performance loss.
(in the current patch it is just code move, so we can keep it "as is" in this PR)
|
||
int sum; | ||
|
||
if (SumFlag) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if
similar to "constant" mode switch.
e9794cc
to
42288b6
Compare
42288b6
to
aa850cd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done 👍
#2314
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.
documentation preview