How can I use imfindcircles in real time video?

조회 수: 7 (최근 30일)
kurczak
kurczak 2013년 3월 13일
I have written below code which gives photo from camera and mark circles on them
vid = videoinput('winvideo', 1, 'RGB24_640x480');
set(vid, 'FramesPerTrigger', Inf);
set(vid, 'ReturnedColorspace', 'rgb')
vid.FrameGrabInterval = 5;
data = getsnapshot(vid);
[center,radii] = imfindcircles(data,[20 60],'ObjectPolarity','dark','Sensitivity',0.9,'Method','twostage');
imshow(data)
h=viscircles(center,radii);
how can I make this working in real time?

답변 (3개)

Image Analyst
Image Analyst 2013년 3월 13일
You may not be able to. How long does it take to call imfindcircles()? Wrap it in tic and toc to find out. It may take longer than 1/30th of a second or whatever your definition of "real time" is.

kurczak
kurczak 2013년 3월 14일
It takes to long for this operation. I worked on this for a while and i add something like this
while(vid.FramesAcquired<=200)
data = getsnapshot(vid);
imshow(data)
[center,radii] = imfindcircles(data,[20 60],'ObjectPolarity','dark','Sensitivity',0.9,'Method','twostage');
h=viscircles(center,radii);
end
It's working but the image is to slow it's supposed to be live. I know I'm operating on photos from camera. Using getdata() I get frames but then I can't use imffindcicles beacuse it's operating on photos.
  댓글 수: 1
Image Analyst
Image Analyst 2013년 3월 14일
Well it was just a suggestion. You're free to work on a faster method. And no, I don't have one ready to hand over to you, or even know of one. Plus I don't use Simulink.

댓글을 달려면 로그인하십시오.


Spandan Tiwari
Spandan Tiwari 2013년 3월 20일
Two ways to get IMFINDCIRCLES run faster in your code are:
1) Sending in the image at a lower resolution.
2) Use smaller radius range, if possible.

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for IP Cameras에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by