gpujs / gpujs/gpu.js

Output 1D Unknown-Length Array from 2D Known-Length Array

Open
#805 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
15.5k
Forks
663
PR merge metrics
No merged PRs in 30d

Description

I'm trying to generate an unknown-length array, from an input image or 2D array.

I want to distribute data using a **noise** image, for example:

For every white pixel -> Save the position of it (x, y) and push it to an array so you end up having a Z-length array. Where Z is the number of white pixels in the noise image.

**Input**

Screenshot 2022-12-28 at 17 08 45

**Output**

`[[x1, y1], [x2, y2], .... [xZ, yZ]]`

In result I get all the locations of where a pixel is white.

I need to use GPU power, since noise images are huge in my use case and must be updated at least at 24 fps.

![Doing math](https://media1.giphy.com/media/cRMgB2wjHhVN2tDD2z/giphy.gif?cid=ecf05e47i5rwu2q29v79wl3n3jufugx6hri8l8kf5no3uugy&rid=giphy.gif&ct=g)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.