[comp.graphics] Filtering 3.5 MHz color signal

gwpoulos@athena.mit.edu (George W. Poulos (aka Cpt. Caveman)) (06/07/91)

--
George W. Poulos *Ad hoc, ad loc,   - Jeremy  *jiffy pop, nuclear 
      aka	 *and quid pro quo.   Hillary *fission, i know  
    Captain      *So little time.     Boob    *there's a connection 
Caaavemaaaaaan!! *So much to know.    PhD.    *...there must be...

gwpoulos@athena.mit.edu (George W. Poulos (aka Cpt. Caveman)) (06/07/91)

OK, let's try this again.
Hi I have a question on filtering out the 'herringbone' pattern that
appears on images when I use a b/w frame grabber to digitize the video
signal given by my (color) camcorder.  I know that the color signal
frequency is ~3.5 MHz, and I built a trap filter tuned to that
frequency (It works OK).  But I was wondering if there was any program
or algorithm for doing this _in software_.  Any help would be
appreciated. 

--
George W. Poulos *Ad hoc, ad loc,   - Jeremy  *jiffy pop, nuclear 
      aka	 *and quid pro quo.   Hillary *fission, i know  
    Captain      *So little time.     Boob    *there's a connection 
Caaavemaaaaaan!! *So much to know.    PhD.    *...there must be...

dave@imax.com (Dave Martindale) (06/08/91)

In article <1991Jun7.033634.27095@athena.mit.edu> gwpoulos@athena.mit.edu (George W. Poulos (aka Cpt. Caveman)) writes:
>Hi I have a question on filtering out the 'herringbone' pattern that
>appears on images when I use a b/w frame grabber to digitize the video
>signal given by my (color) camcorder.  I know that the color signal
>frequency is ~3.5 MHz, and I built a trap filter tuned to that
>frequency (It works OK).  But I was wondering if there was any program
>or algorithm for doing this _in software_.

For NTSC, the frequency is 3579545 Hz, +- 10 Hz.

Yes, you could build a digital notch filter.  Dig out one of the
standard texts on digital signal processing, and look up FIR
(finite impulse response) filters.  Basically, each pixel in the
filtered image will be a weighted average of some span of pixels
extending to the left and right of it on the same scanline.
The number of input pixels needed to calculate each output pixel
depends on the characteristics of the notch filter you want - how
narrow and deep the notch, how much ripple there is either side
of the notch.  But you can get just about any filter characteristics
you want if you're willing to do enough computation.

Also, how is your frame grabber's clock synchronized?  Does it just
free-run, or is it locked to horizontal sync or colour subcarrier
in some way?  If it's locked to sync and stable enough, you can
create a comb filter using the fact that the colour subcarrier phase
inverts from one scanline to the next.  Just average each pair of
adjacent scanlines together, and the subcarrier plus all of its
harmonics will disappear.  (Note that this applies to two adjacent
scanlines in the same *field*, if you have a frame digitizer).

This does cause a loss of vertical resolution, but avoids the loss
of horizontal resolution that the notch filter causes.  It also
results in a 1/2 pixel vertical shift of the image, but that doesn't
matter much for black&white.

If your frame grabber's sampling clock is stable enough, and if it
digitizes the colour burst as well as the visible portions of the
frame, you can actually extract *colour* images from the single-
channel frame grabber output.  The sampled colour burst lets you
maintain a digital "colour subcarrier oscillator" that is
phase-locked to the original, and you can demodulate the colour
signal, filter to separate the chrominance and luminance, and
then decode to get RGB.  All in software.

I've done this for the output of a digitizer where the sampling
clock was phase-locked to three times the subcarrier frequency.
That makes some of the decoding easier.  The filters I
used to separate luminance and chrominance are quite ugly, and
produce visible ringing in the picture.  But it does work.
Someday I'll play with it some more and improve it, but I haven't
touched it for about a year.

	Dave Martindale