Closed Speykious closed 3 years ago
Here is the full stderr log: dotnet-run-stderr.log
I think I found the problem. The first 2 webcam devices listed on my machine have the exact same name, which makes the program crash.
However, I only have one webcam. If I look into the output of v4l2-ctl --list-devices
, what I take from it is that the same webcam is accessible through both /dev/video0
and /dev/video1
.
Assuming 2 webcams cannot have the same name at all, my suggestion is to simply ignore duplicates.
I have the same issue on Manjaro Linux, my kernel's version is 5.10.68-1
[runtime] 2021-10-01 21:33:02 [error]: System.ArgumentException: The item Integrated Camera: Integrated C
[runtime] 2021-10-01 21:33:02 [error]: already exists in this FluentDropdown.
And for v4l2-ctl --list-devices
:
Integrated Camera: Integrated C (usb-0000:00:10.0-1):
/dev/video0
/dev/video1
I am able to run the app, but it does not seem to detect my camera. Any ideas @sr229 ?
I am able to run the app, but it does not seem to detect my camera. Any ideas @sr229 ?
What's the exact error you're getting?
@Speykious I'm not getting an error, it just shows nothing in the camera select dropdown. I had my USB webcam plugged in, and v4l2 detects the device.
Are you building against the latest commit?
Yep, I cloned the repo, and ran it from source.
Ok... What's the output of v4l2-ctl --list-devices
?
❯ v4l2-ctl --list-devices
Dummy video device (0x0000) (platform:v4l2loopback-000):
/dev/video0
USB2.0 PC CAMERA: USB2.0 PC CAM (usb-0000:04:00.3-2):
/dev/video1
/dev/video2
/dev/media0
The dummy camera is v4l2loopback
Here's the class handling the cameras on Linux if you guys plan on checking it out. https://github.com/vignetteapp/vignette/blob/master/Vignette.Camera/Platform/LinuxCameraManager.cs
@LeNitrous check PR #235, I've made one suggestive modification to it such that it indexes friendly names
I tried hard-coding the name of my camera device in LinuxCameraManager.cs
.
protected override IEnumerable<CameraInfo> EnumerateAllDevices()
{
yield return new CameraInfo("/sys/class/video4linux/video0/name", "/dev/video0");
}
This particular exception seems to have gone away, but there is a different one now:
Unhandled exception. System.TypeInitializationException: The type initializer for 'Emgu.CV.Util.VectorOfInt' threw an exception.
---> System.TypeInitializationException: The type initializer for 'Emgu.CV.CvInvoke' threw an exception.
---> System.DllNotFoundException: Unable to load shared library 'cvextern' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libcvextern: cannot open shared object file: No such file or directory
I guess that it's related to a shared library named libcvextern.so
- however, an EmguCV wiki page says that it should be built from source on Linux, but I don't want to compile it right now (I can try tomorrow though, if it's needed).
Regarding the multiple camera devices issue - I suggest writing an algorithm that maps device filenames (such as /dev/camera0
) to their names in the system (like Integrated Camera
) and deletes keys that have duplicate values.
I can try doing this, just tell me if it's necessary.
I tried hard-coding the name of my camera device in
LinuxCameraManager.cs
.protected override IEnumerable<CameraInfo> EnumerateAllDevices() { yield return new CameraInfo("/sys/class/video4linux/video0/name", "/dev/video0"); }
This particular exception seems to have gone away, but there is a different one now:
Unhandled exception. System.TypeInitializationException: The type initializer for 'Emgu.CV.Util.VectorOfInt' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'cvextern' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libcvextern: cannot open shared object file: No such file or directory
I guess that it's related to a shared library named
libcvextern.so
- however, an EmguCV wiki page says that it should be built from source on Linux, but I don't want to compile it right now (I can try tomorrow though, if it's needed).Regarding the multiple camera devices issue - I suggest writing an algorithm that maps device filenames (such as
/dev/camera0
) to their names in the system (likeIntegrated Camera
) and deletes keys that have duplicate values. I can try doing this, just tell me if it's necessary.
Sorry to not have mentioned that in a previous issue. This is a known bug: on Linux, EmguCV places its libcvextern.so
runtime under bin/Debug/net5.0/runtimes/ubuntu.20.04-x64/native/
after a dotnet build
, and then claims that it cannot find it.
To make sure that it works, you have to move this .so
to bin/Debug/net5.0/
(basically a couple directories back).
if the same error shows up after you've done that, then it's likely a dependency that libcvextern.so
needs.
You can check for its dependencies by doing ldd bin/Debug/net5.0/libcvextern.so
.
Something we've had at least twice is someone missing libgeotiff
(which can be downloaded from the Arch community repositories if you're on an Arch-based distro).
Sorry to not have mentioned that in a previous issue. This is a known bug: on Linux, EmguCV places its
libcvextern.so
runtime underbin/Debug/net5.0/runtimes/ubuntu.20.04-x64/native/
after adotnet build
, and then claims that it cannot find it.To make sure that it works, you have to move this
.so
tobin/Debug/net5.0/
(basically a couple directories back). if the same error shows up after you've done that, then it's likely a dependency thatlibcvextern.so
needs. You can check for its dependencies by doingldd bin/Debug/net5.0/libcvextern.so
. Something we've had at least twice is someone missinglibgeotiff
(which can be downloaded from the Arch community repositories if you're on an Arch-based distro).
After moving libcvextern.so
and installing libgeotiff
, the application is working. Thank you!
I assume this was fixed already or does @adryzz need to do something more about this?
whoops, clicked close issue on accident.
Didn't test this branch yet so I'll be doing it today.
I assume this was fixed already or does @adryzz need to do something more about this?
The specific bug is fixed on PR #242, which hasn't been merged yet. Though I still can't figure out anything for the "can't open camera by index" issue.
Closing as debut is now released.
I am getting this error when trying to run Vignette with
dotnet run -p Vignette.Desktop
. OS: Arch Linux, latest kernel