12-02-2018, 10:10 PM | #1 |
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,721
|
RGBL histogram
Here's a little something I made tonight after working on a bunch of other video stuff:
Code:
// Histogram (RGB) //@param 1:xpos "x position" .95 //@param 2:ypos "y position" .95 //@param 3:bga "bg alpha" 0.6 //@param 4:bordera "border alpha" 0.5 //@param 6:logsc "log scale" 0 0 1 .5 1 project_wh_valid===0 ? input_info(0,project_w,project_h); project_w < 1280 ? ( project_h = 1280*project_h/project_w; project_w=1280; ); gfx_blit(0); colorspace='RGBA'; memset(0,0,1024); gfx_evalrect(0,0,project_w,project_h," r[0]+=1; g[256]+=1; b[512]+=1; (0.299*r + 0.587*g + 0.114*b)[768] += 1; ",2); i=0; logsc ? loop(1024,i[0] = log($e+i[0]) - 1; i+=1; ); function hist(x,y,w) local(i, m, tv, offs) global(bordera ysz bga) ( offs=w*256; m=i=0; loop(256, m=max(offs[i],m); i+=1); gfx_set(0,0,0,bga); gfx_fillrect(x,y,256,ysz); w<3 ? gfx_set(1,1,1,bordera) : gfx_set(0,1,0,bordera); gfx_fillrect(x-1,y-1,258,1); gfx_fillrect(x-1,y+ysz,258,1); gfx_fillrect(x-1,y,1,ysz); gfx_fillrect(x+256,y,1,ysz); w==3?gfx_set(.7) : gfx_set(w==0,w==1,w==2,1); i=0; loop(256, tv = floor((offs[i]/m)*ysz+0.5); gfx_fillrect(x+i,y+ysz-tv,1,tv); i+=1); ); gap = 64; xsz = 4*256 + 3*gap; ysz = 128; y = floor(ypos * (project_h-ysz)); x = floor(xpos * (project_w-xsz)); hist(x,y,0); x+=gap+256; hist(x,y,1); x+=gap+256; hist(x,y,2); x+=gap+256; hist(x,y,3); |
12-03-2018, 03:37 AM | #2 |
Human being with feelings
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
|
Awesome.
And again I'm amazed at how many things can be done with the video processor, while it seems so easy to write something like a histogram preset. (I wish I could understand at least a little bit.) Now we can monitor if highs or lows are shifted by colors. But to fix them, a luma dependent color correction or desaturator would be handy. Maybe this could be done as a workaround with chromakey? Not sure. Anyway! Many thanks. And here are the obligatory examples: |
12-03-2018, 04:48 AM | #3 |
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Overlayed histogram can be nice too :P
EG: EDIT: Also, having knobs so we can adjust black/midgrey/white for all channel (R, G,B and Mixed) would be very nice :P
__________________
Free ReaScripts - Premium Scripts - Custom Scripts Dev - Learn ReaScript - XR Theme - Stash Files - ReaLinks - Website - ReaComics - Alien 2347 - Donation Last edited by X-Raym; 12-03-2018 at 05:01 AM. |
12-03-2018, 07:53 AM | #4 |
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,721
|
Here's one that adds a 5th box for overlapped:
Code:
// Histogram (RGB) //@param 1:xpos "x position" .95 //@param 2:ypos "y position" .95 //@param 3:bga "bg alpha" 0.6 //@param 4:bordera "border alpha" 0.5 //@param 6:logsc "log scale" 0 0 1 .5 1 project_wh_valid===0 ? input_info(0,project_w,project_h); project_w < 1280 ? ( project_h = 1280*project_h/project_w; project_w=1280; ); gfx_blit(0); colorspace='RGBA'; memset(0,0,1024); gfx_evalrect(0,0,project_w,project_h," r[0]+=1; g[256]+=1; b[512]+=1; (0.299*r + 0.587*g + 0.114*b)[768] += 1; ",2|1); i=0; logsc ? loop(1024,i[0] = log($e+i[0]) - 1; i+=1; ); function hist(x,y,w,olm) local(i, m, tv, offs) global(bordera ysz bga) ( offs=w*256; m=i=0; loop(olm?768:256, m=max(offs[i],m); i+=1); gfx_set(0,0,0,bga); gfx_fillrect(x,y,256,ysz); w<3 ? gfx_set(1,1,1,bordera) : gfx_set(0,1,0,bordera); gfx_fillrect(x-1,y-1,258,1); gfx_fillrect(x-1,y+ysz,258,1); gfx_fillrect(x-1,y,1,ysz); gfx_fillrect(x+256,y,1,ysz); w==3?gfx_set(.7) : gfx_set(w==0,w==1,w==2); i=0; loop(olm?768:256, i===256?gfx_set(0,1,0,1,1):i===512?gfx_set(0,0,1,1,1); tv = floor((offs[i]/m)*ysz+0.5); gfx_fillrect(x+(i&255),y+ysz-tv,1,tv); i+=1); ); gap = 64; xsz = 5*256 + 4*gap; ysz = 128; y = floor(ypos * (project_h-ysz)); x = floor(xpos * (project_w-xsz)); hist(x,y,0,0); x+=gap+256; hist(x,y,1,0); x+=gap+256; hist(x,y,2,0); x+=gap+256; hist(x,y,3,0); x+=gap+256; hist(x,y,0,1); |
12-03-2018, 09:32 AM | #5 |
Human being with feelings
Join Date: Jul 2009
Posts: 7,570
|
OMG never thought this would happen!
I bet a skintone guide will never happen
__________________
REAPER Video Tutorials, Tips & Tricks and more at The REAPER Blog
|
12-03-2018, 03:15 PM | #6 |
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Looks very good thx !! :P Could be packed as default as well.
__________________
Free ReaScripts - Premium Scripts - Custom Scripts Dev - Learn ReaScript - XR Theme - Stash Files - ReaLinks - Website - ReaComics - Alien 2347 - Donation |
02-27-2019, 10:32 AM | #7 |
Human being with feelings
Join Date: Jul 2009
Posts: 7,570
|
any chance of a Vector scope?
__________________
REAPER Video Tutorials, Tips & Tricks and more at The REAPER Blog
|
Thread Tools | |
Display Modes | |
|
|