[Request] Output corresponding absolute value spectrum with overlay
I have now been using spec for a little bit and love it I would love to see an output option for resdet that could output the spectrum image with some form of overlay.
To be entirely transparent my goals for this is to have some form of visual like you can find on the Brazil Pixel youtube channel.
Hi,
This can actually be done with a small bit of scripting if you have the imagemagick CLI installed and resdet+spec in your PATH:
#!/usr/bin/env bash
image=$1
output=$2
read full_width full_height < <(identify -ping -format '%w %h' "$image")
read detected_width detected_height < <(resdet -v 1 "$image")
spec "$image" - | magick - -stroke green -draw \
"line $((full_width-50)),$detected_height $full_width,$detected_height \
line $detected_width,$((full_height-50)) $detected_width,$full_height" \
"$output"
Using the example image in the README produces this:
It's possible to add text for the detected_width and height to the magick command. This way you can adjust the brightness of the spectrogram using spec's options also.
@BuyMyMojo I put together a version of this script with a few more options that I think would be good to add to the repo, but let me know if this is the kind of output you had in mind. I do think a script is the best option here for the flexibility and compared to the relative complexity of adding visualization output directly to resdet itself.
Hi there sorry I didn't get a chance to respond to this! this is basically the exact output I had in mind yeah!
Cool then I've added this under src/visualize.sh in https://github.com/0x09/resdet/commit/5210c715e24dc762103b3b90e5f6cb29ba605bb9. The usage is like ./visualize.sh input.png output.png, but there are also some options to set the line length and color and to pass parameters through to resdet and spec.
Thanks for the suggestion!
looks great! I'll give it a shot soon!
Finally got a test video up, I think it needs an option for line thickness too.
settings -strokewidth 8 or something should handle this. I'll report back soon!
https://www.youtube.com/watch?v=AGjpCWCs1KE
@BuyMyMojo were there other options that would be useful to add to the script or can this be closed?
Hi I forgot to respond earlier! An option to make the lines thicker if possible would help with visibility when scaled down
Makes sense, https://github.com/0x09/resdet/commit/e05cf97961f9e87e5338a91ad125340d93b120ff adds a new option -t <thickness> which sets the stroke width in the ImageMagick command.