How to properly add a Microsoft LifeCam into Java?

I’m looking for help with adding a Microsoft LifeCam into Java, I’ve attempted using the code found in the WPILib website, but it only worked temporarily. The code was:
import edu.wpi.cscore.MjpegServer;
import edu.wpi.cscore.UsbCamera;

// Creates UsbCamera and MjpegServer [1] and connects them
UsbCamera usbCamera = new UsbCamera(“USB Camera 0”, 0);
MjpegServer mjpegServer1 = new MjpegServer(“serve_USB Camera 0”, 1181);
mjpegServer1.setSource(usbCamera);

Any help would be greatly appreciated!

What do you mean that it only worked temporarily?

It had worked, but there were issues with another part of the code. When the camera was finally turned back on, the image was frozen.

The robot was fixed, the solution was just adding the camera server into the robot main.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.