Skip to content

dnn: add a human parsing cpp sample#17424

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
berak:dnn_sample_human_parsing
Jun 1, 2020
Merged

dnn: add a human parsing cpp sample#17424
opencv-pushbot merged 1 commit intoopencv:3.4from
berak:dnn_sample_human_parsing

Conversation

@berak
Copy link
Copy Markdown
Contributor

@berak berak commented May 29, 2020

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under OpenCV (BSD) License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • The feature is well documented and sample code can be built with the project CMake

should this go into 3.4 or master ?

@berak berak force-pushed the dnn_sample_human_parsing branch from 09fd7b1 to 0e6cb54 Compare May 29, 2020 09:00
@berak berak force-pushed the dnn_sample_human_parsing branch from 0e6cb54 to bd5eca0 Compare May 29, 2020 09:11

static Mat parse_human(const std::string &image, const std::string &model, int backend=dnn::DNN_BACKEND_DEFAULT, int target=dnn::DNN_TARGET_CPU) {
// this network expects an image and a flipped copy
Mat input = imread(image);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it’s better to read image in main() because we want to use parse_human() in other samples

Comment on lines +8 to +12
#include <opencv2/core.hpp>
#include <opencv2/dnn.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/imgcodecs.hpp>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need to include opencv2/core.hpp and opencv2/imgcodecs.hpp?


Mat segm = parse_human(image, model, backend, target);

imwrite("human.png", segm);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

imshow is enough, imwrite is not needed

@berak berak force-pushed the dnn_sample_human_parsing branch from bd5eca0 to 82fee05 Compare May 30, 2020 07:15
@l-bat
Copy link
Copy Markdown
Contributor

l-bat commented May 31, 2020

I think this PR should go into 3.4

Copy link
Copy Markdown
Contributor

@l-bat l-bat left a comment

Choose a reason for hiding this comment

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

Thank you 👍!

@berak berak changed the base branch from master to 3.4 May 31, 2020 07:13
@berak berak force-pushed the dnn_sample_human_parsing branch 2 times, most recently from 42b4ab2 to 129e922 Compare May 31, 2020 07:25
@berak berak force-pushed the dnn_sample_human_parsing branch from 129e922 to 09acd47 Compare May 31, 2020 07:51
@opencv-pushbot opencv-pushbot merged commit adcb943 into opencv:3.4 Jun 1, 2020
@berak berak deleted the dnn_sample_human_parsing branch June 2, 2020 06:26
@alalek alalek mentioned this pull request Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants