Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Manipulate Bitmap in DSP Code

For general discussion related FlowStone

Re: Manipulate Bitmap in DSP Code

Postby kortezzzz » Thu May 26, 2016 5:04 pm

Thanks for the fix, martin. Really great little module.

A question:

I mentioned that as the size of the loaded image increases, the loading times for new loaded image (after pressing the "do" trigger) increase as well. Considering the size of the generated arrays, its quite expected, but a 300X300 png that being loaded after 5 minutes?... that's lot of time. Is there any trick to decrease those loading times? As I'v understood from trog's explanation a while a go, Ruby won't do the trick as she's much slower then green with generating arrays.
User avatar
kortezzzz
 
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Manipulate Bitmap in DSP Code

Postby martinvicanek » Thu May 26, 2016 10:48 pm

Thanks for the feedback, kortezzzz. I did some trigger engineering and got the following benchmarks for a 512x512 pixel image;

loading time: 3s
processing time: 1s

That's not great but certainly better than 5 min. Perhaps an external DLL would help, but then it is sort of pointless to use FS in the first place, no?
Attachments
ImageProcessingHue_trigOpt.fsm
(1.58 MiB) Downloaded 986 times
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: Manipulate Bitmap in DSP Code

Postby RJHollins » Fri May 27, 2016 12:28 am

mmm .... getting a Ruby ERROR in the 'Trigger Rate Limiter' module. Undefined method: scheduleMethod
RJHollins
 
Posts: 1571
Joined: Thu Mar 08, 2012 7:58 pm

Re: Manipulate Bitmap in DSP Code

Postby tulamide » Fri May 27, 2016 1:28 am

If you want to access examples that are made with Ruby, you should update to 3.0.6
That's because there were significant improvements to the Ruby implementation. From 3.0.6 to 3.0.8 they were of cosmetic character only, so 3.0.6 will give you access to all Ruby codes, that were posted here up until 3.0.9 is published (I'm already frightened of that day. No easy exchange of schematics anymore :( )
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Manipulate Bitmap in DSP Code

Postby tulamide » Fri May 27, 2016 2:42 am

kortezzzz wrote:As I'v understood from trog's explanation a while a go, Ruby won't do the trick as she's much slower then green with generating arrays.

Might be a misunderstanding, because the opposite is true.

http://prntscr.com/b8wt2y
The green floats output the time needed to create the arrays in seconds
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Manipulate Bitmap in DSP Code

Postby aronb » Fri May 27, 2016 3:53 am

Martin,

That is amazing !!!

My stuff is simple (I think :) ) in comparison to your work - I don't even know how you think up stuff like that in Flowstone, but I'm learning thanks to the great teachers here on the forum !

I am trying to load a bitmap, then with X and Y inputs access the pixel at that point, just like the "GetPix" primitive BUT AS FAST AS POSSIBLE.

For one project I need only about 128 x 128 pixel resolution, so at 44100 that allows me to traverse the full array (if needed) in about (128 x 128) / 44100 or 0.4 seconds. But I really only need to access about 2048 pixels per array traverse (random lookup) so that is even faster at about 2048 / 44100 or 0.05 sec (20Hz). Eventually I will get a low resolution video image and look only at certain areas (pixel locations) but I have to do it fast - again "GetPix" is too slow unfortunately :(

You could even use this to scan a BMP Image out to an RGB LED XY Pixel Array, maybe even with slow video at low resolution - that would be cool to. But that is yet another project...

(For another project I need to access larger resolutions say up to 4096 x 4096, but that is for a different time, much later)

QikPix.JPG
Just a Fast Version of GetPix is Needed
QikPix.JPG (17.89 KiB) Viewed 24881 times

Think of it like Blue (Stream) inputs and outputs instead of Green (GUI Speed) inputs and outputs

I don't need color (C) out even, just RGB & Alpha, or even just RGB, or maybe HSB.

Hope that is a bit clearer, and thank you for the great discussion !

Aron
User avatar
aronb
 
Posts: 154
Joined: Sun Apr 17, 2011 3:08 am
Location: Florida, USA

Re: Manipulate Bitmap in DSP Code

Postby kortezzzz » Fri May 27, 2016 2:34 pm

Thanks for the feedback, kortezzzz. I did some trigger engineering and got the following benchmarks for a 512x512 pixel image;

loading time: 3s
processing time: 1s


Really great, matrin. That's faster then enough :D . I'm trying to do an interesting experiment which saves the image into a wav. file, and to do it right, I've used the "append" primitive to add the whole 4 arrays + image size info into 1 monstrous array that would contain all the data needed for extraction and finally, connected it to the "float to mem" prim' that is connected to the "save vav" primitive. By that, I've saved saved the image into the wave. file and was able to re-load by extracting the data from the file (very painful process... :cry: ). It works. But unfortunately, the "trigger blocker" trick doesn't works when appending arrays for some reason.

Might be a misunderstanding, because the opposite is true

@ tulamide, that's very interesting. Would love to see the ruby looper in action in martin's example! :)
If you find the time to show us how, where, why with a little schematic, that would be wonderful.

By the way, If speaking about ruby arrays: there are 2 things I've needed to do with ruby and I have no idea where to start. I'm sure that would decrease the whole process duration dramatically considering tulamide's statement.

1) How to append arrays in ruby in to one?
2) How to split any kind of array with ruby on a given index (we have only one split prim' in FS which splits only string arrays...)?

Great post, people. Thanks! 8-)
User avatar
kortezzzz
 
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Manipulate Bitmap in DSP Code

Postby tulamide » Fri May 27, 2016 3:17 pm

kortezzzz wrote:1) How to append arrays in ruby in to one?
2) How to split any kind of array with ruby on a given index (we have only one split prim' in FS which splits only string arrays...)?

(1)
Code: Select all
array1 = array1 + array2
or alternatively
Code: Select all
array1 = array1.concat(array2)

(2)
Code: Select all
array2 = array1.pop(number_of_elements)
Say, array one has 20 elements, then after
array2 = array1.pop(10)
the first array will contain the first 10 elements and array2 the last 10 elements. There are other ways as well.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Manipulate Bitmap in DSP Code

Postby kortezzzz » Fri May 27, 2016 4:05 pm

Thanks a lot, tulamide. I'll try this :)

edit:

Is there any difference between string arrays, int arrays and float arrays when spliting\appending or it works with any of them?
User avatar
kortezzzz
 
Posts: 763
Joined: Tue Mar 19, 2013 4:21 pm

Re: Manipulate Bitmap in DSP Code

Postby martinvicanek » Fri May 27, 2016 5:40 pm

aronb wrote:I am trying to load a bitmap, then with X and Y inputs access the pixel at that point, just like the "GetPix" primitive BUT AS FAST AS POSSIBLE.
[...]
Think of it like Blue (Stream) inputs and outputs instead of Green (GUI Speed) inputs and outputs

Like this?
StreamGetPixel.fsm
(170.65 KiB) Downloaded 992 times

@tulamide: very interesting comparison and for me a surprising result! But how do you keep the loop inside Ruby for the task at hand? You would need Ruby commands for getPixel and color2RGBA. Not sure if those are available in FS Ruby?
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users and 29 guests