Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 6th August 2012, 10:28   #22  |  Link
jmac698
Registered User
 
Join Date: Jan 2006
Posts: 1,867
Like I said, you can use the call plugin to run a batch script or whatever, but it's only run once before the script starts.

Here's how to read and plot pixels:
Code:
Function GetPixel(clip clip, int x, int y) {
    #Return luma of a pixel
    current_frame=0
    clip
    IsYUY2 ? ConvertToYV12 : clip#AverageLuma only works on planar.  YV12 is planar.
    pointresize(6,6,x,y,1,1)#Blow up the pixel at x,y by 6 times (minimum possible with resize)
    int(AverageLuma)
}

Function PutPixel(clip clip, int x, int y, int luma) {
    #Plot a pixel
    clip
    ClipIsYV12=IsYV12
    ClipIsYV12 ? ConvertToYUY2 : last
    pointresize(width*2, height)
    u=128
    v=128
    pixel=blankclip(last, color_yuv=luma*65536+u*256+v, width=2, height=1)
    layer(last, pixel, "add", 256, x*2, y)#Layer only works with YUY2
    pointresize(width/2, height)
    ClipIsYV12 ? ConvertToYV12 : last
}
I have to tell you, I'm using an undocumented trick here. You can read a pixel once at the start on a specific frame, by setting current_frame. This lets you use the runtime variables, like AverageLuma. Remove the "current_frame=" line to use it as a runtime function. With the runtime way; averageluma has to appear inside scriptclip or one of the others.

The array implementation in avslib is quite slow. I have the same thoughts of a meta-data per-frame with another clip; but it could be added at the bottom. The garbage in the last few lines can be be cropped out.

You can extend this to RGB with showred.converttoyv12 for example. You could also make a kind of array in a clip by plotting pixels and reading them.

My slicer and addcode plugins can also read and plot int's on a line of video.
http://forum.doom9.org/showthread.ph...74#post1582574

for myself: keywords pset, plot, plot a pixel, plot(x,y), pset(x,y)

edit: thank you me! I swear, this is the 5th time I've searched for this post.

Last edited by jmac698; 1st March 2015 at 12:30.
jmac698 is offline   Reply With Quote
 

Tags
file i/o, frame, imagesource, imagewriter, metadata

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:55.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.