Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

track vehicles similar to the code in matlab

Send the LabVIEW vi which would function the same as the matlab code given below



close all;clear all;clc;

% %  Detect freground using Gaussian Mixture Model
foregroundDetector = vision.ForegroundDetector('NumGaussians', 3, ...
    'NumTrainingFrames', 50);

videoReader = vision.VideoFileReader('visiontraffic.avi');
for i = 1:200
    frame = step(videoReader); % read the next video frame
    foreground = step(foregroundDetector, frame);
end

figure; imshow(frame); title('Video Frame');

figure; imshow(foreground); title('Foreground');

% %  Erosion to remove noise in Foreground

se = strel('square', 3);
filteredForeground = imopen(foreground, se);
figure; imshow(filteredForeground); title('Clean Foreground');

% %  BLOB analysis
blobAnalysis = vision.BlobAnalysis('BoundingBoxOutputPort', true, ...
    'AreaOutputPort', false, 'CentroidOutputPort', false, ...
    'MinimumBlobArea', 150);

bbox = step(blobAnalysis, filteredForeground);

result = insertShape(frame, 'Rectangle', bbox, 'Color', 'green');

numCars = size(bbox, 1);
result = insertText(result, [10 10], numCars, 'BoxOpacity', 1, ...
    'FontSize', 14);
figure; imshow(result); title('Detected Cars');
0 Kudos
Message 1 of 1
(4,548 Views)