Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Getting too low framerate while using videoplayer

1 vue (au cours des 30 derniers jours)
Kerem Asaf Tecirlioglu
Kerem Asaf Tecirlioglu le 12 Avr 2017
Clôturé : MATLAB Answer Bot le 20 Août 2021
Hello, interestingly im gettin 1 frame for 3 secs while im processing the data live in the video player.
my code is below:
clear all;
clc;
vid = imaq.VideoDevice('winvideo',2, 'YUY2_1280x720', 'ROI', [1 1 1280 720],'ReturnedColorSpace', 'rgb');
vidInfo = imaqhwinfo(vid);
PositionVector= vision.ShapeInserter('Shape','Lines','LineWidth',8);
TargetVector=vision.ShapeInserter('Shape','Lines','LineWidth',8);
Angle = vision.TextInserter('Text', 'Theta: %d','Location',[7 2],'Color', [1 0 0],'FontSize', 12);
blob=vision.BlobAnalysis('AreaOutputPort', false,'CentroidOutputPort', true,'MaximumCount', 2);
VideoIn = vision.VideoPlayer('Name', 'pipi');
p_position=[0,0];
target=[1200 60];
while(1)
imaq=step(vid);
imaq=flipdim(imaq,2);
IMG=imaq;
imaq=imsubtract(imaq(:,:,3),rgb2gray(imaq));
imaq=medfilt2(imaq,[15,15]);
imaq=im2bw(imaq,0.1);
robotCoordinates=step(blob,imaq);
IMG(1:20,1:165,:) = 0;
v=[p_position(1,1)-robotCoordinates(1,1) p_position(1,2)-robotCoordinates(1,2)].*[1 -1];
target_v=[target(1,1)-robotCoordinates(1,1) target(1,2)-robotCoordinates(1,2)].*[1 -1];
theta=(acos(dot(v,target_v)/(norm(v)*norm(target_v))));
theta=radtodeg(theta);
vidIn = step(PositionVector,IMG,[int16(robotCoordinates),int16(p_position)]);
vidIn= step(TargetVector,vidIn,[int16(robotCoordinates),int16(target)]);
vidIn= step(Angle,vidIn,int8(theta));
step(VideoIn,vidIn);
p_position=robotCoordinates;
end
  1 commentaire
Jan
Jan le 12 Avr 2017
What is your question?

Réponses (0)

Cette question est clôturée.

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by