Opened 10 years ago

Closed 8 years ago

#3026 closed enhancement (fixed)

support vectorscope graticule in histogram color modes

Reported by: dave rice Owned by:
Priority: wish Component: avfilter
Version: git-master Keywords: histogram
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the enhancement request:

A vectorscope graticule overlay option would allow for easier measurements and readings when using the color and color2 modes of the histogram filter and allow for the emulation of some broadcast equipment. An example of a vectorscope graticule overlay for NTSC is here http://upload.wikimedia.org/wikipedia/commons/7/7b/Vectorscope_graticule.png.

A very rough un-aligned example can be produce via:

ffmpeg -i Vectorscope_graticule.png -f lavfi -i smptebars -filter_complex "[0:v]scale=-1:256[a];[1:v]histogram=mode=color,transpose=cclock[b];[b][a]overlay[c]" -map "[c]"

Slightly better looking and aligned to center, but still unaligned at color points.

ffmpeg -i Vectorscope_graticule.png -f lavfi -i smptebars -filter_complex "[0:v]null[a];[1:v]histogram=mode=color,transpose=cclock,scale=680:680,negate[b];[b][a]overlay=24:44[c]" -map "[c]" -f nut -c:v rawvideo - | ffplay -

Change History (5)

comment:1 by Carl Eugen Hoyos, 10 years ago

Priority: normalwish

comment:2 by dave rice, 10 years ago

Here's an example of a graticule made via drawbox. I scaled it to 512 to increase the resolution of the boxes. I put a color for each of the 6 color points (r,g,b,c,y,m) and placed them at 100% and 75% levels. The 100% boxes are listed first and at 0.6 transparency while the 75% boxes are at 0.8 transparency. At 123 degrees I added the last four sienna boxes to indicate a skin tone line.
Within the drawbox commands, the x values are subtracted by 2 and the y values by 3 to accomodate centering the box around the color point. I added draw grid lines which helped verify all the placements. Also I added transpose=2 so that the vectorscope is aligned to a traditional analog vectorscope.

-vf 'histogram=mode=color2,\
    transpose=dir=2,\
    scale=512:512,\
    drawgrid=w=32:h=32:t=1:c=white@0.2,\
    drawgrid=w=256:h=256:t=1:c=white@0.3,\
    drawgrid=w=8:h=8:t=1:c=white@0.1,\
    drawbox=w=5:h=5:t=1:x=180-2:y=512-480-3:c=red@0.6,\
    drawbox=w=5:h=5:t=1:x=108-2:y=512-68-3:c=green@0.6,\
    drawbox=w=5:h=5:t=1:x=480-2:y=512-220-3:c=blue@0.6,\
    drawbox=w=5:h=5:t=1:x=332-2:y=512-32-3:c=cyan@0.6,\
    drawbox=w=5:h=5:t=1:x=404-2:y=512-444-3:c=magenta@0.6,\
    drawbox=w=5:h=5:t=1:x=32-2:y=512-292-3:c=yellow@0.6,\
    drawbox=w=5:h=5:t=1:x=199-2:y=512-424-3:c=red@0.8,\
    drawbox=w=5:h=5:t=1:x=145-2:y=512-115-3:c=green@0.8,\
    drawbox=w=5:h=5:t=1:x=424-2:y=512-229-3:c=blue@0.8,\
    drawbox=w=5:h=5:t=1:x=313-2:y=512-88-3:c=cyan@0.8,\
    drawbox=w=5:h=5:t=1:x=367-2:y=512-397-3:c=magenta@0.8,\
    drawbox=w=5:h=5:t=1:x=88-2:y=512-283-3:c=yellow@0.8,\
    drawbox=w=5:h=5:t=2:x=160-2:y=512-404-3:c=sienna@0.8,\
    drawbox=w=5:h=5:t=2:x=184-2:y=512-366-3:c=sienna@0.8,\
    drawbox=w=5:h=5:t=2:x=208-2:y=512-330-3:c=sienna@0.8,\
    drawbox=w=5:h=5:t=2:x=232-2:y=512-292-3:c=sienna@0.8'

Here's a one-liner application in ffplay to plot the testsrc source.

ffplay -f lavfi -i testsrc -vf 'histogram=mode=color2, transpose=dir=2, scale=512:512, drawgrid=w=32:h=32:t=1:c=white@0.2, drawgrid=w=256:h=256:t=1:c=white@0.3, drawgrid=w=8:h=8:t=1:c=white@0.1, drawbox=w=5:h=5:t=1:x=180-2:y=512-480-3:c=red@0.6, drawbox=w=5:h=5:t=1:x=108-2:y=512-68-3:c=green@0.6, drawbox=w=5:h=5:t=1:x=480-2:y=512-220-3:c=blue@0.6, drawbox=w=5:h=5:t=1:x=332-2:y=512-32-3:c=cyan@0.6, drawbox=w=5:h=5:t=1:x=404-2:y=512-444-3:c=magenta@0.6, drawbox=w=5:h=5:t=1:x=32-2:y=512-292-3:c=yellow@0.6, drawbox=w=5:h=5:t=1:x=199-2:y=512-424-3:c=red@0.8, drawbox=w=5:h=5:t=1:x=145-2:y=512-115-3:c=green@0.8, drawbox=w=5:h=5:t=1:x=424-2:y=512-229-3:c=blue@0.8, drawbox=w=5:h=5:t=1:x=313-2:y=512-88-3:c=cyan@0.8, drawbox=w=5:h=5:t=1:x=367-2:y=512-397-3:c=magenta@0.8, drawbox=w=5:h=5:t=1:x=88-2:y=512-283-3:c=yellow@0.8, drawbox=w=5:h=5:t=2:x=160-2:y=512-404-3:c=sienna@0.8, drawbox=w=5:h=5:t=2:x=184-2:y=512-366-3:c=sienna@0.8, drawbox=w=5:h=5:t=2:x=208-2:y=512-330-3:c=sienna@0.8, drawbox=w=5:h=5:t=2:x=232-2:y=512-292-3:c=sienna@0.8'

comment:3 by Elon Musk, 9 years ago

I think best way to do graticule is to generate one and then use an overlay filter.

comment:4 by dave rice, 9 years ago

@richardpl, that's probably true. I was originally inspired to post this, when seeing that the video mode of the ebur128 filter had something like a graticule.

comment:5 by Elon Musk, 8 years ago

Resolution: fixed
Status: newclosed

Lite digital version implemented. Maybe will add text later.
If you want emulation of analog vectorscope open new ticket.

Note: See TracTickets for help on using tickets.