简体   繁体   English

opencv重新映射到其他大小的图像

[英]opencv remap to a different size image

Can I use remap to map one image into another image with a different size? 我可以使用重映射将一个图像映射到另一个具有不同大小的图像吗?

for example assume that I want to map all pixels from image one (with size a,b) that x+y<100 into a new image and the size of new image should be 2a+b, 2b+a. 例如,假设我要将x + y <100的图像一(尺寸为a,b)的所有像素映射到新图像中,而新图像的尺寸应为2a + b,2b + a。

Yes you can do that if you provide map image of required size. 是的,如果您提供所需大小的地图图像,则可以这样做。 See documentation of remap . 请参阅remap文档。

Is there any reason that you can't use resize function for that? 有什么原因不能使用调整大小功能吗?

remap is more suited for geometical transformations of image. 重映射更适合图像的几何变换。 If you are aiming for image resizing only imresize is a better option for image resizing images. 如果你的目标的图像缩放仅imresize是图像调整图像大小是更好的选择。 In your case your can simply write 在你的情况下,你可以简单地写

resize(source_Img, destination_Img, Size(2a+b,2b+a), 0, 0, interpolation);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM