问题标签 [vips]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
1129 浏览

python - 提取 Vips 图像并将其保存到与 PIL 相同的 numpy 数组?

我查看了一些适用于 Vips 的文档但尚未找到答案。

我想将图像放入一个 numpy 3D 数组中,类似于 PIL 图像如何以这种方式自动处理:

.

到目前为止,这就是我为 Vips 所拥有的......

所以我最后得到了那个错误,因为我没有从 Vips Image 对象中以正确的格式提取数据。

0 投票
3 回答
1697 浏览

image - How to convert image to RGBA in `vips` tool? How to make sure two images have the same number of bands?

I'm writing a shell script to concatenate some images, and I'm using the vips command-line because it has low memory requirements (and I intend to work with extremely large images).

However, if one image is RGB and the other is RGBA, it fails:

How can I convert the input image to RGBA when using vips? I've been searching through the documentation, but I can't find it.

I'm also willing to use nip2 tool, which also uses libvips. I'm not willing to use ImageMagick (or similar tools) because the script will end up working with images as large as 20k×20k pixels, which take several gigabytes of RAM, more than I have now.

0 投票
2 回答
938 浏览

python - 如何在 Python 中使用 VIPS 执行逻辑操作和逻辑索引?

我有以下使用 Python 和 OpenCV 的代码。简而言之,我有一堆以不同焦深拍摄的图像。这些代码在所有焦点深度 (z) 中挑选出每个 (x,y) 位置具有最大高斯响应的拉普拉斯算子的像素,从而创建焦点堆叠图像。函数get_fmap创建一个二维数组,其中每个像素将包含具有最大对数响应的焦平面的编号。在以下代码中,被注释掉的行是我当前的 VIPS 实现。它们在函数定义中看起来不兼容,因为它只是部分解决方案。

然后fmap将用于从不同焦平面中挑选像素以创建焦点堆叠图像

这是在一个非常大的图像上完成的,我觉得 VIPS 在这方面可能比 OpenCV 做得更好。然而,官方文档提供的关于其 Python 绑定的信息相当少。根据我在互联网上可以找到的信息,我只能使图像卷积工作(在我的情况下,它比 OpenCV 快一个数量级。)。我想知道如何在 VIPS 中实现这一点,尤其是这些行?

0 投票
1 回答
142 浏览

python - Python-VIPS 是否支持对其部分图像的分配?

我一直在使用 Python 3 和 Numpy 来处理图像处理任务,我将小图块组装成一个大而完整的图像。

我会这样做:

其中max_x,max_y是单个图像块的最大起始坐标。然后我会像这样将图像粘贴到这个大画布中:

Wherejj是文件列表的一个条目,它记录了每个图块所属的位置。我想知道是否可以在 VIPS 中使用 Python 实现类似的操作?

0 投票
1 回答
909 浏览

image-processing - LibVIPS crashing when processing 3.9gb tiff image

I'm currently working on a project where I have an image of around 3.9gb. I want to create a google maps like view for this image (which is something LibVIPS can generate) by executing the following command:

However when doing this some warnings are shown and after that the program crashes:

Crash

Anyone got a clue what I could do to be able to process an image of this size using Vips? (Or any other library?).

I've done some investigation myself and it seems we need to have BigTiff, I've looked in the VIPS source code and saw the term BigTiff being used a number of times so I suppose it should be supported?

When opening the image in a tool like VLIV (Very Large Image Viewer) the image opens fine.

0 投票
1 回答
874 浏览

python - Python 服务器应用程序泄漏内存

我正在尝试诊断为什么我的 Python 服务器应用程序正在泄漏内存。该应用程序接受对图像 url 的请求,使用 Vips 调整其大小并返回图像。每次请求后,内存使用量大致增长原始图像的大小。

我试过使用 puppy 跟踪器,但是图像打开/关闭操作后的每个差异都显示只使用了几个字节。

外部 C 库可能是内存泄漏的原因吗?如果是这样,如何调试它。

如果有什么相关的,我会在 docker 容器中运行 python 服务器

0 投票
1 回答
659 浏览

python - 带有使用 libjpeg-turbo 构建的 VIPS 的错误 JPEG 库版本

我用 VIPS 8.1.1 构建了

我从 sourceforge 项目网站下载了这个包。安装包后,我配置 Vips

当我尝试加载 jpeg 文件或保存 jpeg 文件时,我收到以下错误消息:

我是否以错误的方式构建 VIPS?我应该使用其他版本的 libjpeg-turbo 构建吗?还是其他问题?

我找到了另一个名为 的库文件libjpeg.so.62,我尝试卸载 Vips 并使用此文件重新构建,但问题仍然存在。

0 投票
1 回答
1671 浏览

python - 使用 VIPS 处理非常大的图像有困难

我正在编写一个 Python(3.4.3) 程序,该程序在 Ubuntu 14.04 LTS 上使用 VIPS(8.1.1) 使用多个线程读取许多小图块并将它们组合成一个大图像。

在一个非常简单的测试中:

我得到正确的结果。在我的完整程序中,每个线程的工作涉及从源文件中读取二进制文件,将它们转换为 tiff 格式,读取图像数据并插入到画布中。它似乎有效,但是当我尝试检查结果时,我遇到了麻烦。由于图像非常大(~50000*100000 像素),我无法将整个图像保存在一个文件中,所以我尝试了

这需要很长时间,并且生成的 jpeg 只有黑色像素。如果我确实调整了 3 次,程序就会被杀死。我也试过

这会导致错误消息segmentation fault(core dumped),但确实会保存图像。里面有图片内容,但是好像放错地方了。

我想知道问题可能是什么?

以下是完整程序的代码。使用 OpenCV + sharedmem 也实现了相同的逻辑(sharedmem 处理了多处理部分)并且它没有问题地工作。

上面的模块(作为 mcv 导入)在驱动程序脚本中被调用:

为了检查内容,我使用了

0 投票
1 回答
61 浏览

python - 为什么 vipsCC 在裁剪后将 16bits(float)/band TIFF 图像转换为 8bits(byte)/band TIFF?

我尝试裁剪 16 位(浮点)/波段 TIFF 图像,但生成的图像是 8 位(字节)/波段。有什么我应该做的吗?

0 投票
1 回答
389 浏览

linux - 如何将 ImageMagick 的 unsharpMask 设置转换为 VIPS 的 vips_sharpen() 设置

我目前正在使用 ImageMagick 来调整图像大小和锐化图像。由于性能原因,我现在正在转向 VIPS。

我使用 imageMagick 的 unsharpMask ( http://php.net/manual/en/imagick.unsharpmaskimage.php ) 功能在调整照片大小后锐化照片。我目前正在使用以下设置:

vips_sharpen (http://www.vips.ecs.soton.ac.uk/supported/7.42/doc/html/libvips/libvips-convolution.html#vips-sharpen)有一些我正在尝试的附加参数复制相同的锐化结果。

有谁知道一种简单的方法来计算 imagemagick unsharp mask 设置的 VIPS 翻译?一定有某种公式?