在 C++ 中实现扭曲/液化工具
我正在寻找一种扭曲图像的方法,类似于 Photoshop/Gimp 中液化/IWarp 工具的工作方式。
我想用它来移动图像上的几个点,使其看起来比原来更宽。
有人对可用于执行此操作的库有任何想法吗?我目前在同一个项目中使用 OpenCV,所以如果有一种方法使用它会是最简单的,但我对任何事情都持开放态度,
非常感谢。
编辑:这是我想做的一个例子 https://i.sstatic.net/LJdWF.png< /a> 我所做的只是从侧面拉出一些点,这就是我希望从我的应用程序内部做的事情
Im looking for a way to warp an image similar to how the liquify/IWarp tool works in Photoshop/Gimp.
I would like to use it to move a few points on an image to make it look wider than it was originally.
Anyone have any ideas on libraries that could be used to do this? I'm currently using OpenCV in the same project so if theres a way using that it would be easiest but I'm open to anything really
Thanks.
EDIT: Heres an example of what im looking to do https://i.sstatic.net/LJdWF.png
All I've done there is pulled a few points out sideways and thats what im looking to do from inside my application
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从这个搜索'图像扭曲运算符源c ++'我得到:
.....添加了函数'CImg :: [get_]warp()',可以使用变形来扭曲图像....添加了函数'CImg :: save_cpp ()' 允许将图像直接保存为 C/C++ 源代码。 ...
那么 CImg 可以为您带来好处。
From this search 'image warp operator source c++' i get:
..... Added function 'CImg ::[get_]warp()' that can warp an image using a deformation .... Added function 'CImg ::save_cpp()' allowing to save an image directly as a C/C++ source code. ...
then CImg could do well for you.
OpenCV 的
remap
可以实现这一点。您只需提供 x 和 y 位移图。如果你聪明的话,我建议你可以直接创建置换贴图,这对于类似于 Photoshop 液化的画笔描边操作很有好处。网格扭曲和稀疏点图方法是另一种选择,但本质上是基于插值计算位移图。OpenCV's
remap
can accomplish this. You only have to provide x and y displacement maps. I would suggest you can create the displacement map directly if you are clever, and this would be good for brush-stroke manipulation similar to Photoshop's liquify. The mesh warp and sparse point map approach is another option, but essentially computes the displacement map based on interpolation.您可能需要查看 http://code.google.com/p/imgwarp- opencv/。这个库似乎正是您所需要的:基于稀疏网格的图像变形。
当然,另一种选择是自己生成位移并使用 OpenCV 的 cv::Remap() 函数。
You may want to take a look at http://code.google.com/p/imgwarp-opencv/. This library seems to be exactly what you need: image warping based on a sparse grid.
Another option is, of course, generate displacements yourself and use cv::Remap() function of OpenCV.