Aligning dual cameras

dbritta1 wrote on 10/7/2007, 6:48 AM
Dear Folks,

I am using Vegas to combine dual camera videos into a single wide video. Since the cameras are rarely perfectly vertically and horizontally aligned, I must use compositing and create masks for the left and right videos, size and shift the masks, size and shift the videos for each clip. This requires a lot of calculations and manual entering of the height, width, and center values for both mask tracks and both video tracks for each clip. This is very painful when there are many hundreds of clips in a project.

I need to create a script that after selecting a video clip track, will pop up a dialog to enter a single X and Y shift values, then after performing the appropriate calculations, will write the height, width, and center values for both mask tracks and both video tracks.

Any suggestions or sample scripts I can start with to create the dual camera align script?

I can write the code to do the necessary calculations, C# math functions should be the same as C++ math.

Useful samples would show how to:
1) find both mask and both video tracks for a clip, either by selecting a clip track, or by using the timeline cursor
2) create a pop up dialog to enter integer shift values
3) write width, height, and center values to the Pan/Crop events.

Links to appropriate forum topics or sample scripts would be very helpful.

Thanks,
Dennis

Comments

dbritta1 wrote on 10/7/2007, 11:16 PM
Dear Folks,

After reviewing many forum topics and .cs script samples, I may have answers to the first two questions.

However I have some additional advanced questions:

4) How can you access the pixel RGB values for a frame in a video clip?

This would be useful for generating histograms and using auto-correlation functions to allow automatic alignment of video tracks.
A messy solution might be to write a temp image file for a particular frame, and access the image file. Direct access to the frame pixels would be much cleaner solution.

5) How can you access the data values in an audio clip?

Obviously, the waveform display in audio tracks is doing this.
This would be useful for finding click spikes in the audio tracks, and using auto-correlation functions to allow automatic time alignment of clips.

It may be possible to completely automate dual camera alignment .

Thanks,
Dennis
Teetow wrote on 10/8/2007, 5:51 AM
Regarding #5, you can't. Vegas doesn't provide you with the raw data. I've been toying with the idea of implementing a WAV reader, to be able to do stuff like "strip silence" or "find peaks", but there might be some hiccups with Vegas locking access to the wave files etc.

If I ever do it, I'll give you an update.

(I'm assuming this goes for #4 as well)
dbritta1 wrote on 10/9/2007, 1:48 AM
Dear Teetow,

How unfortunate that you cannot directly access raw data.

I will proceed with the messy solution, and use temp image and audio files.

I understand why write access to the raw data might be dangerous, but read-only access would be safe and quite useful.

Dennis
Teetow wrote on 10/9/2007, 8:22 AM
Well, it's not that you can't, but rather that Vegas doesn't do it for you. As far as I know, there's nothing stopping you from reading the file yourself. The only showstopper would be generated content -- I can't see how one would access the RBGA data for the Solid Color or Text plugin output, for example.

Again, if I ever experiment with this, I'll post my findings on the forum.