我试图找到一个好的软件包或算法来修改图像,将图像的中心向外推,以模拟黄斑变性。我发现最好的方法是图像切片器包装和分裂成4块图像,推动内角和缝合图像回来。但是,包的连接方法不起作用,文档也不清楚。有人有能做这件事的包裹吗?你知道吗
同时,我也在尝试将图像的外部推入,以创建隧道视觉。你知道吗
(对于这两种情况,我仍在努力保留图像,尽管“倾斜”是可以的,但我正在努力防止图像丢失。)
我写的一些代码
import image_slicer
#split image into 4 pieces
image_slicer.slice('piegraph.jpeg',4) #just a simple sample img
#code to resize corners
#I can figure this out later.
#stitch images back
tiles = ("pie_01_01.png","pie_01_02.png","pie_02_01.png","pie_02_02.png")
image_slicer.join(tiles)
你可以使用opencv和numpy来做你想做的事情。你知道吗
如果我理解正确的话,你需要的是一个映射,它将原始图像映射为距离图像中心的函数。你知道吗
对于“黑洞”中的所有像素,你希望它们是黑色的,而对于其他所有像素,你希望它们聚在一起。你知道吗
所以如果我们把原始图像看作:
你想要的结果是:
以下代码适用于此。您需要使用的参数是
黑洞的半径
因子-改变“聚束”的数量太小,所有的像素也将映射到黑色太大,他们将不会聚束。你知道吗
相关问题 更多 >
编程相关推荐