如何将图像切片/剪切成碎片
所以我有一个接收 OpenCV 图像并将其转换为灰度的函数。
void UseLSD(IplImage* destination)
{
IplImage *destinationForGS = cvCreateImage(cvSize(destination->width, destination->height),IPL_DEPTH_8U,1);
cvCvtColor(destination,destinationForGS,CV_RGB2GRAY);
}
现在如何将该图像切割成大小为 10x10 像素的图像并迭代它们? (宽度和高度可能不会除以 10,但如果会有一些损失(例如每个图像从 1*h 到 9*h+9*h 像素的损失),那对我来说没问题。) 顺便说一句,您可以将 10*10 图像之一输出到屏幕上。请。
So I have a function that receives OpenCV image and turns it into gray-scale.
void UseLSD(IplImage* destination)
{
IplImage *destinationForGS = cvCreateImage(cvSize(destination->width, destination->height),IPL_DEPTH_8U,1);
cvCvtColor(destination,destinationForGS,CV_RGB2GRAY);
}
How now to cut that image into images of size 10x10 pixels and iterate true them?
(width and height may not divide on 10 but if there would be some loss (like loss from 1*h to 9*h+9*h pixels per image) it would be OK for me. )
BTW can you output one of 10*10 images onto screen. please.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将图像裁剪成这样的小块(未测试迭代):
You can crop your images into small pieces like this (iteration not tested):
我认为最简单的解决方案是使用感兴趣区域。这是样本
I think the simplest solution is to use Regions of Interest. Here is sample