I have for example this easy function, but i would like make it more compact, have you suggestion for me?
VideoCapture camera = VideoCapture(0);
cv::Mat& OpenCvCamera::getFrame()
{
Mat frame;
camera >> frame;
return frame;
}
I'd like to make it inline without using temporary variable "frame".
Is it possible?
2条答案
按热度按时间zour9fqk1#
看起来您想隐藏VideoCapture对象的存在。如果是这样,只需执行此操作即可。例如,只需 Package VideoCapture::read()。无需进行其他更改。
y1aodyip2#
cv::VideoCapture::read可能是您正在寻找的内容。
允许您摆脱整个
getFrame()
函数: