inspirit / PS3EYEDriver

PS3EYE Camera Driver for OSX and Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compressed In-Camera JPEG Stream

KoxaKoxama opened this issue · comments

PS3Eye was quite popular thanks to the RAW support, but unfortunately it takes a lot of bandwidth which limits the number of simultaneously connected cameras (in RAW it is possible to work with 6-10 cameras).
Luckily OV538 has a built in encoder for image compression, PS3Eye is most often used for tracking bright blobs and with custom gamma curve we can get simple in-camera thresholding, combining this with in-camera jpeg image compression we can significantly reduce the amount of data and (in theory) connect more than 100 cameras!

I managed to find a working combination of registers for compessed stream (in-camera YUV -> JPG) and captured it in a Wireshark and mannualy removed all 12-byte headers, jpg image streamed with JFIF header and it's perfectly working at 60fps.
Unfortunately I can't figure out how to force saving compressed images because frame_size size is static, but here we have dynamically changing size because of the jpeg compression. I have no idea how to get compressed stream and save it, libusb have something like actual_length that returns real transfer buffer size, but then again I have no idea how to make it work.

@inspirit perhaps you could help since you wrote the bulk of the libusb transfer code

ohh I'm really surprised this project is still used :) sorry but i'm afraid i lost track of whats going on here long time ago.
what i can think of is try to look for some tags indicating end of one image and start of another, as you pointed there are jpeg headers so there should be some registers as well

perhaps this is the longest living usb camera, almost 15 years!
maybe I should just remove most of the code and rely on the JFIF header, it completely separates each frame

every compressed frame is marked in stream with a new jpg header FF D8 FF E0 00 10 4A 46 49 46 (last 4 bytes is JFIF) and then each 2048 bytes is splitted with same 12-byte UVC-header, it makes sense to just srick to the new JFIF header and get frames that way but I wish I could know how to write that :)