Add example to detect edges - #259
Conversation
mloskot
left a comment
There was a problem hiding this comment.
Could you add a comment briefly explaining the algorithm; steps of the procedure, in words?
| #include <boost/gil/extension/numeric/convolve.hpp> | ||
|
|
||
|
|
||
| int main() { |
There was a problem hiding this comment.
Would it be possible to accept input image as command line argument?
5854314 to
d798bf5
Compare
| if(argc!=2){ | ||
| printf("Usage: simple_filter <image_path>"); | ||
| return 0; | ||
| } |
There was a problem hiding this comment.
Please use 'std::cerr' rather than printf, and return -1 to indicate the usage error.
There was a problem hiding this comment.
I'd also allow to use the C standard macros https://en.cppreference.com/w/cpp/utility/program/EXIT_status
|
|
||
| // making resizable kernel object | ||
| kernel_1d<float> kernel2(sharpen_1,3,1); | ||
| //compute horizontal edges |
There was a problem hiding this comment.
The comment seems to be repeating what the line of C++ code shows.
It rather should explain purpose of computing those edges.
Imagine I know very little about image processing and I read your code for the first time, do I have a chance to learn what algorithm your code implements?
To me, you should give a comment explaining the algorithm, what it does, what are the steps.
| convolve_rows<gray32f_pixel_t>(color_converted_view<gray8_pixel_t>(const_view(img)),kernel2,view(convolved)); | ||
| //compute vertical edges | ||
| convolve_cols<gray32f_pixel_t>(color_converted_view<gray8_pixel_t>(const_view(img)),kernel2,view(convolved2)); | ||
| //save horizontal edges |
There was a problem hiding this comment.
save... just repeats what the self-descriptive write_view indicates.
Such comments repeating the actual code are redundant.
9ae14df to
9b548d9
Compare
This commit adds a cpp file to example folder. The example demonstrats the use of one dimensional filter for detection of horizontal and vertical edges.The function accepts image path as command line argument.
9b548d9 to
2ae6852
Compare
|
@stefanseefeld Shall we add those as they are (optionally, with minor stylistic refactoring) to |
This commit adds a cpp file to example folder. The example demonstrats the use of one
dimensional filter for detection of horizontal and vertical edges.
Tasklist
All CI builds and checks have passedATM, examples are not built by CI jobs