Forums

Full Version: Issue with ApplyMask
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

BReeves

This may be frutle but thought I would try. Having a random problem with loading a bitmap into VLApplyMask and displaying it using VLDSImageDisplay. My configuration is as follows.

VLDSCapture->VLMirror->VLApplyMask->VLGenericFilter->VLDraw->VLDSImageDisplay

I am changing the mask image then capturing a bitmap with VLGenericFilter. Fairly straight forward code..
Code:
if(DoingOverlay) {
            sprintf(backfile, "%s%02d%d.bmp", GrabForm->BorderPath, GrabForm->BorderNumber,ShotCount);
            VLApplyMask1->Picture->LoadFromFile(backfile); // this is where it barfs
        }
        //Have Delay here as I am using a timer to cycle through 4 shots
       VLGenericFilter1->Enabled = true; // Grab the frame

The attached image shows what happens and it's random, sometimes it works great but mostly it barfs. I had the issue with VideoLab 4.5 and upgrading to 5.0.1 didn't fix it. Hoping looking at the image will give you a hint as what is going on and if I can do anything to fix it. I know it's old but I'm stuck with it and have to make it work.

[attachment=29]
[attachment=30]

BReeves

Think I might have figured out the reason it barfs. I'm suspecting the process of applying the mask isn't synced with the incoming video. IF the mask is applied when the video frame is changing it barfs. This would account for the randomness of the problem. My solution is to stop the video capture, VLDSCapture->Enabled = false; apply the mask then re-enable the capture. So far I have not been able to get it to fail using this trick.

I really do not like the frame flashing black for the time it takes to load the mask. Would be nice if Video Lab would provide a way to sync the two controls but I don't know how to do it.

Code:
if(DoingOverlay) {
            VLDSCapture->Enabled = false;
            sprintf(backfile, "%s%02d%d.bmp", GrabForm->BorderPath, GrabForm->BorderNumber,ShotCount);
            VLApplyMask1->Picture->LoadFromFile(backfile); // this is where it barfs
            VLDSCapture->Enabled = true;
        }
        //Have Delay here as I am using a timer to cycle through 4 shots
       VLGenericFilter1->Enabled = true; // Grab the frame

Dave

Just an idea, haven't dealt with this myself.. what if you would change the mask from the VLGenericFilter OnProcessData event? This could also make it go really sick but worth a simple try perhaps.

Regards,
Dave

BReeves

Didn't think of that, just may work.. Will play with the idea and see what happens..

Nope, same problem, not synced and scrambles. Not really a big deal enable/disable works and can live with the glitch when it's changing.
Reference URL's