使用OpenCV移动图像内容 [英] Shift image content with OpenCV
本文介绍了使用OpenCV移动图像内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从图片开始,我想将其内容移至10像素的顶部,而不更改大小,并在底部填充子图片 width x 10
黑色。
例如,原文:
转移:
img src =http://i.stack.imgur.com/jcNZi.jpgalt =Shifted>
是否有直接执行此操作的函数与OpenCV?
解决方案
是否有一个函数直接使用OpenCV执行此操作?
$ b
> cv :: Mat out = cv :: Mat :: zeros(frame.size(),frame.type());
frame(cv :: Rect(0,10,frame.cols,frame.rows-10))。copyTo(out(cv :: Rect(0,0,frame.cols,frame.rows-10) ));
Starting from an image, I would like to shift its content to the top of 10 pixels, without change the size and filling the sub image width x 10
on bottom with black.
For instance, the original:
And the shifted:
Is there a function to perform directly this operation with OpenCV?
解决方案
Is there a function to perform directly this operation with OpenCV?
http://code.opencv.org/issues/2299
or you would do this
cv::Mat out = cv::Mat::zeros(frame.size(), frame.type());
frame(cv::Rect(0,10, frame.cols,frame.rows-10)).copyTo(out(cv::Rect(0,0,frame.cols,frame.rows-10)));
这篇关于使用OpenCV移动图像内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文