j2ghz / sdr-heatmap

Visualizes wireless spectrum scans generated by rtl_power
GNU Affero General Public License v3.0
22 stars 4 forks source link

There is no "header" with frequencies. #50

Open skinkie opened 4 years ago

j2ghz commented 4 years ago

Originally, I was going to add the exact same one heatmap.py produces. The problem I encountered using it before is that it doesn't have enough precision e.g. to differentiate PMR channels. If the signal is just a few pixels wide, or you want to know the freq. of the center (1 pixel), it's hard to figure out what it is. You can of course increase the precision in rtl_power or hackrf_sweep, but that make an already huge image bigger, and viewing it zoomed out produces worse quality image than if you had the right size from the start.

Alternatively I thought of having it embed the image in a .html file, and include a mouse tooltip which would show you the frequency on hover. The problem is browsers don't like huge images, which could be solved by pre-rendering lower zoom levels (like Google maps satellite) and using them when zoomed out. I looked for a premade solution which could accept images with metadata in some format, but didn't find much. Writing the browser logic myself, in JS, is not something I want to do.

Lastly, I thought about making a Rust GUI, as a sort of viewer. This would allow some (optional) optimizations, like being able to get a fast overview of the whole scan, and when you zoom the portion you're looking at could be rendered on-demand.

Do the same concerns apply to your use case?

skinkie commented 4 years ago

I think for a sweep there are two kind of things you want to walk through, a quick overview like "is this band noisy or not" and an in depth "what interesting signal is here", with the last ideally matching the bucket size of the output. The HTML approach does not sound bad, but this data seems to get poorly compressed as png's. I wonder if there are alternative approaches or formats that could be used. I actually know people that abuse PNGs to transfer isochrones to the browser (as vectors!) because how well it compresses, I wonder if another format could be exploited.

I like the idea of a rust viewer (for example with QT) but I think people eventually want to have more functionality, making it again a complete spectrum package (of which many exists) but not many that can swiftly get through massive amounts of data. So many you could create a faster intermediate memory representation that could be used for analytics.

j2ghz commented 4 years ago
That's an interesting thought, using something other than PNG. I had a look at a few formats: Format Size Widely supported
.bmp 13 927 KB Yes
.png 4 130 KB Yes
.jp2 3 423 KB Partly
.bmp.7z 2 787 KB No
.webp (lossless) 2 573 KB Yes
.flif 1 970 KB No

I only focused on lossless formats, as lossy compression may delete exactly the detail you are looking for in signals. As webp compressed the best I added #51

I also described an intermediate format that may be used for more efficient storage (rather than .csv.gz) and faster viewing/rendering.

As for the viewer I'm thinking of trying a GPU-accelerated game engine (e.g. Amethyst).