Tuesday 24 October 2017

Node Stream Image Operators

I have a little background and a couple questions. I'm doing this for learning reasons, and I'm trying to change to the more recent version of node streams.Caveat I don't think I need -v 8.x.xWhat I want to make - end goal - I'm planning to have a stream exported as a node module. So that anyone could drop it into their project and come out with image convulsions. What would be neat is you give a full color image to this module and you end up with a bunch or convulsions of said image. Then I'd like to spawn child process to run the convulsions through a FFNN or RNN then feed those out puts to a CNN structured network. Would be interesting to leverage the streams in a child process to train lower level networks to produce perceptrons for the overall CNN.Now the problem. When I stream an image.jpg into a readstream I have access to the chunks of data.ReadStream.read() will read all the data as it flows. But ReadStream.read(1) will read one byte at a time. Pause and then resume. How should I approach getting the hight and width of the image? Current image is 400x400 (planning on moving to 25x25, for simplicity and testing). I could make it a constructor argument. Or possibly run an fs.stats on the image to find the height and width?How should I go about accessing a near by pixel in a kernel convulsion? I was thinking I'd have to hash map the pixels and store most of the hash in memory untill the kernel is far enough away from the current position. Thinking x direction processing and y direction processing.My current approach is to hash map the top row of pixels ( planning to do a 3x3 kernel) and the row below the kernel. So that I have a 3x3 square to work with. Depending on the direction I may hash the columns.Now my issue is that the buffer in a stream only spits out chunks in sequence starting at position (0,0).Is there another approach besides hash mapping the the rows/columns of near by pixels?

Submitted October 24, 2017 at 02:36PM by TheOneRavenous

No comments:

Post a Comment