How can I put an image acquisition and processing algorithm on a continuous loop?
Mostra commenti meno recenti
Hello,
We have created an algorithm that uses the CVST, the Image Acquisition Toolbox and a Point Grey GigE camera. The algorithm first acquires the images and then we run the images through a motion vector algorithm.
We would like to do these processes on a loop until we command a stop. We have the code set up so that it acquires the video input, saves the video, and then runs the video through an optical flow algorithm within this loop. However, we are often getting an error that states "block/frame XXX is being dropped because a lost packet is unable to be resent." We looked at the troubleshooting page and are still struggling.
What are some possible issues that we may be facing other than what the "Configuring GigE Devices" page suggests. Any help is appreciated. My program is shown below for reference.
Best Regards,
Twain Glaser
%%Video Acquisition Setup
vid = videoinput('gige', 1, 'Mono8');
src = getselectedsource(vid);
vid.TriggerRepeat = 4;
vid.FramesPerTrigger = 20;
imaqmem(1000000000);
j = 1;
while j < 15
%%Acquire Video
start(vid);
diskLogger = VideoWriter('D:\USERS\tglaser\Documents\MATLAB\Video.avi', 'Motion JPEG AVI');
open(diskLogger);
data = getdata(vid, vid.FramesAvailable);
numFrames = size(data, 4);
for ii = 1:numFrames
writeVideo(diskLogger, data(:,:,:,ii));
end
close(diskLogger);
stop(vid);
%%Optical Flow videoReader = vision.VideoFileReader('D:\USERS\tglaser\Documents\MATLAB\Video.avi','ImageColorSpace','Intensity','VideoOutputDataType','uint8');
converter = vision.ImageDataTypeConverter;
opticalFlow = vision.OpticalFlow('ReferenceFrameDelay', 1);
opticalFlow.OutputValue = 'Horizontal and vertical components in complex form';
shapeInserter = vision.ShapeInserter('Shape','Lines','BorderColor','Custom', 'CustomBorderColor', 255);
videoPlayer = vision.VideoPlayer('Name','Motion Vector');
while ~isDone(videoReader)
frame = step(videoReader);
im = step(converter, frame);
of = step(opticalFlow, im);
lines = videooptflowlines(of, 20);
if ~isempty(lines)
out = step(shapeInserter, im, lines);
step(videoPlayer, out);
end
end
release(videoPlayer);
release(videoReader);
j = j + 1;
end
Risposte (0)
Categorie
Scopri di più su GigE Vision Hardware in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!