问题标签 [juicy-pixels]
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.
haskell - Why doesn't Gloss render in native resolution?
On OSX (with 2560 x 1600 native resolution), Gloss displays everything at zoom-factor 2x. Giving a window size of 300 x 300 to the display function creates a window of 600 x 600. All content in that window is also twice as big (in each dimension), regardless of whether drawn with Gloss or loaded as a sprite (I'm using Juicy for that). Scaling the content down does not give the same clean result as when displayed in the actual native resolution. Is there a way to make Gloss render in full native resolution?
I'm still new to Gloss and hope I haven't missed anything obvious.
Here is the code...
... and the corresponding render:
Update: This seems to be a general issue with OpenGL and retina displays (actually the way OSX pixels are calculated internally). Since, as I understand, Gloss doesn't really allow low-level access my guess is that this is not fixable.
Update 2: This seems to be a particular issue with GLUT as the underlying backend for Gloss. Rebuilding Gloss enabling GLFW and disabling GLUT should fix the issue.
image - 如何将图像从 DynamicImage 类型转换为 Image arr cs e?使用 JuicyPixels 和 HIP 库
我正在使用 JuicyPixels 图像处理库来摄取图像并将其转换为 Matrix 类型。我想将图像的分辨率更改为用户指定的尺寸,以便将其输入神经网络。
到目前为止,我的程序读取图像并将图像转换为 Data.Matrix 矩阵。图像类型来自DynamicImage -> Image Pixel8 ->[[Int]] -> Matrix Int
我曾尝试使用 Haskell 图像处理 (HIP) 库中的 resize 函数,但它需要并输出一种Image arr cs e
我不知道如何处理的类型。
到目前为止,这是我的代码:
编辑:
更改程序以删除changeResolution
函数,因为我意识到我可以使用convert
函数或使用readImageY
. 这是更新的代码:
我收到以下错误。你如何从 转换arr
为VS
?
image - 如何使用 HIP 将图像类型的精度从 Double 转换为 Word8?
我有一个类型的图像Image VS Y Double
(使用readImageY
HIP 库中的函数后),我想将其转换为Image VS Y Word8
. 我该怎么做呢?我需要在这个精度下应用它的下一个函数。
以下是相关代码的片段:
这是错误:
编辑: 双打是在图像类型中存储为 VS 向量类型的灰度像素值。我遇到的问题是可以访问双打以便能够转换它们。试图在这里解释/找到 HIP 库的方法,但我是 Haskell 的新手,无法弄清楚。