interlacing: this is the question!

Support and queries relating to all previous versions of ZoneMinder
Locked
alcool
Posts: 5
Joined: Tue Jul 31, 2007 9:18 am

interlacing: this is the question!

Post by alcool »

hi,
i have a simple (I believed...) question: i want to record a car in movement on the street (at least 50 Km/h)... but the image is always afflicted by a blurring and there are more annoying black line (probably the result of a interlacing)... I have read on some post that is possible setting the options "ZM_CAPTURES_PER_FRAME" for reducind this effect... but I do not succeed to do good it! which type of setting I can to do?
User avatar
Lee Sharp
Posts: 1069
Joined: Sat Mar 31, 2007 9:18 pm
Location: Houston, TX

Post by Lee Sharp »

The only way to remove interlacing is to capture at a resolution without it. Are you using 320 x 240? As to the blur, that is the cam. What hardware are you using to capture?
alcool
Posts: 5
Joined: Tue Jul 31, 2007 9:18 am

Post by alcool »

Lee Sharp wrote:The only way to remove interlacing is to capture at a resolution without it.
...how I can do?
Lee Sharp wrote:Are you using 320 x 240?
...I would like use the more hi resolution (640x480 or 704x576)

help...
...how I can do?
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

The only way to remove interlacing in a cctv system is to capture at or below 320x240. The other option might be if you can find a progresive scan capture card and camera, if they exist, I'm sure they are pricey.
Your other option would be to use an IP camera possibly.

Other than that there are no other options, it's the nature of how cctv works.
mebourne
Posts: 7
Joined: Wed Jul 04, 2007 9:16 am

Post by mebourne »

Ideally ZM would include deinterlacing filters which would help a lot. Unfortunately this is probably quite a bit of work. I've thought about it a couple of times but not looked into it yet.
User avatar
Lee Sharp
Posts: 1069
Joined: Sat Mar 31, 2007 9:18 pm
Location: Houston, TX

Post by Lee Sharp »

Consider how it would work at worst case, an IP cam.

1) Capture 2 jpegs.
2) Decode 2 jpegs.
3) Merge 2 bitmaps.
4) Analyse merged bitmap, and hope artifact isn't seen as motion.
5) Encode jepg.
6) Save jpeg.

Now do it 30 times a second. Oh, and times 8 cameras.
mebourne
Posts: 7
Joined: Wed Jul 04, 2007 9:16 am

Post by mebourne »

Deinterlacing is on playback of course, not capture.

So for 8 cameras you need to do:

1) Capture image from camera
2) That's it

This happens already, so I don't think there'll be any problem here.

The only capture modification I'd make would be to capture odd/even fields as separate jpegs to prevent interference between them with the lossy compression.
darkpaw
Posts: 166
Joined: Thu Apr 26, 2007 2:35 am

record vs. playback

Post by darkpaw »

There's a potential problem doing it that way. If your capture rate isn't high enough, you will have only one half of the interlace and it can't be merged with the other half.

I have had lots of captures with motion too fast to be grabbed in sequential frames (at 640x480). So if I look at a JPG that has the "lined" part that is in motion, and then the next JPG captured immediately after it, they are not part of the same fps, they are in next frames, and the object has already moved from that position.

On one camera this would be easy, just crank the capture rate up to 30fps and then there's a good chance that you could deinterlace the frames immediately following each other. But on a 1.6 GHz machine with 3 cameras on it, I can't capture any higher than about 12fps or I start getting dropped frames because my CPU isn't fast enough to keep up when analyzing with zma.
mebourne
Posts: 7
Joined: Wed Jul 04, 2007 9:16 am

Post by mebourne »

Sure, if you don't capture at full frame rate deinterlacing isn't particularly useful. My cameras capture at 10fps until motion is detected, then full frame rate. Given that not all cameras trigger together you can probably get quite a few cameras on any modern box before there's any trouble. Besides, computers get faster all the time so what's possible with current hardware now will be easy with future hardware.
User avatar
Lee Sharp
Posts: 1069
Joined: Sat Mar 31, 2007 9:18 pm
Location: Houston, TX

Post by Lee Sharp »

mebourne wrote:Besides, computers get faster all the time so what's possible with current hardware now will be easy with future hardware.
And this is how we got Vista!

Fight Bloat! Code on a 386! :twisted:
KeithB
Posts: 77
Joined: Thu Jun 07, 2007 4:23 pm
Location: uk

Post by KeithB »

Surely IP cameras dont have deinterlace problems. Some are even HDTV so obviously progressive. To encode it as PAL/NTSC then decode it in the very next circuit, in the same box, for no reason would be seriously sloppy design.
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

just to resurect this, do any of us have any suggestions for using bttv and above half vertical res?
The only reason i ask is cos my own setup at home has a nice camera on it and id like to run at 720x576.

James
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Post by kevin_robson »

I've no answers as such.
But I've recently started using mythtv, which has build in support for deinterlacing. Waching the football the other night it seems quite effective.

I dont know any more than that, but perhaps there is someone out there technical enough to work out how it does it and apply it to ZM?

Just a thought.
User avatar
Lee Sharp
Posts: 1069
Joined: Sat Mar 31, 2007 9:18 pm
Location: Houston, TX

Post by Lee Sharp »

This keeps coming up... Of course my partner keeps asking the same thing, and he still doesn't get it either. ;)

So first, start here. http://www.jkor.com/peter/tvlines.html That should give you a nice headache. :) But the point is this... The composite video standard requires alternating black lines. To give a clear picture the odd lines are black in one frame, and the even lines are black in the other. Now black in analog video is simply the absence of light... That means any color overwrites it. So if I combine line 1 and 2, the black is completely covered by the image. This is why 320 x 240 looks clean.

Now deinterlacing is a hack... On old analog TVs it was moot as the image from the last frame is still slightly glowing when you paint the next frame. This does not work in digital, so they had to develope a few hacks. Mostly it is done with frame averaging. This means every frame is the current frame, and the frame immediately prior layered on top. Another method is frame stretching. a frame is captured at 640 x 240, and all horizontal lines are doubled, so you get a 640 x 480 pic. Both hacks have issues. In the first one, you have the most data, but a different times. This can give a comb look to fast moving images. There is a decomb filter just to address this on DVDs. The other method can look better with fast moving images, but it has less data, while taking up just as much space and bandwidth.

A possible solution... I had a thought.... What if we could capture at 640 x 240, and store at 640 x 240, but display and export at 640 x 480? Lots of advantages here is space, quality, processing time to analyze and store, and best of all, it would be someone else doing it! ;) In case you didn't know, my coding skills stink... :)
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

I use interpolation to achieve this live an playback in zm4ms, but d1 is better.
De-interlacing is possible and there are various ways to do it. and i do understand the issues but even 2 cif has res issues.
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
Locked