|
|
| Author |
Message |
twesthoff
Joined: 17 Mar 2006
Posts: 199
Location: Fredericksburg, VA
|
|
Posted: 03 January 2010, 15:59 PM Post subject: Simple NTSC video object tracking, I think |
|
|
Still no luck. I don't see the black rectangle where the video plays. I did click on the lower right where the showed a video movie trailer and that played fine. I went to the page where your previous tracking videos were and got the same negative results. Very strange... I'll try tomorrow from work and see what happens.
Tom W.
On 1/3/2010 12:13 AM, General wrote: |
|
| Back to top |
|
 |
GTBecker
Joined: 18 Jan 2006
Posts: 472
Location: Cape Coral
|
|
Posted: 03 January 2010, 17:18 PM Post subject: |
|
|
Yeah, something's weird. I just got a black box, too. You might try Go To Show Page and selecting it there, or search in Ustream for IRCam or GTBecker.
What intrigues me is that the dog's eyes seem to be pretty NIR retroreflective but cat's eyes aren't, at least in the few attempts I've made. That seems intuitively odd but, if that's true, maybe I can keep the cats from eating the dog's food and vv, afterall. |
|
| Back to top |
|
 |
twesthoff
Joined: 17 Mar 2006
Posts: 199
Location: Fredericksburg, VA
|
|
Posted: 03 January 2010, 18:26 PM Post subject: Simple NTSC video object tracking, I think |
|
|
Have you tried human eyes? Cats can see well in the dark which means they can use IR fairly well. Dogs can't see in the dark well, like us humans. So maybe the cat's eyes absorb the IR.
I can't get any content from the site to play except the advertisements.
Tom W.
On 1/3/2010 12:18 PM, General wrote: | Quote: | Yeah, something's weird. I just got a black box, too. You might try Go To Show Page and selecting it there, or search in Ustream for IRCam or GTBecker.
What intrigues me is that the dog's eyes seem to be pretty NIR reflective but cat's eyes aren't, at least in the few attempts I've made. That seems intuitively odd but, if that's true, maybe I can keep the cats from eating the dog's food and vv, afterall.
Tom
|
|
|
| Back to top |
|
 |
GTBecker
Joined: 18 Jan 2006
Posts: 472
Location: Cape Coral
|
|
Posted: 04 January 2010, 3:23 AM Post subject: |
|
|
Here's what I've settled on. The hardware is simple, if you disregard the video camera module mods which exercised the likely limits of my patience with small things and a soldering iron - although I will reluctantly do them at least one more time when I build another prototype of my project.
Standard video signals are AC-coupled to minimize the visible effects of differing ground potentials. To reliably sense an image peak with a comparator, DC-coupling is much easier so the camera's output blocking capacitor is bypassed. Standard interlaced horizontal fields also make the timing more complex so the camera is modified to produce non-interlaced 263-line fields, and I added serial shutter speed control to keep the camera out of saturation. Those mods are on the Sparkfun forum Projects section http://forum.sparkfun.com/viewtopic.php?t=18862 . The LM712 comparator is unusual in that the inputs are self-biased at ~2.4v and have an impedance of ~3k; the inverting input (the threshold voltage) is set closer to the DC video black level by pulling it down with ~12k.
The ZX-24 code to produce X/Y and the object's center-to-peak vector is, in part:
| Code: | const Timer1Frequency as single = 14.7456e6 / 8.0 ' register.TimerSpeed1 = 2
const HscanRate as single = 4.5e6 / 286.0 ' Hertz; 286.0 = NTSC standard audio carrier divisor
const HscanPeriod as single = 1.0 / HscanRate ' seconds
const FieldLineCount as single = 263.0 ' non-interlaced
const FieldRate as single = HscanRate / FieldLineCount
const OneFieldTimerCount as UnsignedInteger = cuint(Timer1Frequency / FieldRate)
const VertBlankingPeriodLines as integer = 20
const TopImageLine as integer = VertBlankingPeriodLines
const BottomImageLine as integer = cint(FieldLineCount)
const ImageHeightLines as integer = BottomImageLine - TopImageLine
const CenterScreen as single = csng(ImageHeightLines) / 2.0
const CenterScreenFix as single = fix(CenterScreen)
const Aspect as single = 4.0 / 3.0
const HorizontalAxisLines as single = (FieldLineCount * Aspect)
' H blanking period = ~11.0uS of 63.6uS line; front porch = 1.4uS; /Hsync, backporch = 4.6uS each
const Frontporch as single = 1.4e-6 ' seconds
const Hsync as single = 4.6e-6
const Backporch as single = 4.6e-6
const HBlankingPeriod as single = Frontporch + Hsync + Backporch ' seconds
const HBlankingLines as single = HBlankingPeriod / HscanPeriod ' fractional lines
const HBlankingFactor as single = HscanPeriod / (HscanPeriod - HBlankingPeriod)
' the shutter speed is dithered around the value required to keep the image peak below saturation
do
call SetCameraShutter(cbyte(ShutterSpeed))
ShutterSpeed = min(255, ShutterSpeed + 4)
call InputCaptureEx(pinVideoPeakDelay, uiPeakDelay, 1, 0, 1)
loop until (uiPeakDelay < OneFieldTimerCount) ' ignore if peak delay appears longer than one field
ShutterSpeed = max(0, ShutterSpeed - 8)
PeakDelay = csng(uiPeakDelay) / Timer1Frequency ' seconds
' calc point X/Y; 0,0 is center field
Scanline = HscanRate * (PeakDelay) - VertBlankingPeriodLines ' lines
NewFraction = min(0.999, max(0.0, (fraction(Scanline) - HBlankingLines) * HBlankingFactor )) ' remove blanking, rescale
Scanline = fix(Scanline) + NewFraction ' scanline now n.00 to n.99 edge-to-edge
X = HorizontalAxisLines * (NewFraction - 0.5) ' lines from center screen
Y = -(fix(Scanline) - CenterScreenFix) ' lines from center screen
' calc vector from center screen; move camera along vector to center the object
VectorAngle = atn2(X, Y) ' radians
VectorLength = sqr(X * X + Y * Y) ' lines
|
This method finds only the largest single peak in each field, so it will lose track of an object if something brighter appears, but additional logic might allow tracking multiple objects of differing brightness.
Last edited by GTBecker on 05 January 2010, 13:16 PM; edited 2 times in total |
|
| Back to top |
|
 |
GTBecker
Joined: 18 Jan 2006
Posts: 472
Location: Cape Coral
|
|
Posted: 04 January 2010, 4:21 AM Post subject: Re: Simple NTSC video object tracking, I think |
|
|
| twesthoff wrote: | | ... Cats can see well in the dark which means they can use IR fairly well.... maybe the cat's eyes absorb the IR. |
According to one casual source, cats see blue and green well, but can't see red well. http://www.sewanee.edu/chem/chem&art/Detail_Pages/ColorProjects_2003/Early/index.htm This site seems to support that suggestion: http://kittyshow.com/x_cat_vision_color.htm . I'd expect that poor red sensitivity would suggest that they are also poorly sensitive to NIR.
Cats' good night vision is apparently more likely due to the large pupil, a large numbers of retina receptors, and the reflective layer under the retina, the tapetum, which is what causes the reflection we see when their eyes are illuminated, making them some six times more sensitive than man.
This paper suggests that dogs have good night vision, too: http://www.ncbi.nlm.nih.gov/pmc/articles/PMC1171936/pdf/janat00209-0159.pdf .
In any event, cat's eyes do not reflect NIR well, my struggling uncooperative Maine Coon insists. |
|
| Back to top |
|
 |
twesthoff
Joined: 17 Mar 2006
Posts: 199
Location: Fredericksburg, VA
|
|
Posted: 04 January 2010, 12:16 PM Post subject: Simple NTSC video object tracking, I think |
|
|
Today at work the video worked perfectly. Different ISP, but used same browser (Firefox).
Looks like you got it working very well. I saw how it found the next brightest object when your dog stopped looking at the camera...
Great job. Thanks for sharing what you have done, I'm sure others will have more ideas on how to use it.
Tom W.
On 1/3/2010 12:18 PM, General wrote: | Quote: | Yeah, something's weird. I just got a black box, too. You might try Go To Show Page and selecting it there, or search in Ustream for IRCam or GTBecker.
What intrigues me is that the dog's eyes seem to be pretty NIR reflective but cat's eyes aren't, at least in the few attempts I've made. That seems intuitively odd but, if that's true, maybe I can keep the cats from eating the dog's food and vv, afterall.
Tom
|
|
|
| Back to top |
|
 |
twesthoff
Joined: 17 Mar 2006
Posts: 199
Location: Fredericksburg, VA
|
|
Posted: 04 January 2010, 12:40 PM Post subject: Simple NTSC video object tracking, I think |
|
|
As usual, you have researched the subject well. I was taking a guess. I should have Googled first.
Have you tried your circuit with visible light or slightly visible light? I could see using it to control a pan/tilt wildlife camera for sportsmen.
On 1/3/2010 11:21 PM, General wrote: | Quote: | twesthoff wrote: ... Cats can see well in the dark which means they can use IR fairly well.... maybe the cat's eyes absorb the IR.
According to one casual source, cats see blue and green well, but can't see red well. http://www.sewanee.edu/chem/chem&art/Detail_Pages/ColorProjects_2003/Early/index.htm This site seems to support that suggestion: http://kittyshow.com/x_cat_vision_color.htm . I'd expect that poor red sensitivity would suggest that they are also poorly sensitive to NIR.
Cats' good night vision is apparently more likely due to the large pupil, a large numbers of retina receptors, and the reflective layer under the retina, the tapetum, which is what causes the reflection we see when their eyes are illuminated, making them some six times more sensitive than man.
This paper suggests that dog's have good night vision, too: http://www.ncbi.nlm.nih.gov/pmc/articles/PMC1171936/pdf/janat00209-0159.pdf .
In any event, cat's eyes do not reflect NIR well, my struggling uncooperative Maine Coon insists.
Tom
|
|
|
| Back to top |
|
 |
GTBecker
Joined: 18 Jan 2006
Posts: 472
Location: Cape Coral
|
|
Posted: 05 January 2010, 13:33 PM Post subject: |
|
|
Yes, the camera is sold as a visible-light monochrome sensor, and it has no IR-cut filter as most color cameras or their lenses do. If I remove the NIR pass filter I added (just a pair of particular Rosco gels that, combined, are visibly opaque but essentially NIR transparent) from the lens, the camera sees visible light quite well - too well for my work.
I suspect that this method could steer a wildlife camera at night - at least in a clearing where there would be few other objects - with either visible or NIR illumination. Good idea. |
|
| Back to top |
|
 |
GTBecker
Joined: 18 Jan 2006
Posts: 472
Location: Cape Coral
|
|
Posted: 21 January 2010, 2:35 AM Post subject: |
|
|
I just took the tracking camera breadboard outside for the first time. It is far more sensitive than I anticipated.
At its longest shutter, ~1/63sec for NTSC, it is able to easily track Mars and - without the NIR filter on an f/2.2 12mm lens (a short telephoto for a 1/3" imager) - high aircraft at great distance, and amazingly, Rigel, the magnitude 0 star at the left foot of Orion. Tonight isn't a particularly good astronomical seeing night, either. This makes me think that this scheme might do well as a guide camera for a telescope mount drive, locking on the brightest point and keeping it there.
I get the circuit boards tomorrow so I should have photos of the complete camera assembly shortly.
Tom
OT, BTW: Ever seen the moon in IR? This was taken during a long lunar eclipse. Hot spots are presumed to be warm rock. http://apod.nasa.gov/apod/image/9701/lunarecl_msx.jpg |
|
| Back to top |
|
 |
GTBecker
Joined: 18 Jan 2006
Posts: 472
Location: Cape Coral
|
|
Posted: 23 January 2010, 1:46 AM Post subject: |
|
|
Here's the finished tracking camera assembly. The SPI interface to the master processor is the seven-pin header on the ZX-24n. Under that is Com1 and +5 for programming and serial out. I had some room left on the circuit board order, so I also made a Bluetooth module that hangs on the camera processor serial port for a freestanding application I have planned.
 |
|
| Back to top |
|
 |
|