Page 1 of 1
converting bitmap graph to wavetable
Posted: Sat May 11, 2013 6:24 pm
by tester
Sometimes there are situations, when you have no way to get text data, but graphs are available. Graphs, that can be cleaned (to single curve on white rectangle) and converted to B/W.
So the question. DiD anyone played with that topic? Converting bitmap graphs into shape data for avetables? Solved issues of "thick lines", to get smooth "vector"?
p.s.: I'm duplicating this topic from SM forum, because I'm not sure who is where.
Re: converting bitmap graph to wavetable
Posted: Sat May 11, 2013 7:25 pm
by strangeChild
Unless you're talking about hundreds of waves it's likely easier to trace them by eye over the image... a FS/SM type image file display with a draw-over feature that output a float array would be a (relative) no-brainer...
Recognizing scale and lines (and ignoring noise and other irrelevancies) from raw image data would be a major programming project (IMHO).
Re: converting bitmap graph to wavetable
Posted: Sat May 11, 2013 7:34 pm
by strangeChild
Thought about it some more... it would be feasible and not that huge a project provided the function line was defined for all pixels across the horizontal range and you're ok with normalized data as output and there was no junk in the image. You can scan downward (increasing value) in each column looking for the first pixel above some threshold and record it's vertical position. Populate an array and then invert (for drawing position convention), scale (resample), and normalize.
Re: converting bitmap graph to wavetable
Posted: Sat May 11, 2013 9:07 pm
by tester
FSM example?
Re: converting bitmap graph to wavetable
Posted: Sat May 11, 2013 9:48 pm
by strangeChild
here's a draft... the normalization stuff isn't working the way I expect but you should get the idea... I used a min/max detect instead of a threshold for ease of programming (not done in Ruby!).
It's dreadfully slow because it's a double loop going through every pixel.
Re: converting bitmap graph to wavetable
Posted: Sat May 11, 2013 10:07 pm
by tester
Found this:
http://synthmaker.co.uk/forum/viewtopic ... 997#p91235Generally I never played with graphics (yet), so the whole thing is new for me (...and it must wait until I finish other things), but as far I remember Trog wrote somewhere in the past also about averaging pixels for such detection, so the topic is "somewhere" (here or on SM forum). Plus i guess there will be something about interpolation (here or via resample module?).
In that one - I'm not against ruby. I just need (in the future) a small tool to convert (prepared) small bitmaps into 4k (or less) shapes for wavetabling.
Re: converting bitmap graph to wavetable
Posted: Fri Mar 28, 2014 7:56 am
by RJHollins
Was wondering if any development came about on this idea ??
I'm finding a situation that I'd like to convert an image of a graph to a vector display to save space.
Here is an example of the typical image:
![VSTAnalyzer [3Dent].jpg](./download/file.php?id=2999&sid=484e86aba3db850c44def0fb3a28fc33)
- VSTAnalyzer [3Dent].jpg (33.52 KiB) Viewed 14872 times
[was a BMP ... had to convert to JPG to post.]
In vector form, I had thought I could alter the scaling [size] and still maintain clarity for display.