memory phenomenon

1 回表示 (過去 30 日間)
Hristo Alexiev
Hristo Alexiev 2011 年 12 月 7 日
Hi. I made a m-code for image processing, but I detect some strange effect. For example I use the following code:
vid = videoinput('winvideo', 1,'YUY2_320x240');
set(vid,'ReturnedColorSpace','rgb','TriggerRepeat',1000,'FramesPerTrigger',1);
vid_src=getselectedsource(vid);
set(vid_src,'BacklightCompensation','off','ExposureMode','manual','WhiteBalanceMode','manual','WhiteBalance',6500);
triggerconfig(vid,'manual');
start(vid);
for step=1:1:inf
tic
trigger(vid);
A=getdata(vid,1);
B=rgb2hsv(A);
.
.
. %some code
.
.
figure(4);imshow(A);hold on;
plot(q,p,'Marker','*','Color','r');
flushdata(vid,'triggers');
toc
end
I observe the result for the time of execution and I saw that every cycle the time is increasing and become bigger and bigger. So algorithm is working slower and slower. I can't understand why this is happening. I use a flushdata to clear the memory, but it dosen't matter whether I use it or not. When the data are logged in the memory GETDATA function clear it when I take the data into the workspace. Can somebody tell me what is the reason and how I can fix the problem?

採用された回答

Walter Roberson
Walter Roberson 2011 年 12 月 7 日
You do not show figure 4 as having its contents cleared, so the "hold on" would result in another graph being added to the figure for each loop iteration.
  4 件のコメント
Jan
Jan 2011 年 12 月 11 日
As Walter said already: Are you sure, that you delete the objects correctly?
Hristo Alexiev
Hristo Alexiev 2011 年 12 月 12 日
Thank You for your help. When I use "hold off" to clear the accumulated plots the program start working faster and don't slowing at the time of working.
Best Regards
Hristo

サインインしてコメントする。

その他の回答 (0 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by