mirror of
https://github.com/opencv/opencv.git
synced 2025-06-16 14:50:52 +08:00
Merge pull request #21984 from xiong-jie-y:add_make_capture_for_camera_stream
This commit is contained in:
commit
bc0d4585b3
@ -119,6 +119,12 @@ GAPI_EXPORTS_W cv::Ptr<IStreamSource> inline make_capture_src(const std::string&
|
|||||||
return make_src<GCaptureSource>(path);
|
return make_src<GCaptureSource>(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NB: Overload for using from python
|
||||||
|
GAPI_EXPORTS_W cv::Ptr<IStreamSource> inline make_capture_src(const int id)
|
||||||
|
{
|
||||||
|
return make_src<GCaptureSource>(id);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace wip
|
} // namespace wip
|
||||||
} // namespace gapi
|
} // namespace gapi
|
||||||
} // namespace cv
|
} // namespace cv
|
||||||
|
@ -27,7 +27,7 @@ def build_argparser():
|
|||||||
parser = argparse.ArgumentParser(description='This is an OpenCV-based version of Gaze Estimation example')
|
parser = argparse.ArgumentParser(description='This is an OpenCV-based version of Gaze Estimation example')
|
||||||
|
|
||||||
parser.add_argument('--input',
|
parser.add_argument('--input',
|
||||||
help='Path to the input video file')
|
help='Path to the input video file or camera device number')
|
||||||
parser.add_argument('--out',
|
parser.add_argument('--out',
|
||||||
help='Path to the output video file')
|
help='Path to the output video file')
|
||||||
parser.add_argument('--facem',
|
parser.add_argument('--facem',
|
||||||
@ -323,7 +323,11 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
# ------------------------Execution part------------------------
|
# ------------------------Execution part------------------------
|
||||||
ccomp = comp.compileStreaming(args=cv.gapi.compile_args(kernels, nets))
|
ccomp = comp.compileStreaming(args=cv.gapi.compile_args(kernels, nets))
|
||||||
|
if ARGUMENTS.input.isdigit():
|
||||||
|
source = cv.gapi.wip.make_capture_src(int(ARGUMENTS.input))
|
||||||
|
else:
|
||||||
source = cv.gapi.wip.make_capture_src(ARGUMENTS.input)
|
source = cv.gapi.wip.make_capture_src(ARGUMENTS.input)
|
||||||
|
|
||||||
ccomp.setSource(cv.gin(source))
|
ccomp.setSource(cv.gin(source))
|
||||||
ccomp.start()
|
ccomp.start()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user