将较小的图像放在较大的图像中 [英] put a smaller image within a larger image

查看:83
本文介绍了将较小的图像放在较大的图像中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


需要在较大的图像中放入较小的图像.较小的图片应在较大的图片中居中.我正在使用C#和OpenCV,有人知道如何执行此操作吗?

解决方案

请参阅本教程,该教程以透明的覆盖层说明了该任务.我还建议不要使用旧的openCV版本(带有IplImage),而要使用新的版本(带有Mat作为图像容器).

http://www.aishack.in/2010/07/transparent-image-overlays -in-opencv/ [ ^ ]


亚瑟(Arthur),

可以通过CSS实现.

只需将您的大图放入父级DIV中,即可获得其iD.然后分配其CSS
位置:相对.

现在您的较小图片将位于样式位置为div的div中,并将其命名为
div顶部:200像素;左侧:200像素;像这样使它居中.


# div-1  {
 位置 : 相对; 
}
# div-1a  {
 位置 : 绝对; 
 顶部 :  0; 
  :  0; 
 宽度 :  200px; 
} 



您的div-1a还是孩子时将在div-1中,您可以将其定位在居中位置.
您也可以从后面的代码中动态地做到这一点.


hi
need to put a smaller image within a larger image. the smaller picture should be centered in the larger picture. I''m working with C # and OpenCV, does anyone know how to do this?

解决方案

Refer to this tutorial that explains the task with a transparent overlay. I would also suggest to not use the old openCV versions (with IplImage) but rather the new ones (with Mat as image container).

http://www.aishack.in/2010/07/transparent-image-overlays-in-opencv/[^]


HI arthur ,

it can be acheieved by CSS .

just take your Large image in a parent DIV , gve its a iD. then assign its css
position:relative .

now your smaller image will be in a div with style position:absolute .and give this
div top:200px nd left:200px; like this to make this in center .


#div-1 {
 position:relative;
}
#div-1a {
 position:absolute;
 top:0;
 right:0;
 width:200px;
}



your div-1a will be in div-1 as a child and you can locate this to center .
you can do this dynamically too from code behind .


这篇关于将较小的图像放在较大的图像中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆