Ultimo aggiornamento: novembre 2026
Alternativa ad AForge.NET: Guida alla migrazione verso VisioForge .Net SDK
Sostituisci l'abbandonato AForge.NET con un SDK .NET moderno e multipiattaforma
AForge.NET è un framework C# open source per cattura video, computer vision ed elaborazione delle immagini, abbandonato da luglio 2013 e pensato per .NET Framework 2.0. Questa guida associa ogni namespace di AForge.NET a VisioForge .Net SDK per .NET 6-10. Le classi di AForge.Video passano a VideoCaptureCoreX in Video Capture SDK .NET: VideoCaptureDevice diventa VideoCaptureDeviceSourceSettings, MJPEGStream diventa HTTPMJPEGSourceSettings e ScreenCaptureStream diventa una sorgente schermo per Windows, macOS o Linux. Il rilevamento del movimento di AForge.Vision passa a MotionDetectionExSettings in VideoCaptureCoreX o a CVMotionCellsBlock in Media Blocks SDK. Inoltre, AForge.NET non ha mai avuto il rilevamento di volti o pedoni: VisioForge aggiunge rilevatori di volti Haar cascade e DNN con sfocatura per la privacy, più un rilevatore di pedoni basato su HOG. I filtri di AForge.Imaging corrispondono in parte a blocchi CV di VisioForge come il rilevamento dei bordi Canny e l'equalizzazione dell'istogramma, e il resto a OpenCvSharp. Ad esempio, un registratore da webcam con avvisi di movimento richiede un solo motore VideoCaptureCoreX invece di un dispositivo di cattura, un rilevatore di movimento e un writer di file.
Da 250 €/anno · licenza Lifetime da 900 €
Perché sostituire AForge.NET?
AForge.NET va sostituito perché il framework è abbandonato da luglio 2013 e da allora non riceve aggiornamenti, patch di sicurezza né correzioni di bug. AForge.NET è pensato per .NET Framework 2.0, quindi il suo codice non può girare su .NET 6-10 senza fork della community di qualità variabile. La cattura video si basa su DirectShow, un'API Windows legacy che Microsoft ha sostituito con Media Foundation, per cui la cattura funziona solo su Windows. Inoltre, AForge.NET non supporta H.265, AV1 né VP9. Ad esempio, portare un'app per webcam da .NET Framework a .NET 8 lascia due opzioni: un fork della community di AForge.Video che continua a funzionare solo su Windows, oppure VideoCaptureCoreX, che copre Windows, macOS, Linux, iOS e Android con un'unica API.
| Rischio | Impatto |
|---|---|
| Nessuna patch di sicurezza | Le vulnerabilità nell'elaborazione video/immagini rimangono non corrette |
| Nessun supporto .NET 6+ | Impossibile utilizzare le funzionalità moderne di .NET, AOT o il deployment multipiattaforma |
| Nessun supporto nuovi codec | Nessun H.265, AV1, VP9 o formati contenitore moderni |
| Nessuna comunità | Forum chiuso ad aprile 2012, nessun maintainer attivo |
| Dipendenza da DirectShow | API legacy, sostituita da Media Foundation |
| Solo Windows | Impossibile targetizzare macOS, Linux, iOS, Android |
AForge.Video → VisioForge Video Capture SDK .Net
Mappatura delle classi
| Componente AForge.Video | Sostituto VisioForge |
|---|---|
| VideoCaptureDevice | VideoCaptureCoreX + VideoCaptureDeviceSourceSettings |
| MJPEGStream | VideoCaptureCoreX + HTTPMJPEGSourceSettings |
| JPEGStream | VideoCaptureCoreX + HTTPMJPEGSourceSettings per flussi MJPEG; nessun equivalente diretto per URL di istantanee |
| ScreenCaptureStream | VideoCaptureCoreX + ScreenCaptureD3D11SourceSettings (Windows), ScreenCaptureMacOSSourceSettings, ScreenCaptureXDisplaySourceSettings (Linux) |
| FileVideoSource | MediaPlayerCoreX (riproduzione) o VideoEditCoreX (elaborazione) |
| AsyncVideoSource | Integrato — tutte le sorgenti VisioForge sono asincrone di default |
| NewFrameEventArgs | Evento OnVideoFrameBuffer |
C# Acquisizione webcam
AForge.NET — acquisizione webcam (prima)
C#// AForge: Manual device enumeration, callback-based, no recording
var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
var videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);
videoSource.NewFrame += (sender, eventArgs) =>
{
Bitmap frame = (Bitmap)eventArgs.Frame.Clone();
pictureBox.Image = frame;
// Manual recording requires separate code
};
videoSource.Start();
// Cleanup
videoSource.SignalToStop();
videoSource.WaitForStop();VisioForge — C# acquisizione webcam (dopo)
C#// VisioForge: Typed API, async, preview + recording built-in
var capture = new VideoCaptureCoreX(videoView); // Preview automatic
var devices = await DeviceEnumerator.Shared.VideoSourcesAsync();
capture.Video_Source = new VideoCaptureDeviceSourceSettings(devices[0]);
capture.Outputs_Add(new MP4Output("recording.mp4"), true);
await capture.StartAsync();
// Stop
await capture.StopAsync();C# Telecamera IP RTSP / MJPEG Streaming
AForge.NET — flusso MJPEG (prima)
C#// AForge: MJPEG only, no RTSP, no reconnection
var stream = new MJPEGStream("http://camera-ip/mjpg/video.mjpg");
stream.NewFrame += (sender, eventArgs) =>
{
pictureBox.Image = (Bitmap)eventArgs.Frame.Clone();
};
stream.Start();VisioForge — C# acquisizione telecamera IP RTSP (dopo)
C#// VisioForge: RTSP, RTMP, HLS, MJPEG
// Reconnection is opt-in: configure FallbackSwitch on the source settings
var capture = new VideoCaptureCoreX(videoView);
// RTSPSourceSettings uses a static factory (private constructor)
capture.Video_Source = await RTSPSourceSettings.CreateAsync(
new Uri("rtsp://camera-ip/stream"), "admin", "pass", audioEnabled: true);
capture.Outputs_Add(new MP4Output("recording.mp4"), true);
await capture.StartAsync();C# Cattura e registrazione dello schermo
AForge.NET — cattura schermo (prima)
C#// AForge: Basic, CPU-intensive, no recording
var screenStream = new ScreenCaptureStream(Screen.PrimaryScreen.Bounds);
screenStream.NewFrame += (sender, eventArgs) =>
{
pictureBox.Image = (Bitmap)eventArgs.Frame.Clone();
// Must manually encode and write frames to create a recording
};
screenStream.Start();VisioForge — C# registratore schermo (dopo)
C#// VisioForge: monitor selection, cursor capture, automatic H.264 encoder
var capture = new VideoCaptureCoreX(videoView);
// Windows source; macOS and Linux have their own settings classes
capture.Video_Source = new ScreenCaptureD3D11SourceSettings
{
MonitorIndex = 0,
CaptureCursor = true,
FrameRate = new VideoFrameRate(25)
};
capture.Outputs_Add(new MP4Output("screen.mp4"), true);
await capture.StartAsync();AForge.Vision → Blocchi di visione artificiale VisioForge
Mappatura delle classi
| Componente AForge.Vision | Sostituto VisioForge |
|---|---|
| MotionDetector | MotionDetectionExSettings + OnMotionDetection su VideoCaptureCoreX, o CVMotionCellsBlock in Media Blocks |
| TwoFramesDifferenceDetector | CVMotionCellsBlock — celle di movimento basate su griglia |
| SimpleBackgroundModelingDetector | ObjectDetector (VisioForge.Core.CV) — sottrazione di sfondo MOG2 (history: 500 frames, variance threshold: 40) |
| CustomFrameDifferenceDetector | CVMotionCellsSettings configurabile |
| MotionAreaHighlighting | CVMotionCellsBlock con Display = true — disegna le celle in cui è stato rilevato movimento |
| GridMotionAreaProcessing | CVMotionCellsBlock — griglia di movimento impostata tramite GridSize, da 8 a 32 celle per asse |
| BlobCounter | CarCounter (VisioForge.Core.CV) — tracciamento blob, rilevamento contorni, conteggio veicoli su una linea di tracciamento |
C# Rilevamento di movimento e oggetti
AForge.NET — rilevamento del movimento (prima)
C#// AForge: Manual frame processing, no recording integration
var detector = new MotionDetector(
new TwoFramesDifferenceDetector(),
new MotionAreaHighlighting());
videoSource.NewFrame += (sender, eventArgs) =>
{
float motionLevel = detector.ProcessFrame((Bitmap)eventArgs.Frame.Clone());
if (motionLevel > 0.02f)
Console.WriteLine($"Motion: {motionLevel * 100:F1}%");
};VisioForge — rilevamento del movimento basato su eventi (Video Capture SDK)
C#// Integrated detection during capture + recording
var capture = new VideoCaptureCoreX(videoView);
capture.Video_Source = new VideoCaptureDeviceSourceSettings(devices[0]);
capture.Outputs_Add(new MP4Output("recording.mp4"), true);
capture.Motion_Detection = new MotionDetectionExSettings();
capture.OnMotionDetection += (s, e) =>
{
if (e.LevelPercent > 30)
Console.WriteLine($"Motion: {e.LevelPercent}%");
};
await capture.StartAsync();VisioForge — CVMotionCellsBlock (pipeline MediaBlocks)
C#// Motion cells grid: raises MotionDetected as cells change
var settings = new CVMotionCellsSettings
{
Display = true,
GridSize = new Size(16, 16)
};
var detector = new CVMotionCellsBlock(settings);
detector.MotionDetected += (s, e) => Console.WriteLine("Motion");C# Rilevamento facciale e rilevamento pedoni (non disponibile in AForge)
Mappatura delle classi
| Funzionalità | Blocco VisioForge |
|---|---|
| Rilevamento facciale con cascata Haar | CascadeFaceDetectorBlock — rilevamento viso frontale/profilo, occhi, naso, bocca |
| Rilevamento facciale DNN | DNNFaceDetectorBlock — modello Caffe SSD, filtraggio per confidenza |
| Rilevamento facciale DLib | FaceDetectorBlock (VisioForge.Core.CVD) — rilevatore facciale frontale DLib HOG+SVM |
| Rilevamento pedoni | PedestrianDetector — rilevatore di persone HOG+SVM integrato, aggiunto tramite Video_Processors |
| Rilevamento ostruzione obiettivo | CameraCoveredDetector — rilevamento bordi Canny |
C# Rilevamento facciale
AForge.NET (prima)
C#// AForge had no built-in face detection — required manual Haar cascade code
// or using Accord.NET's HaarObjectDetector on top of AForge framesVisioForge — rilevamento facciale con cascata Haar
C#var settings = new CascadeFaceDetectorSettings
{
DetectFrontalFace = true,
DetectProfileFace = true,
DetectEyes = true,
DetectNose = true,
DetectMouth = true,
MinFaceSize = new Size(30, 30),
ScaleFactor = 1.1f,
DrawEnabled = true,
Blur = false, // set true for privacy blur
Pixelate = false // set true for privacy pixelation
};
var detector = new CascadeFaceDetectorBlock(settings);VisioForge — rilevatore facciale DNN
C#var settings = new DNNFaceDetectorSettings
{
Confidence = 0.25f,
DrawEnabled = true,
Blur = true // built-in privacy blur
};
var detector = new DNNFaceDetectorBlock(settings);VisioForge — rilevatore facciale DLib
C#var settings = new FaceDetectorSettings
{
DrawEnabled = true,
MinFaceSize = new Size(30, 30)
};
var detector = new FaceDetectorBlock(settings);C# Rilevamento pedoni
AForge.NET (prima)
C#// AForge had no pedestrian detection — required manual HOG+SVM implementationVisioForge — rilevamento pedoni (dopo)
C#var detector = new PedestrianDetector
{
DrawEnabled = true,
VideoScale = 1.0,
FramesToSkip = 2
};
detector.Init();
detector.OnPedestrianDetected += OnPedestrianDetected;
capture.Video_Processors.Add(detector);
// HOG descriptors + SVM classifierAForge.Imaging → VisioForge CV + OpenCvSharp
Mappatura delle classi
| Funzionalità AForge.Imaging | VisioForge integrato | OpenCvSharp autonomo |
|---|---|---|
| GaussianBlur | CVSmoothBlock, o CVProcess.BlurRegion() per una regione (kernel 23x23) | Cv2.GaussianBlur() |
| Pixellate | CVProcess.PixelateRegion() | Riduzione/ingrandimento personalizzato |
| CannyEdgeDetector | CVEdgeDetectBlock | Cv2.Canny() |
| Erosion / Dilation | CVErodeBlock / CVDilateBlock | Cv2.Erode() / Cv2.Dilate() |
| BlobCounter | CarCounter — rilevamento contorni, filtraggio area/rapporto d'aspetto, involucro convesso | Cv2.FindContours() |
| Grayscale | Conversione BGR→Gray integrata in tutti i rilevatori | Cv2.CvtColor() |
| Threshold | Soglia binaria integrata in ObjectDetector e CarCounter | Cv2.Threshold() |
| ResizeBilinear | Ridimensionamento video integrato in tutte le impostazioni dei rilevatori | Cv2.Resize() |
| HistogramEqualization | CVEqualizeHistogramBlock | Cv2.EqualizeHist() |
| HSLFiltering / filtri colore | — | Cv2.InRange() / Cv2.CvtColor() |
| HoughLineTransformation | — | Cv2.HoughLinesP() |
| SobelEdgeDetector | CVSobelBlock | Cv2.Sobel() |
| Template matching | CVTemplateMatchBlock | Cv2.MatchTemplate() |
Checklist di migrazione
- Inventariare i riferimenti AForge — Trovare tutti i `using AForge.*` nel progetto
- Installare i pacchetti NuGet di VisioForge
- Sostituire le classi delle sorgenti video
- Sostituire il rilevamento del movimento
- Sostituire il rilevamento facciale
- Sostituire il rilevamento blob/oggetti
- Rimuovere i cicli manuali dei frame
- Aggiungere registrazione/streaming
- Targetizzare .NET moderno — .NET 6-10
- Testare il multipiattaforma
- Per l'elaborazione immagini — VisioForge CV copre sfocatura, pixelizzazione, Canny, Sobel, morfologia, template matching; usare OpenCvSharp per filtri aggiuntivi
Cosa si ottiene dopo la migrazione
| Capacità | AForge.NET | Dopo la migrazione |
|---|---|---|
| Framework | .NET Framework 2.0 | .NET 6-10 |
| Piattaforme | Solo Windows | Windows, macOS, Linux, iOS, Android |
| Acquisizione video | DirectShow base | SDK professionale con API asincrona |
| Registrazione | Implementazione manuale | Integrata (MP4, MKV, AVI, WebM) |
| Codifica hardware | Nessuna | NVENC, QSV, AMF, VideoToolbox |
| Streaming | Nessuno | RTMP, HLS, SRT, NDI |
| Effetti audio | Nessuno | 40+ su entrambi i motori (EQ, reverb, chorus, 3D) |
| Effetti video | Nessuno | Pipeline GPU + CPU |
| Rilevamento facciale | Nessuno | Haar + DNN (Caffe SSD) con sfocatura/pixelizzazione; DLib HOG solo rilevamento |
| Rilevamento movimento | Differenza frame base | Sottrazione sfondo MOG2 + tracciamento oggetti con ID |
| Rilevamento pedoni | Nessuno | Rilevatore persone HOG+SVM integrato |
| Telecamere IP | Solo MJPEG | RTSP, RTMP, HLS, ONVIF |
| Telecamera virtuale | Nessuna | Output verso Zoom/Teams/OBS |
| Manutenzione | Abbandonato (2013) | Sviluppo attivo |
| Sicurezza | Non aggiornato | Aggiornamenti regolari |
Domande frequenti
AForge.NET è ancora mantenuto?
Qual è la migliore alternativa ad AForge.NET per l'acquisizione video in C#?
VisioForge sostituisce i filtri di AForge.Imaging?
Posso usare VisioForge per il rilevamento facciale in C# senza AForge?
VisioForge supporta .NET 6, .NET 8, .NET 9 e .NET 10?
Posso migrare da AForge.NET in modo incrementale?
Da 250 €/anno · licenza Lifetime da 900 €
