如何对一组图像执行许多随机操作?

发布于 2024-10-03 16:10:27 字数 342 浏览 0 评论 0原文

我需要操作图像,使其子矩形相对于图像的其余部分翻转或旋转。下面是一个示例:

alt text

此操作需要发生多次,每次都会从原始图像(而不是比对一张图像应用连续修改)。

子矩形的大小需要系统地变化(可能以 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:

alt text

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

能否归途做我良人 2024-10-10 16:10:27

我建议使用 C# 并为自己编写一个小实用程序。

Graphics 类可能具有所有您需要的方法。

我建议您查看 DrawImageRotateTransform 函数。

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 the RotateTransform functions.

七七 2024-10-10 16:10:27

这是需要以编程方式完成的事情还是一次性交易?

如果以编程方式,它*可以*使用 GD 库在 PHP 中完成,但它不会容易或快速,因为您必须编写一个例程来手动移动像素。

基于 PHP GD 库方法的请求的“简单性”摘要:

  • 操作发生很多次,每次都会从原始图像生成新的修改图像:easy
  • 子矩形的大小需要变化系统地,简单
  • 子矩形的位置需要非常随机,简单
  • 图像内旋转中等难度,缓慢
  • 在大型图像上执行此操作图像数量,简单

我在 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:

  • Manipulation happens many times, each time producing a new modified image from the original: easy
  • Size of the sub-rectangle needs to vary systematically, easy
  • Location of the sub-rectangle needs to very randomly, easy
  • In-image rotation moderate difficulty, and slow
  • Performing this on a large number of images, easy

I don't have enough experience in C# of Gimp to give you any definitive answers there; Sorry.

夜血缘 2024-10-10 16:10:27

您可以使用您最喜欢的语言(这三种语言都有能力)对其进行编码并运行吗?

You could take your favourite language, they will all 3 be capable, code it and run it?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文