Open WolfCanglong opened 1 year ago
On 4.5.3.20211228 .NET Framework 4.8 also works. I copied this version's DLL to the new version it can work. I feel that there is a problem with the new version of the DLL.
I have the same problem, can't open video files on .NET Framework 4.7.2, 4.8.0, 4.8.1. I tried OpenCvSharp4 versions from 4.5.1 to 4.7.0.
var _cap = new VideoCapture("D:\\test.mp4");
Console.WriteLine(_cap.IsOpened());
while (true)
{
var frame = new Mat();
_cap.Read(frame);
if (frame.Empty())
{
Console.WriteLine("ERROR! blank frame grabbed");
break;
}
Cv2.ImShow("test", frame);
Cv2.WaitKey(1);
}
I have the same problem, can't open video files on .NET Framework 4.7.2, 4.8.0, 4.8.1. I tried OpenCvSharp4 versions from 4.5.1 to 4.7.0.
var _cap = new VideoCapture("D:\\test.mp4"); Console.WriteLine(_cap.IsOpened()); while (true) { var frame = new Mat(); _cap.Read(frame); if (frame.Empty()) { Console.WriteLine("ERROR! blank frame grabbed"); break; } Cv2.ImShow("test", frame); Cv2.WaitKey(1); }
新版DLL有问题,用我说的那个版本(nuget里面相关的全都要改)重新生成就行,或者建个新工程把生成的DLL拷到程序目录
I have the same problem, can't open video files on .NET Framework 4.7.2, 4.8.0, 4.8.1. I tried OpenCvSharp4 versions from 4.5.1 to 4.7.0.
var _cap = new VideoCapture("D:\\test.mp4"); Console.WriteLine(_cap.IsOpened()); while (true) { var frame = new Mat(); _cap.Read(frame); if (frame.Empty()) { Console.WriteLine("ERROR! blank frame grabbed"); break; } Cv2.ImShow("test", frame); Cv2.WaitKey(1); }
新版DLL有问题,用我说的那个版本(nuget里面相关的全都要改)重新生成就行,或者建个新工程把生成的DLL拷到程序目录
多谢,我找到问题了。 32位的dll有问题64位的正常,构建选择里把any cpu换成x64,32位优先去掉,这样最新版的库就可以在.net framework 4.8.1下正常使用了。
Is there any plan to fix this issue? It is still a problem with 4.8.0.20230708
Summary of your issue
I downloaded this example https://github.com/shimat/opencvsharp_samples/ BgSubtractorMOG contains code examples for opening videos. SamplesCore can open video normally using .NET6, but SamplesLegacy using .NET Framework 4.8 cannot open video. I tested other similar codes and it works fine in .NET6, but it doesn't work in .NET Framework 4.8 no matter it's local file or RTMP stream.
Environment
win11 vs2022
What did you do when you faced the problem?
https://github.com/shimat/opencvsharp_samples/ run SamplesCore, 2 BgSubtractorMOG, OK run SamplesLegacy, 2 BgSubtractorMOG, can't work
Example code:
Output:
.NET Framework 4.8
The window flashes by, and the command line returns to the selection menu
.NET 6
work well
What did you intend to be?
.NET Framework 4.8 project can open video