mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-18 08:44:11 +08:00

Migrate G-API module from main repo to opencv_contrib #3827 Related to https://github.com/opencv/opencv/pull/26469 Required https://github.com/opencv/opencv/pull/26527 CI: https://github.com/opencv/ci-gha-workflow/pull/201 TODO: - [x] Python types generator fix - [x] CI update ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
28 lines
544 B
C++
28 lines
544 B
C++
#include <opencv2/videoio.hpp>
|
|
#include <opencv2/highgui.hpp>
|
|
#include <opencv2/gapi.hpp>
|
|
#include <opencv2/gapi/core.hpp>
|
|
#include <opencv2/gapi/imgproc.hpp>
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
(void) argc;
|
|
(void) argv;
|
|
|
|
using namespace cv;
|
|
Mat in_mat = imread("lena.png");
|
|
Mat gx, gy;
|
|
|
|
Sobel(in_mat, gx, CV_32F, 1, 0);
|
|
Sobel(in_mat, gy, CV_32F, 0, 1);
|
|
|
|
Mat mag;
|
|
sqrt(gx.mul(gx) + gy.mul(gy), mag);
|
|
|
|
Mat out_mat;
|
|
mag.convertTo(out_mat, CV_8U);
|
|
|
|
imwrite("lena-out.png", out_mat);
|
|
return 0;
|
|
}
|