General Information
This Xtra is similar to TrackThemColors in that it lets you gather information about events in the video, you can track objects according to their brightness, color, or pattern. The Xtra also lets you display the video on stage, Grab a video frame to a cast member and get the color value of pixels in the video. The Pro version is different in that it gives the user ultimate control over every step of the tracking and display. This allows for many new uses but requires a better knowledge of lingo, using lists, points and rects, and of color, video and tracking.
TTC-Pro uses Quicktime for capture on all platforms. You need to make sure you have QuickTime installed and a VDIG that works with your camera. Windows users see the "Installing QuickTime" file
New . Version 1.1 now can support multiple instances of the Xtra. This means that if you have more than one video source connected to your computer you can track and view them all in one Director movie by opening the Xtra again and again for each additional source.
New Version 1.2 now lets you record Quicktime movies including sound. If you want you can continue to track the video while you record.
New Version 1.2 now lets you flip the video vertically and horizontally.
New version 1.2 now has new filter() method that can apply a variety of effects to the live video.
New version 1.3 now works great with FireWire and DV cameras without sacrificing speed, latency or quality. See InitVideo() for full explanation.
New version 1.4 now added rotation of video, and adjustment of contrast, saturation, RGB, and color median filter
New Version 1.5 now added setting and getting compression settings from lingo
New Version 1.6 now added SoundSettings dialog box and the ability to get and set all the video and sound settings
New Version 2.0 added windows and OSX support, added shockwave safe support.
New Version 2.1 Improved performance, New CountVideoSources() method, GrabOneFrame() returns conformation of actual new frame, InitVideo() returns errors instead of alert window
Getting in touch.
If you have suggestions, problems or comments about this Xtra you can write to :
info@smoothware.com
To find information about this Xtra and other Xtras, or to purchase this or another Xtra visit URL
www.smoothware.com
Opening the Xtra.
Put the Xtra in the "Xtras" folder near your Director application. Then call -
openXlib "TTCPro"
set TrackObj = new( Xtra "TTCPro")
Have TrackObj declared as a global variable since you will be referring to it later.
You will probably be doing this in the beginning of the movie so your handler will probably look like this:
on StartMovie
Global TrackObj
if not TrackObj then
openXlib "TTCPro"
set TrackObj = new( Xtra "TTCPro")
end if
end StartMovie
Closing the Xtra.
When you are done you should close the Xtra by assigning 0 to the variable.
on StopMovie
global TrackObj
set TrackObj = 0
CloseXlib
end
Before starting the video flow
Before you attempt to connect to a video camera, it is recommenced that you check that one is actually available, you can do so by calling CountVideoSources().
The CountVideoSources(TrackObj) method takes one argument:
TrackObj - The instance number returned from New().
The CountVideoSources() method returns one result:
numOfSources - an integer containing the number of video sources currently connected to the computer. If the result is 0 there is no video source connected. Note that this method only counts devices of different makes, so if you have 2 iBot cameras it will only report them as 1.
Starting the video flow.
You need to specify the source that will be used for tracking, it can be either live video or any activity on stage such as a QuickTime movie or streaming media. None of the other methods in this Xtra will work without calling the InitVideo() first.
You should call the InitVideo() method only once, and be sure to call CleanUp() before you leave.
The InitVideo(TrackObj, Source, SourceRect,VideoSource) method takes four arguments:
TrackObj - The instance number returned from New().
Source - 0 or 1 .
0 - if you are not using live video. In this case the Xtra will not attempt to connect to a capture device and will instead track the activity on stage in an area defined by SourseRect.
1 - If you are using a composite video input such as a PCI card, a USB capture device or a USB camera,FireWire and DV .
SourceRect - The size and location of the source to be tracked.
If you are using video the SourceRect should always start with 0,0 so you should define rect(0,0,width, height). If the source is the stage you can define any area you wish to track.
VideoSource - the video input to use , 1 if you have only one input and 2 to select the second and so forth.
InitVideo() returns 1 result:
initVideoResult - a string containing the following: "OK" - everything is fine , or if something went bad the string will contain the description of the error such as " couldn't open video channel"
Stopping the video flow.
Once you are done tracking, you should call the CleanUp() method. Do not attempt to call InitVideo() again without calling the Cleanup() first.
The Cleanup(TrackObj) method takes one argument.
TrackObj - The instance number returned from New().
Opening the Video Settings dialog box
To open the standard Video Settings dialog box which allows you to change the video source or change the parameters for your camera, use the VideoSettings() method. This is very useful for changing the brightness, saturation and contrast of the video to create better conditions for the tracking. Please note that this is only available if a video source has been defined in the InitVideo() method
The VideoSettings(TrackObj) takes one argument.
TrackObj - The instance number returned from New().
Opening the Sound Settings dialog box
To open the standard Sound Settings dialog box which allows you to change the sound source or change the parameters for your sound, use the SoundSettings() method. The SoundSettings(TrackObj) takes one argument.
TrackObj - The instance number returned from New().
Getting video parameters directly
Sometimes you may want to get attributes of the video without opening the video settings dialog box . You can do that with the SetPararms() method. this is handy for saving the settings for future use.
The GetParams(TrackObj) method takes one argument
TrackObj - The instance number returned from New().
The GetParams() method returns a list with 6 items : [input,hue,saturation,brightness,contrast,sharpness]
input - 1 or zero . 0 for composite video input. 1 for S-Video input. Not all video grabbers support this parameter.
hue - a number between 0 and 65536 defining the hue of the video. A setting of 32768 is 180 degrees which is the normal setting. Not all video grabbers support this parameter.
saturation - a number between 0 and 65536 defining the saturation of the video. A setting of 32768 is the normal setting. Not all video grabbers support this parameter.
brightness - a number between 0 and 65536 defining the brightness of the video. A setting of 32768 is the normal setting. Not all video grabbers support this parameter.
contrast - a number between 0 and 65536 defining the contrast of the video. A setting of 32768 the normal setting. Not all video grabbers support this parameter.
sharpness - a number between 0 and 65536 defining the sharpness of the video. A setting of 32768 the normal setting. Not all video grabbers support this parameter.
Setting video parameters directly
Sometimes you may want to set attributes of the video without opening the video settings dialog box . You can do that with the SetPararms() method.
The SetParams(TrackObj,input,hue,saturation,brightness,contrast,sharpness , standard) method takes 8 arguments:
TrackObj - The instance number returned from New().
input - 1 or zero . 0 for composite video input. 1 for S-Video input. Not all video grabbers support this parameter. If you wish to leave the input untouched set this argument to -1
hue - a number between 0 and 65536 defining the hue of the video. A setting of 32768 is 180 degrees which is the normal setting. If you wish to leave the hue untouched set this argument to -1. Not all video grabbers support this parameter.
Saturation - a number between 0 and 65536 defining the saturation of the video. A setting of 32768 is the normal setting. If you wish to leave the saturation untouched set this argument to -1. Not all video grabbers support this parameter.
Brightness - a number between 0 and 65536 defining the brightness of the video. A setting of 32768 is the normal setting. If you wish to leave the brightness untouched set this argument to -1. Not all video grabbers support this parameter.
Contrast - a number between 0 and 65536 defining the contrast of the video. A setting of 32768 the normal setting. If you wish to leave the contrast untouched set this argument to -1. Not all video grabbers support this parameter.
Sharpness - a number between 0 and 65536 defining the sharpness of the video. A setting of 32768 the normal setting. If you wish to leave the sharpness untouched set this argument to -1. Not all video grabbers support this parameter.
standard - a number between 0 and 2. 0 for NTSC, 1 for PAL, 2 for SECAM. Not all video grabbers support this parameter. If you wish to leave the standard untouched set this argument to 1
Creating a reference frame
To create a reference frame for change or pattern tracking call remember(). The Remember(TrackObj, Source) method takes two parameter.
TrackObj - The instance number returned from New().
Source - 0 to define the current frame of the video as the source , any number other than 0 designates a member as the source of the reference frame. Make sure you have an image cast member at that location and that the size of that member is the same as the video.(otherwise it will be stretched to fit).
Grabbing a frame to be tracked or displayed
In order to track or display the video, you must repeatable call GrabOneFrame() This grabs a single frame from the source and makes it available to the Xtra. You can call GrabOneFrame() once and then perform multiple tasks on that frame such as tracking and displaying. The GrabOneFrame(TrackObj) takes one argument.
TrackObj - The instance number returned from New().
GrabOneFrame() returns 1 result
grabResult - Either 1 or 0 . 1-A new frame was grabbed ands may be tracked and manipulated. 0 - A new frame was not grabbed , you should probably not waste time tracking this frame.
Note. some video devices can not keep up with the speed of a fast computer and grab only 15 - 30 FPS , therefore you should always check the result of GrabOneFrame and do tracking and manipulation only if a new frame has been grabbed, this will free your computer to do other stuff until the new frame is available.
Grabbing and averaging multiple frames
As an alternative to GrabOneFrame() which grabs a single frame from the source and makes it available to the Xtra you can call GrabSomeFrames(). This methods grabs a number of frames and averages them , the result is a smoother image where there is no motion and a blurring of areas where there is motion. The GrabSomeFrames(TrackObj, Method, Frames) takes three argument.
TrackObj - The instance number returned from New().
Method - 1. Actually grabs the number of frames specified and averaging them. This yields a very even averaging among the grabbed frames but is slow as it calls the video board multiple times. 2 - Grabs one frame but averages it with the previous frames that where grabs, this is very fast but the averaging is not very even.
Frames -How many frames to average.
Viewing the video source on stage
To View the video source on the screen you should call ShowVideo()
The ShowVideo(TrackObj, DisplayList) method takes two arguments.
TrackObj - The instance number returned from New().
DisplayList - A list containing the rects of areas to be displayed as follows : [SourceRect,TargetRect,SourceRect,TargetRect....] This gives you the ability to define multiple areas to be displayed in multiple locations on stage.
SourceRect - The rect of the area to be copied from the video to stage, this is defined in coordinates local to the video frame and should be entirely within the bounds of the frame.
TargetRect - Where the SourceRect should be placed on stage. This rect is defined in coordinates local to the stage. Please note that if the size of the TargetRect and SourceRect are not the same the image will be stretched to fit.
Please note that the ShowVideo()method displays the last frame that has been grabbed, so you must first call GrabOneFrame() to make sure you are displaying the most recent frame.
Grabbing a video frame to a cast member
You can use the Xtra to grab frames from the video to cast members. This is useful for creating background images for visualizing the tracking and for other purposes.
To grab a video frame to a cast member use the GrabToCast(TrackObj,GrabList) method.
The GrabToCast(TrackObj, CastMemberNum) takes two parameters.
TrackObj - The instance number returned from New().
GrabList - A list comprised of pairs of : [SourceRect,MemberNum , SourceRect,MemberNum...]
SourceRect - The rect of the area to be copied from the video to the member, this is defined in coordinates local to the video frame and should be entirely within the bounds of the frame. The size of the member will be the size of the SourceRect.
MemberNum - The number of the cast member to which you wish to grab the frame. (Have an Image cast member waiting in that location)
Don't forget to call GrabOneFrame() to make sure you are using the most recent frame.
Tracking the best match to specific colors
To track specific colors of interest in the video source use the TrackColors() method. This method will look for the points in the video most similar to the colors you define.
The FollowMyColors(TrackObj, Averaging,TrackList) takes three arguments
TrackObj - The instance number returned from New().
Averaging - a number defining how many pixels in the video should be averaged in the comparison, for example 2 would mean that am area of 2 X 2 pixels will be averaged and compared with the defined color. You can use this argument to minimize noise and random movement, but be aware that it can result in lower performance and also ignoring small features in the video.
TrackList. A list comprised of any number of ColorTrackingPrarms, one for each color or area you wish to track ;
[ColorTrackingPrarms, ColorTrackingPrarms...]
ColorTrackingPrarms. A list containing the following :
[Red,Green,Blue,searchRect]
Red - An integer between 0-255 defining the red value of the color to be tracked.
Green - An integer between 0-255 defining the green value of the color to be tracked.
Blue - an integer between 0-255 defining the blue value of the color to be tracked.
SearchRect - a rect defined in coords local to the video frame describing the area to be tracked. This can be used to mask out areas of the video with information which is irrelevant or unreliable such as the top and left sides of the frame which may contain random noise.
The TrackColors() method returns a list containing one TrackResults list per ColorTrackingPrarms you sent ;
[TrackResults,TrackResults...]
TrackResults is a list containing the following:
[ColorPoint,Red,Green,Blue,Similarity]
ColorPoint - a point defined in coordinates local to the video of the pixel that is most similar to the color you defined.
PixelRed - An integer between 0-255 returning the red value of the pixel that is most similar to the color you defined.
PixelGreen - An integer between 0-255 returning the green value of the pixel that is most similar to the color you defined.
PixelBlue - An integer between 0-255 returning the blue value of the pixel that is most similar to the color you defined.
Similarity - a number between 0 and 100 describing how similar the returned pixel is to the defined color. The lower the number the better the match.
Don't forget to call GrabOneFrame() to make sure you are using the most recent frame.
Tracking blobs of specified colors.
To track blobs of specific colors you should call the TrackColorBlobs() method . This method looks for groups of pixels of specific colors and returns their location.
The TrackColorBlobs(TrackObj, BlobList) takes two arguments.
TrackObj - The instance number returned from New().
BlobList - A list comprised of any number of BlobTrackingParams , one for each color or area you wish to track
[BlobTrackingPrarms,BlobTrackingPrarms...]
BlobTrackingParams is a list containing the following:
[Red,Green,Blue,Similarity,searchRect]
Red - An integer between 0-255 defining the red value of the color to be tracked.
Green - An integer between 0-255 defining the green value of the color to be tracked.
Blue - an integer between 0-255 defining the blue value of the color to be tracked.
Similarity - a number between 0 and 100 defining how similar a pixel needs to be to the defined color in order to be included in the result. The higher the number the less pixels will qualify.
SearchRect - a rect defined in coords local to the video frame describing the area to be tracked. This can be used to mask out areas of the video with information which is irrelevant or un reliable such as the top and left sides of the frame which may contain random noise.
The TrackColorBlobs() method returns a list containing one BlobResults list per BlobTrackingPrarms you sent
[BlobResults,BlobResults...]
BlobResults is a list containing any number of BlobRects the Xtra has identified for the respective BlobTrackingPrarms
[BlobRect,BlobRect...]
BlobRect - a rect defined in coordinates local to the video of a group of contingent pixels that are similar to the color you defined.
Don't forget to call GrabOneFrame() to make sure you are using the most recent frame.
Selecting pixels of specific colors
If you want to receive information about all the pixels that are similar to specific colors you can call SelectColorPixels(). This method takes a list of colors and areas and returns lists of pixels. The SelectColorPixels(TrackObj, SelecColorList) takes two arguments :
TrackObj - The instance number returned from New().
SelecColorList a list of any number of SelectColorParams ;
[SelectColorParams, SelectColorParams ]
SelectColorParams a list containing the following parameters:
[Red, Green, Blue, Similarity, SearchRect]
Red - An integer between 0-255 defining the red value of the color to be selected.
Green - An integer between 0-255 defining the green value of the color to be selected.
Blue - an integer between 0-255 defining the blue value of the color to be selected.
Similarity - A number between 0 and 100 defining how similar a pixel needs to be to the defined color in order to be included in the result. The higher the number the less pixels will be selected.
SearchRect - A rect defined in coords local to the video frame describing the area to be searched. This can be used to mask out areas of the video with information which is irrelevant or unreliable such as the top and left sides of the frame which may contain random noise.
The SelectColorPixels() returns a list containing one SelectColorResults per SelectColorParams you defined.
[SelectColorResults, SelectColorResults ]
SelectColorResults a list containing any number of PixelPoints , one per pixels that has been selected.
PixelPoints a point describing the location point(horizontal,vertical) of a pixel in coordinates local to the video.
Don't forget to call GrabOneFrame() to make sure you are using the most recent frame.
Tracking blobs of pixels that have changed over time.
To track blobs of pixels that have changed you call the TrackChangeBlobs() method . You must call Remember() first to create a reference frame. This method looks for groups of pixels that have changed and returns their location.
The TrackColorBlobs(TrackObj, BlobList) takes two arguments.
TrackObj - The instance number returned from New().
BlobList - A list comprised of any number of BlobTrackingPrarms , one for each Similarity or area you wish to track
[BlobTrackingPrarms,BlobTrackingPrarms...]
BlobTrackingParams is a list containing the following:
[Similarity,searchRect]
Similarity - A number between 0 and 100 defining how different a pixel needs to be from the same pixel in the reference frame in order to be included in the result. The higher the number the less pixels will be selected.
SearchRect - A rect defined in coords local to the video frame describing the area to be searched. This can be used to mask out areas of the video with information which is irrelevant or unreliable such as the top and left sides of the frame which may contain random noise.
The TrackChangeBlobs() method returns a list containing one BlobResults list per BlobTrackingPrarms you sent
[BlobResults,BlobResults...]
BlobResults is a list containing any number of BlobRects the Xtra has identified for the respective BlobTrackingPrarms
[BlobRect,BlobRect...]
BlobRect - a rect defined in coordinates local to the video of a group of contingent pixels that have changed beyond the similarity threshold.
Don't forget to call GrabOneFrame() to make sure you are using the most recent frame.
Selecting pixels that have changed from the reference frame
If you want to receive information about all the pixels that have changed from the reference frame you can call SelectChangePixels(). You must call Remember() first to create a reference frame. The SelectChangePixels (TrackObj, SelecColorList) takes two arguments :
TrackObj - The instance number returned from New().
SelecChangeList A list of any number of SelectChangeParams ;
[SelectChangeParams, SelectChangeParams ]
SelectChangeParams A list containing the following parameters:
[Similarity, SearchRect]
Similarity - A number between 0 and 100 defining how different a pixel needs to be from the same pixel in the reference frame in order to be included in the result. The higher the number the less pixels will be selected.
SearchRect - A rect defined in coords local to the video frame describing the area to be searched. This can be used to mask out areas of the video with information which is irrelevant or unreliable such as the top and left sides of the frame which may contain random noise.
The SelectChangePixels() returns a list containing one SelectChangeResults per SelectChangeParams you defined.
[SelectChangeResults, SelectChangeResults ]
SelectChangeResults a list containing any number of PixelPoints , one per pixels that has been selected.
PixelPoints a point describing the location point(horizontal,vertical) of a pixel in coordinates local to the video.
Don't forget to call GrabOneFrame() to make sure you are using the most recent frame.
Tracking patterns
To track for specific patterns in the video you can use FollowAreas(). This Method tries to find the best match between a portion of the reference frame and an area of the current frame. The FollowAreas(TrackObj, AreaList) takes two parameters.
TrackObj - The instance number returned from New().
AreaList - A list of pairs of rects , each pair defining the rect of the pattern you are looking for and the rect of the area to search.
[pattern1 rect, search1 rect, patern2 rect, search2 rect....]
each pattern rect must be accompanied by a search rect. you are not limited by the amount of patterns to look for .
The FollowAreas() method returns a list with 2 items per pattern [MatchPoint, Match, MatchPoint, Match ]
Match. A number between 0- 425 defining the confidence the software has in the match it has found (the lower the better). You should monitor this number and only use results that have a low match number.
Don't forget to call GrabOneFrame() to make sure you are using the most recent frame.
Getting a hold of the pixels in the video:
Sometimes you might want to get a hold of the actual pixels of the video frame. This is useful for analyzing the colors and for creating any other tracking method that is not supplied by the Xtra. Getting the pixels into director is surprisingly fast, and you should not hesitate to ask for thousands of points at a time. The two methods that send back pixel colors are GetColors() and GetAllColors().
The GetColors() method lets you define the points you are interested in and returns the colors of those points.
The GetColors(TrackObj, PixelList) takes two arguments:
TrackObj - The instance number returned from New().
PixelList - A list of points to be returned
[PixelPoint, PixelPoint...]
PixelPoint a point(horizontal , vertical) defined in coords local to the video frame defining the location of a pixel you are interested in.
The GetColors() method returns a list with the following sequence : [Red, Green, Blue , Red, Green, Blue...]
Red -the red component of the pixel 0-255.
Green -the green component of the pixel 0-255.
Blue -the blue component of the pixel 0-255.
The GetAllColors() lets you get a large amount of pixels fast. You define an area and the Xtra returns all the pixels in that area. This method is faster than GetColors() but the results are not formatted as conveniently.
The GetAllColors(TrackObj, Area) takes two arguments:
TrackObj - The instance number returned from New().
Area - A rect of the area of interest defined in coordinates local to the video frame.
The GetAllColors() method returns a list of colors in the following sequence [Red, Green, Blue , Red, Green, Blue...]
Red -the red component of the pixel 0-255.
Green -the green component of the pixel 0-255.
Blue -the blue component of the pixel 0-255.
Using these results is not that straight forward.
Say you want to receive all the pixels from an area at the upper left corner of the video . Say the rect you are defining is rect(0,0,100,100).
Therefore your call will look like this :
put GetAllColors(TrackObj, rect(0,0,100,100)) into TheResult
therefor the Xtra will return a list with 3 X 100 x 100 =30,000 items
Than say you want to see the color of pixel 10 - horizontal , 50 - vertical .
Set TheWidth = 100 -- remember we asked for a 100*100 rect
set PixelH = 10 -- our pixels horizontal location
Set PixelV = 50 -- our pixels vertical location
Set OurPixel = PixelH *3 + PixelV *TheWidth
set red =getat (theresult , OurPixel )
set green =getat (theresult , OurPixel +1)
set blue =getat (theresult , OurPixel +2)
This looks complicated but you only have to figure it out once...
Setting The Color of pixels in the video or stage:
You can set the colors of specific pixels in the video or on stage using the SetColors() method. The SetColors (TrackObj, Target , SetColorList) takes three arguments;
TrackObj - The instance number returned from New().
Target 1- paint the pixels on stage. 2 paint the pixels on the video frame. Be aware that if you paint on the video frame you need to then call ShowVideo() to see the results. Also be aware that this method actually changes the video frame and will affect any tracking done on that frame until you call GrabOneFrame().
SetColorList a list of any number of SetColorParams :
[SetColorParams, SetColorParams ]
SetColorParams A list containing the following parameters :
[PixelPoint , Red, Green, Blue, Blend]
PixelPoint A point (horizontal vertical) If the Target is 1 then in coords local to the stage if the Target is 2 then in coords local to the video frame.
Red - the red component of the pixel to be set 0-255.
Green - the green component of the pixel to be set 0-255.
Blue - the blue component of the pixel to be set 0-255.
Blend 0-100 The transparency of the pixel, 100 = fully opaque
Applying a filter
Sometimes it is useful or beutiful to apply a filter to the video. This may helps reduce noise and may help in eliminating small interfering detail in the video or enhance something. Note that applying a filter to the video actually changes the pixels of the frame in memory and any operation that follows including ShowVideo will be affected. The Filter(TrackObj, filterlist) method takes 2 arguments
TrackObj - The instance number returned from New().
filterlist - a list comprised of any number of FilterParams eace defining a filter to be applied. Note that the filters are applied one by one in sequence, so the order does make a difference .
[FilterParams,FilterParams,FilterParams...]
FilterParams- a list containing two numbers.
[method,amount]
method - the filter method to be used , see list bellow.
amount - the amount to apply the filter , this changes for each method, see list bellow .
Filters methods:
Blur - method = 1 , amount = radius in pixels. This filter applies a blur effect which will smooth the image and lose detail, it is sometimes usefull for reducing noise for tracking . The blur is an expensive filter so use a small amount number if performance is important. (good amounts 2-10)
Posterize - method = 2, amount = levels per color channel up to (2-255). This filter reduces the number of colors in the video , the result is a posterized effect. this is a fast filter and changing the amount won't slow it down. (good amounts 2- 20)
Random Displacement - method = 3, amount = the max distance in pixels of the displacement. This filter randomly moves pixels to a new location creating a sort of noise effect. (good amounts 5-50)
Random Displacement without flicker - method = 4 , amount = the max distance in pixels of the displacement. This filter is similar to the Random Displacement but it does not flicker.
Random Noise - method = 5 , amount = the max amount of noise to add to each pixel. This filter adds noise to the image , the amounts can go from 1 - 1000. (good amounts 1 - 250) extreme amounts will create snow .
Median filter - method = 12 , amount = the radius in pixels . This method applies a median filter , which is good at removing noise for tracking, note, however that it will lose the color information so you can't track colors after you do this, also note that it is slow , especially for large amounts (good amounts 2-4)
Color Median filter - method = 20 , amount = the radius in pixels . This method applies a median filter , which is good at removing noise for tracking, (good amounts 2-4)
Threshold - method = 13 , amount = the threshold (0-255). This filter coverts the video to black and white. all pixels brighter than the threshold will be white and ones darker than the threshold will be black. (amount 127 splits in the middle)
Invert - method = 14, amount ignored. This will invert the video .
Find Edges - method = 15, amount = threshold of change to be shown. This filter finds sharp changes in the frame and represents them as black on a white backgrounds, the higher the amount, the more reluctant it will be to declare things as change. (good starting amount - 20)
Adjust Red - method = 16 , amount = how much red to add/ subtract from each pixel (values -255 to 255)
Adjust Green - method = 17 , amount = how much green to add/ subtract from each pixel (values -255 to 255)
Adjust Blue - method = 18 , amount = how much blue to add/ subtract from each pixel (values -255 to 255)
Adjust Brightness - method = 19 , amount = how much brightness to add/ subtract from each pixel (values -255 to 255)
Adjust Contrast - method = 24 , amount = how much contrast to add/ subtract from each pixel (values -100 to 200) 0 leaves the image untouched
Adjust Saturation - method = 25 , amount = how much saturation to add/ subtract from each pixel (values -100 to 200) 0 leaves the image untouched
Rotate - method = 30 , amount = degrees, rotates the whole image by the amount requested, puts black into areas that come from outside the frame. (0 - 360)
Flipping the video horizontally and / or vertically
To flip the video and achieve a mirror effect, you can use the Flip() method. Note that Flipping the video actually changes the pixels of the frame in memory and any operation that follows including ShowVideo will be affected. The Flip(TrackObj, Horizontally, Vertically) method takes 3 argument:
TrackObj - The instance number returned from New().
Horizontally - 1 or 0 . 1 to flip horizontally, 0 not to flip horizontally.
Vertically - 1 or 0 . 1 to flip vertically, 0 not to flip vertically.
Recording a QuickTime Movie
To record a QuickTime Movie, use the Record() method. The Record( TrackObj, FileName, Duration, RecordSound, RecordVideo) takes 5 arguments:
TrackObj - The instance number returned from New().
FileName - a string containing the full path name of the file you wish to create. If the file exists it will be overwritten, if it does not, it will be created. If you pass a question mark, ("?") a "Save dialog box" will be presented to choose the file.
Duration - a number in seconds of the duration of the recording. Please be advised that everything else stops while you are recording, if you specify a duration, however the frame rate and smoothness of the recording is greatest. If you specify 0 as the duration, you can continue doing things while recording, including tracking the video and displaying it, then you stop the recording using StopRecord()
RecordSound- 1 Yes include the sound in the movie, 0 don't include the sound.
RecordVideo- 1 Yes include the video in the movie, 0 don't include the video.
The compression, frame rate, data rate , image quality and attributes can be set using the VideoSetting() method that opens the Video Settings Dialog box, or by using SetCompression()
To Stop recording use the StopRecord() method. The StopRecord(TrackObj) method takes 1 argument:
TrackObj - The instance number returned from New().
Note that you do not need to call StopRecord() if you have specified a duration in the Record() , only if you specified 0.
Getting the list of available compression codecs
To get the list of all available compression codecs use the GetCompressionList() method. This is useful for selecting a codec for recording movies as you need to specify the codec by its place in the list. the GetCompressionList(TrackObj) method takes one argument
TrackObj - The instance number returned from New().
GetCompressionList() returns a list of available codecs [codec name, codec name ,codec name ...] the number of items in the list is the number ov available codecs.
Getting the current compression settings
To get the current compression settings use the GetCompression()method. The GetCompression(TrackObj) takes one argument
TrackObj - The instance number returned from New().
GetCompression() returnds a list containing 5 items:[CodecNo, colorDepth , spatialQuality temporalQuality ,keyFrameRate ]
CodecNo. - the number in the list , of the codec that is currently in use. Note that the order of the list my be different than that of the menu in the setting dialog box (which is alphabetical)
colorDepth - the color depth in bits per pixel of the current compression this will be 1,8,16,24 , 32, numbers above 32 are gray levels.
spatialQuality - a number defining the spatial quality of the compression, this changes from codec to codec .
temporalQuality - a number defining the temporal quality of the compression, this changes from codec to codec .
keyFrameRate - a numbe defining the rate of the key frames, not all codeks have this attribute.
Setting the current compression settings
To get the current compression settings use the SetCompression()method. Note that changing the compression settings influences not only the recording of movies but also the preview on screen and all tracking. You might want to change the compression settings just before you start recording a movie and then revert to the original settings when you are done. The SetCompression(TrackObj) takes two arguments
TrackObj - The instance number returned from New().
settingsList - a list containing 5 items:[CodecNo, colorDepth , spatialQuality temporalQuality ,keyFrameRate ]
CodecNo. - the number in the list , of the codec that is to be used. Note that the order of the codec list my be different than that of the menu in the setting dialog box (which is alphabetical)
colorDepth - the color depth in bits per pixel of the compression, this will be 1,8,16,24 , 32, numbers above 32 are gray levels.
spatialQuality - a number defining the spatial quality of the compression, this changes from codec to codec .
temporalQuality - a number defining the temporal quality of the compression, this changes from codec to codec .
keyFrameRate - a numbe defining the rate of the key frames, not all codeks have this attribute.
note that the return value list of GetCompression() is identical to the settingList for GetCompression. This makes it easy to get the settings, store them and later pass them back.
Saving video settings for future use
Sometimes it is useful to save the current settings of the video including source, compression, image and any other setting that you set with the Video Settings dialog box for use in a future time, without having to go through the menus and dialog boxes to set them. In this case you can use the GetVideoSettings() and SetVideoSettings()
GetVideoSettings() gets the current video settings . GetVideoSettings(TrackObj) takes one parameter:
TrackObj - The instance number returned from New().
GetVideoSettings() returns a list, this list is the combination of all the video settings, you can save this list for a future time.
SetVideoSettings() Sets the video settings . SetVideoSettings(TrackObj,settings) takes two parameters:
TrackObj - The instance number returned from New().
settings - a list that was returned from GetVideoSettings()
Saving Sound settings for future use
Sometimes it is useful to save the current settings of the sound including source, compression, volume and any other setting that you set with the Sound Settings dialog box for use in a future time, without having to go through the menus and dialog boxes to set them. In this case you can use the GetSoundSettings() and SetSoundSettings()
GetSoundSettings() gets the current video settings . GetSoundSettings(TrackObj) takes one parameter:
TrackObj - The instance number returned from New().
GetSoundSettings() returns a list, this integer is the combination of all the sound settings, you can save this number for a future time.
SetSoundSettings() Sets the current Sound settings . SetSoundSettings(TrackObj, settings) takes two parameters:
TrackObj - The instance number returned from New().
settings - a list that was returned from GetSoundSettings()