如何对一组图像执行许多随机操作?
我需要操作图像,使其子矩形相对于图像的其余部分翻转或旋转。下面是一个示例:
此操作需要发生多次,每次都会从原始图像(而不是比对一张图像应用连续修改)。
子矩形的大小需要系统地变化(可能以 5% 的增量从 10% 到 75%),并且子矩形的位置需要随机变化。
最后,需要对大量图像执行此过程。
我该如何解决这个问题?
我的选择是 PHP、C# 或 Gimp 中的批处理。也就是说,如果有特别明智的方法,我准备学习新东西。
I need to manipulate an image such that a sub-rectangle of it is flipped or rotated relative to the rest of the image. Here's an example:
This manipulation needs to happen many times, each time producing a new modified image from the original (rather than applying successive modifications to one image).
The size of the sub-rectangle needs to vary systematically (perhaps in 5% increments from 10% to 75%) and the location of the sub-rectangle needs to vary randomly.
Lastly, this procedure needs to be carried out on a large number of images.
How would I go about this?
My options are PHP, C#, or batching in Gimp. That said, I'm prepared to learn something new if there's a particularly sensible approach.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议使用 C# 并为自己编写一个小实用程序。
Graphics
类可能具有所有您需要的方法。我建议您查看
DrawImage
和RotateTransform
函数。Id say go with C# and write yourself a little utility.
The
Graphics
class may have all of the methods that you need.Id suggest that you look at the
DrawImage
and theRotateTransform
functions.这是需要以编程方式完成的事情还是一次性交易?
如果以编程方式,它*可以*使用 GD 库在 PHP 中完成,但它不会容易或快速,因为您必须编写一个例程来手动移动像素。
基于 PHP GD 库方法的请求的“简单性”摘要:
我在 Gimp 的 C# 方面没有足够的经验,无法为您提供任何明确的答案;对不起。
Is this something that needs to be done programatically or is it a one-time deal?
If programatically, it *can* be done in PHP using the GD library, but its not going to be easy or fast, due to the fact that you'll have to write a routine to manually move pixels.
A summary of "easyness" of your request based on a PHP GD library approach:
I don't have enough experience in C# of Gimp to give you any definitive answers there; Sorry.
您可以使用您最喜欢的语言(这三种语言都有能力)对其进行编码并运行吗?
You could take your favourite language, they will all 3 be capable, code it and run it?