8

Once upon a time, LEGO made a digital camera for the LEGO Studios and Mindstorms line. Internally it's an old USB Logitech camera repackaged in a LEGO housing.

enter image description here

It could also be used with the old LEGO Mindstorms software, to do some very weak video recognition when connected to a PC.

Fast forward some years, and Mindstorms are much more powerful, and even have a USB port, which this camera can be attached to, as some people have done.

enter image description here

When used with ev3dev, it's even possible to take some low-res pictures with it using a CLI tool like fswebcam.

However, I'd like to use it as a webcam, and capture a constant video stream from it, so I can use it in competitions where only official LEGO parts are allowed. Seems easy enough, but I've so far been unsuccessful.

It seems that OpenCV doesn't support the camera, because it uses an unusual pixel format encoding. Has anyone found a good solution for capturing a constant video stream? Something better than repeatedly calling fswebcam and parsing the output file (which would be unnecessarily slow).

3
  • Can you verify which model of Logitech camera is inside? If so you may be able to find archived drivers for it and see if they work. Also, what operating system are you running? I have had pretty good luck with Windows backwards compatibility.
    – JohnnyB
    Jul 23 '19 at 3:28
  • @JohnnyB In order to run on the brick, it would need to be compatible with an OS the brick can run, like the ARM-based Linux of ev3dev. Any old drivers for the "046d:0850 Logitech, Inc. QuickCam Web" wouldn't help. Jul 23 '19 at 3:31
  • So you want to run it directly from the brick? I didn't catch that part...
    – JohnnyB
    Jul 23 '19 at 3:46
2

Since I'm no software engineer my solution would be to retrofit the insides with known compatible hardware. Cheating? Maybe... but it isn't like the original hardware inside was actually Lego to begin with. The mention of potentially using "compatible software" would seem to be already stepping out of bounds with "only official Lego parts", since it didn't come packaged with it. So...

2

Fswebcam on ev3dev should already be using a v4l2 API backed by a v4l2 compatible driver.

The first thing I would look at is v4l-info to understand the pixel formats supported.

Next, I would try ev3dev OpenCV with a known good webcam - if it fails OpenCV may just be built without webcam support.

If OpenCV works with other webcams and v4l-info shows the info, you may have to patch OpenCV to understand the pixel format. Potentially you could patch the Lego camera driver to speak a format OpenCV already understands. With either approach you could do the development and testing on a desktop (might be faster than building OpenCV from source on ARM9)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.