capturing the same frame
    7 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Osita Onyejekwe
 am 7 Apr. 2017
  
    
    
    
    
    Kommentiert: Osita Onyejekwe
 am 10 Apr. 2017
            My frame is capturing the same beginning video frame in multiple figures. I want the multiple figure to be images of the video as it progrosses, not the same figure for multiple figures. Here is my code. Please fix it
 obj = VideoReader('Climate.mp4');
for k = 1 : 5  %fill in the appropriate number
  this_frame = read(obj, k);
  thisfig = figure();
  %thisfig = gcf;
  thisax = axes('Parent', thisfig);
  image(this_frame, 'Parent', thisax);
  title(thisax, sprintf('Frame #%d', k));
end
0 Kommentare
Akzeptierte Antwort
  Image Analyst
      
      
 am 7 Apr. 2017
        So don't create a new figure each frame. How does this work:
obj = VideoReader('Climate.mp4');
for k = 1 : obj.NumberOfFrames
  this_frame = read(obj, k);
  imshow(this_frame);
  title(sprintf('Frame #%d', k), 'FontSize', 14);
  drawnow; % Force immediate repaint of screen.
  pause(0.1); % Increase number to slow it down more.
end
11 Kommentare
  Image Analyst
      
      
 am 7 Apr. 2017
				You need to think about the logic flow. This works just fine.
obj = VideoReader('Climate.mp4');
for k = 1 : obj.NumberOfFrames
  this_frame = read(obj, k);
  imshow(this_frame);
  title(sprintf('Frame #%d', k), 'FontSize', 14);
  drawnow; % Force immediate repaint of screen.
  pause(0.1); % Increase number to slow it down more.
  if rem(k, 5) == 0 % Ask every fifth frame
    promptMessage = sprintf('Showing Frame #%d.\nDo you want to Continue processing,\nor Quit processing?', k);
    titleBarCaption = 'Continue?';
    buttonText = questdlg(promptMessage, titleBarCaption, 'Continue', 'Quit', 'Continue');
    if strcmpi(buttonText, 'Quit')
      break;
    end
  end
end
Weitere Antworten (1)
Siehe auch
Kategorien
				Mehr zu Simulated Annealing finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
