-
Notifications
You must be signed in to change notification settings - Fork 1
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
Update main.cpp #1
base: master
Are you sure you want to change the base?
Conversation
Added image processing by Zaycev D.
Fix process_image method by Zaycev D.A
src/zmq/zmq-source/main.cpp
Outdated
cv::GaussianBlur(in_out, in_out, { 51, 51 }, 0); | ||
int lowThreshold = 200; | ||
int ratio = 10; | ||
int kernel_size = 5; | ||
cv::Mat frame_open_CV_gray, dst; | ||
dst.create(frame_open_CV.size(), frame_open_CV.type()); | ||
cv::cvtColor(frame_open_CV, frame_open_CV_gray, cv::COLOR_BGR2GRAY); | ||
cv::blur(frame_open_CV_gray, detected_edges, cv::Size(kernel_size, kernel_size)); | ||
cv::Canny(detected_edges, detected_edges, lowThreshold, lowThreshold * ratio, kernel_size); | ||
dst = cv::Scalar::all(0); | ||
frame_open_CV.copyTo(dst, detected_edges); | ||
frame_open_CV_gray.release(); | ||
dst.release(); | ||
return 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.
Could you replace all tabs with spaces. Some viewers/editors (e.g. GitHub) render tabs with 8 spaces instead of desired 4. Visual Studio allows replacing strings matching certain regex in entire project.
// stub image processing | ||
void process_image(cv::Mat & in_out) | ||
//finding boundaries | ||
int border_image(cv::Mat& frame_open_CV, cv::Mat& detected_edges) |
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.
Why not just void?
} | ||
|
||
//reduction and merge | ||
int reduction_plus_merge_image(cv::Mat& frame_open_CV, cv::Mat& detected_edges, cv::Mat& reduction_matrix) |
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.
First two parameters may be const
.
// stub image processing | ||
void process_image(cv::Mat & in_out) | ||
//finding boundaries | ||
int border_image(cv::Mat& frame_open_CV, cv::Mat& detected_edges) |
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.
First parameter may be const
.
Destroy some bugs.
border_image(frame_open_CV, detected_edges); | ||
reduction_plus_merge_image(frame_open_CV, detected_edges, reduction_matrix); | ||
reduction_matrix.copyTo(in_out); | ||
in_out = cv::Mat(); | ||
frame_open_CV.release(); |
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.
Explicit release again is redundant.
src/zmq/zmq-source/main.cpp
Outdated
for (int t = 0; t < 3; t++) | ||
{ | ||
channels_frame_open_CV[0].data[i * frame_CV_width + j] = z + step_z / 2; | ||
} | ||
if (channels_frame_open_CV[1].data[i * frame_CV_width + j] > z&& | ||
channels_frame_open_CV[1].data[i * frame_CV_width + j] < z + step_z) | ||
{ | ||
channels_frame_open_CV[1].data[i * frame_CV_width + j] = z + step_z / 2; | ||
} | ||
if (channels_frame_open_CV[2].data[i * frame_CV_width + j] > z&& | ||
channels_frame_open_CV[2].data[i * frame_CV_width + j] < z + step_z) | ||
{ | ||
channels_frame_open_CV[2].data[i * frame_CV_width + j] = z + step_z / 2; | ||
if (channels_frame_open_CV[t].data[i * frame_CV_width + j] > z&& | ||
channels_frame_open_CV[t].data[i * frame_CV_width + j] < z + step_z) | ||
{ | ||
channels_frame_open_CV[t].data[i * frame_CV_width + j] = z + step_z / 2; | ||
} |
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.
Please, deal with these awful tabs!)
Added image processing by Zaycev D.