WICHTIG: Der Betrieb von goMatlab.de wird privat finanziert fortgesetzt. - Mehr Infos...

Mein MATLAB Forum - goMatlab.de

Mein MATLAB Forum

 
Gast > Registrieren       Autologin?   

Partner:




Forum
      Option
[Erweitert]
  • Diese Seite per Mail weiterempfehlen
     


Gehe zu:  
Neues Thema eröffnen Neue Antwort erstellen

VideoReader MJPEG Speicherplatz Problem

 

Thomas_74
Forum-Century

Forum-Century


Beiträge: 241
Anmeldedatum: 06.02.09
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 03.07.2014, 10:06     Titel: VideoReader MJPEG Speicherplatz Problem
  Antworten mit Zitat      
Hi,

ich möchte ein Video einlesen Pixel zusammenfassen und wieder abspeichern.
(Das sollte ein sehr dunkles Video ein wenig aufhellen)
Das Video ist ein MJPEG 1920 x 1080, 30 fps (~150 MB). Mein Laptop hat 8 GB Ram trotzdem Bricht Matlab die Bearbeitung wegen zu wenig Speicherplatz ab (in der Zeile: Y = uint8(sum(sum(XM, 1), 3))Wink.
Was hab ich da falsch gemacht??

Code:
reshapefakt=2;  % 1 = nix
dateia=uigetfile('*.*','Video auswählen');%,'multiselect','on');
%% Video File öffnen
readerobj = VideoReader(dateia);
lastFrame = read(readerobj, inf); %#ok<NASGU>
numFrames = readerobj.NumberOfFrames;
clear lastFrame
%% Preallocate movie structure.
vidHeight = readerobj.Height;
vidWidth = readerobj.Width;
mov(1:numFrames) = struct('cdata', zeros(vidHeight, vidWidth,3, 'uint8'),'colormap', []);
clear v*
%% Video schreiben
aviobj1 = VideoWriter([dateia(1:end-4) '_enhan'],'MPEG-4');
aviobj1.Quality = 80;
open(aviobj1)

for n=1:numFrames;
    mov(n).cdata = read(readerobj, n);
    im=mov(n).cdata;
    S = size(im);
    M = S(1) - mod(S(1), reshapefakt);
    N = S(2) - mod(S(2), reshapefakt);
    MV = M / reshapefakt;
    NW = N / reshapefakt;
    % Cut and reshape input such that the 1st and 3rd dimension
    XM = reshape(im(1:M, 1:N, :), reshapefakt, MV, reshapefakt, NW, []);
    Y = uint8(sum(sum(XM, 1), 3));
    % Remove singleton dimensions:
    S(1) = MV;
    S(2) = NW;
    im = reshape(Y, S);
    clear S* M* N* X* Y*  
    writeVideo(aviobj1,im);
    clear im
end

close(aviobj1)
 



MfG Thomas
Private Nachricht senden Benutzer-Profile anzeigen


Neues Thema eröffnen Neue Antwort erstellen



Einstellungen und Berechtigungen
Beiträge der letzten Zeit anzeigen:

Du kannst Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.
Du kannst Dateien in diesem Forum posten
Du kannst Dateien in diesem Forum herunterladen
.





 Impressum  | Nutzungsbedingungen  | Datenschutz | FAQ | goMatlab RSS Button RSS

Hosted by:


Copyright © 2007 - 2025 goMatlab.de | Dies ist keine offizielle Website der Firma The Mathworks

MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.