Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Update main.cpp #1

wants to merge 3 commits into from

Conversation

Celitra
Copy link

@Celitra Celitra commented Dec 8, 2019

Added image processing by Zaycev D.

Added image processing by Zaycev D.
Fix process_image method by Zaycev D.A
Comment on lines 283 to 296
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;
}
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just void?

src/zmq/zmq-source/main.cpp Outdated Show resolved Hide resolved
src/zmq/zmq-source/main.cpp Outdated Show resolved Hide resolved
src/zmq/zmq-source/main.cpp Outdated Show resolved Hide resolved
src/zmq/zmq-source/main.cpp Outdated Show resolved Hide resolved
}

//reduction and merge
int reduction_plus_merge_image(cv::Mat& frame_open_CV, cv::Mat& detected_edges, cv::Mat& reduction_matrix)
Copy link
Member

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.

src/zmq/zmq-source/main.cpp Outdated Show resolved Hide resolved
// stub image processing
void process_image(cv::Mat & in_out)
//finding boundaries
int border_image(cv::Mat& frame_open_CV, cv::Mat& detected_edges)
Copy link
Member

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.

src/zmq/zmq-source/main.cpp Outdated Show resolved Hide resolved
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();
Copy link
Member

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.

Comment on lines 312 to 318
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;
}
Copy link
Member

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!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants