inspirit / PS3EYEDriver

PS3EYE Camera Driver for OSX and Windows
Other
316 stars 92 forks source link

Strange artifacts when using 75fps video #34

Open colejd opened 8 years ago

colejd commented 8 years ago

First off, thank you so so much for your work. It's been absolutely indispensable in a few of my projects.

I'm trying out the 75fps mode, and I've noticed some strange artifacts beyond the green and purple stripes. Please see here:

capture

There is a horizontal divide for these artifacts halfway down the image. @rovarma, any thoughts?

rovarma commented 8 years ago

I noticed this myself a few times. I'm not sure what's causing it yet; would need to investigate further.

It looks like the upper half (perhaps from an older frame?) is getting super-imposed on the bottom half of the frame, which is also why the bottom half is suddenly "darker".

Sidenote: I noticed the BGR -> RGB conversion on your screenshot. I'm not sure what you're using it for, but FYI the driver now supports outputting directly to RGB. You can specify the output format through the init call.

colejd commented 8 years ago

Oh yes, I appreciate you pointing that out. I actually receive the camera data as BGR since I'm piping it directly into OpenCV, but then it has to be converted back to RGB for OpenFrameworks to show the data once I'm done with it. For whatever reason, I can't tell my FBOs to use GL_BGR or it'll default to GL_RGBA. Super weird.

I've seen those green and purple bits before. It happened to me when I was working with writing my own YUV to RGB decoder and I had the byte order wrong. Perhaps the algorithm is just barely off in some way? Do we know that the camera is using a standard Bayer encoding and not some weird Sony thing?

rovarma commented 8 years ago

I wouldn't exclude the possibility I've gotten the Bayer -> BGR conversion wrong, but I'm not sure if that's the problem here since the problem does not show itself at < 75 FPS. Plus the fact that data from the top half of the image is "leaking" to the bottom image feels like something different.

I've also tried using opencv's built-in Bayer -> BGR code (which I assume to be well tested and working...) and I see the same problem there.

The output of the camera is the standard Bayer encoding, but shifted left one place. See https://github.com/rovarma/PS3EYEDriver/blob/master/src/ps3eye.cpp#L504