Hi, I’m using CVB Version 13.01.006 (64 bit). When downloading it, the Tutorial-Folder doesn’t come with a Foundation\Videos Folder, so I can’t try the code presented here with an avi Path. Instead I’m trying to use the ClassicSwitch.emu File as device, but when running the code I get a System.IO.FileLoadException.
Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.IO;
using Stemmer.Cvb;
using Stemmer.Cvb.Driver;
using Stemmer.Cvb.Utilities;
using Stemmer.Cvb.Foundation;
namespace Test2
{
static class Program
{
static void Main()
{
var emuPath = Path.Combine(new { “C:\”, “Program Files”, “STEMMER IMAGING”, “Common Vision Blox”, “Tutorial”, “ClassicSwitch.emu” });
Console.WriteLine(emuPath);
Device newDevice = DeviceFactory.Open(emuPath);
IndexedStream stream = newDevice.Stream as IndexedStream;
DeviceImage deviceImage = newDevice.DeviceImage;
Console.WriteLine(“New Device:”);
Console.WriteLine(" Resolution: " + deviceImage.Size);
Console.WriteLine(" Color model: " + deviceImage.ColorModel);
Console.WriteLine(" Frames: " + stream.ImageCount);
}
}
}
did you install the full installer, not runtime or CameraSuite? The tutorial resources are not available in any runtime setup. Also CameraSuite only has Image Manager related libraries, no Foundation Package and no tools.
If you updated from a CameraSuite or runtime setup you need to modify you installation. This we sadly cannot do automatically as this is how MSI works. To do this go to your installed apps (for Windows 10 this can be quickly done via WIN + X > Apps and Features). In the list find Common Vision Blox and select it. There should be a Modify button.
This opens:
Click Next > to get to this screen:
Make sure Modify is selected and click Next >.
Expand the Developer Resources and ensure that all are installed:
Thanks for the prompt answer! Now the problem of finding the file is solved, but I still get a System.ArgumentException when running ‘Device videoDevice = DeviceFactory.Open(aviPath);’
Am I missing something? ‘SystemInfo.DataPath’ leads to the same exception.
I’m sorry if these are too Basic questions, but I’m still a beginner in programming
You are trying to write to a sub directory C:\Program Files. These folders usually require elevated administrative privileges when trying to write to them - did you start your program with administrative rights?
My bad - you’re trying to open the file, not write it after all… Are you certain that your application is running as a 64 bit application? (recent versions have introduce the “Prefer 32 bit” option which by default is checked on “AnyCPU” projects; see also here: Getting Started with CVB.Net…)