eduramiba / webcam-capture-driver-native

Native driver for Webcam Capture API
26 stars 8 forks source link

Can't find any webcams on Windows #23

Closed s-predybailo closed 5 months ago

s-predybailo commented 7 months ago

Hello! I have a question, not an issue. It works fine on my Mac, but can't find any webcams on Windows 11 laptop or desktop What am I doing wrong?

PXL_20240423_155855627~2.jpg

eduramiba commented 7 months ago

Hi,

For Mac, the dylib is embedded in the jar. For Windows, make sure to copy the DLLs in https://github.com/eduramiba/webcam-capture-driver-native/tree/master/natives/x64 in your java program library path so they can be properly loaded.

s-predybailo commented 7 months ago

Thanks a lot!

Have you ever encountered a problem when the camera image is partially broken? In my case, this occurs if the camera is running for a while (about 15 minutes), and then I take a picture. I am attaching an example. The webcam itself is definitely fine.

If you are interested, I display the preview in a resolution of 640x480, and before the picture I close the camera, change the resolution to the maximum available and open the camera again. This picture was taken with macOS. There are 5 cameras connected at the same time, but only one camera is open at the time of photographing. If I restart the program, then everything gets fine for a while.

eduramiba commented 7 months ago

I have not tried it changing resolution, but will verify. Could you make sure your image handling adapts correctly to image size changes?

s-predybailo commented 7 months ago

Changing the resolution works correctly, the pictures are saved in the right size, I have checked this many times on different cameras and resolutions. Perhaps I misunderstood you. If you can suggest a verification method, I will definitely check it. So far, I suspect that the problem lies in the use of a large number of cameras. But as I said, when shooting, I close all the cameras and open each one in turn, changing the resolution to take a picture. This approach minimizes the size of the real-time image stream, but allows you to take photos with maximum resolution. In theory, this should not lead to stream overflow.

Also I have tried implement dlls and run it again, but I still have no cameras

if( SystemInfo.isWindows ) {
            System.out.println("Loading dll..");
            System.load("C:\\Users\\user\\development\\gitrepos\\fitframe\\src\\native\\x64\\CaptureManager.dll");
            System.load("C:\\Users\\user\\development\\gitrepos\\fitframe\\src\\native\\x64\\CaptureManagerNativeProxy.dll");
            System.out.println("Loading finished.");
            Webcam.setDriver(new NativeDriver());
        }

        if (Webcam.getWebcams().isEmpty()) {
            System.out.println("No webcams detected.");
            return;
        }
OUTPUT
Loading dll..
Loading finished.
No webcams detected.