matlab vidéo
Répondre à la discussion
Affichage des résultats 1 à 3 sur 3

matlab vidéo



  1. #1
    invite63fe02f4

    matlab vidéo


    ------

    impossible d'executer ce programme :

    Merci d'utiliser les différentes balises à ta disposition, dans ce cas cette balise est symbolisée par ceci:

    yoda1234.



    Code:
    function [video_mat,color_burst_mat]=video_extract(raw_video) 
     
    %********************************************************************** 
    %  
    % THIS FUNCTION EXTRACT THE ACTIVE VIDEO AND THE COLOR BURST INFORMATION  
    % FROM A BINARY FILE OF 27MHZ SAMPLED VIDEO. 
    % 
    % INPUT - RAW VIDEO BINARY FILE 
    %          
    % OUTPUT - 3D MATRIX OF ACTIVE VIDEO. EACH 2D MATRIX IS ONE FIELD 
    %        EACH RAW IS ONE VIDEO LINE 
    %          THE COLOR BURST MAT CONTAINS THE FREQUENCY AND PHASE IN EACH  
    %          VIDEO LINE 
    %********************************************************************** 
     
    % SAMPLING RATE IS 27MHZ MEANING 37ns PERIOD. 
    [m,n]=size(raw_video); 
    sync_threshold=800;     %threshold for sync detection 
    vsync_period_threshold=700; 
    hsync_period_threshold=100; 
     
    % First vertical sync detection 
     
    vsync_flag=0; 
    hsync_flag=0; 
    vsync_progress=0; 
    vsync_counter=0; 
    hsync_counter=0; 
      
    for i=1:m 
       if raw_video(i) < sync_threshold 
          vsync_counter=vsync_counter+1; 
          if vsync_counter > vsync_period_threshold 
             vsync_flag=1; 
          end 
       else 
          if vsync_flag==1 
             vsync_progress=vsync_progress+1; 
             vsync_flag=0; 
             vsync_counter=0; 
             if vsync_progress == 6 
                end_of_1st_vsync=i 
                vsync_progress=0; 
                break; 
             end 
          end 
       end 
    end 
     % From end of VSYNC, detect every HSYNC and store active video field  
    % from video lines 10-262 for field0 and 272-525 for field1 
     
    % End of VSYNC is at the end of line 6 
    % Lines 7,8,9 has equalizing pulses and HSYNC pulse every half line period 
     
    active_pxl_per_line= 1440; 
    line_number=0;              
    field_number=1; 
    hsync_low2active_video=round(9.2/0.037);      %active video is 9.2us from falling 
    edge of HSYNC 
    hsync_low2color_burst=round(5.3/0.037);     %color burst starts 5.3us from 
    falling edge of HSYNC 
    color_burst_length=round(10*(1/3.579545e6)/37e-9);%color burst length is 9+-1 
    cycles of 3.579545MHZ 
     
    i=end_of_1st_vsync; 
    while i<=m 
       if raw_video(i) < sync_threshold 
          hsync_counter=hsync_counter+1; 
          vsync_counter=vsync_counter+1; 
          if vsync_counter > vsync_period_threshold 
             vsync_flag=1; 
          end 
          if  (hsync_counter > hsync_period_threshold & hsync_counter < 
    vsync_period_threshold) 
             hsync_flag=1; 
          else 
             hsync_flag=0; 
          end 
       else 
          % HSYNC case 
          if hsync_flag == 1 
    line_number=line_number+1; 
             start_of_active_vid=i-hsync_counter+hsync_low2active_video; 
             video_mat(line_number,:,field_number)=... 
                raw_video(start_of_active_vid:start_of_active_vid+active_pxl_per_line-
    1); 
              
             %Extracting the line color burst frequency 
             start_of_color_burst=i-hsync_counter+hsync_low2color_burst; 
             
    color_burst=raw_video(start_of_color_burst:start_of_color_burst+color_burst_length)
    ; 
             cb_interp=interp(color_burst,100)-color_burst(1); 
             cb_sign=sign(cb_interp)+1; 
             cb_zero_cross=diff(cb_sign); 
             [zero_index,s]=find(cb_zero_cross>0); 
             color_burst_mat(line_number,1,field_number)=1/(mean(diff(zero_index(4:end-
    4)))*37e-11); 
             %color burst phase 1=0 degrees -1=180 degrees 
             color_burst_mat(line_number,2,field_number)=cb_sign(700)/2;  
              
             %reseting counters and progress i to the next line 
             i=start_of_active_vid+active_pxl_per_line-1; 
             vsync_counter=0; 
             hsync_counter=0; 
             hsync_flag=0; % VSYNC case        
          elseif vsync_flag==1 
             vsync_progress=vsync_progress+1; 
             vsync_flag=0; 
             vsync_counter=0; 
             hsync_flag=0; 
             hsync_counter=0; 
             if vsync_progress == 6 
                line_number=0; 
                field_number=field_number+1 
                vsync_progress=0; 
             end 
          % Equalizing pulses case 
          else 
             vsync_counter=0; 
             hsync_counter=0; 
          end 
       end 
       i=i+1; 
    end


    aidez moi svp

    -----
    Dernière modification par yoda1234 ; 06/05/2010 à 10h17.

  2. #2
    yoda1234

    Re : matlab vidéo

    Rappel de la charte que tu as acceptée en t'inscrivant ici:

    La courtoisie est de rigueur sur ce forum : pour une demande de renseignements bonjour et merci devraient être des automatismes.
    Merci d"en tenir compte à l'avenir
    Là où l'ignorance est un bienfait, c'est de la folie d'être sage (Thomas Gray).

  3. #3
    pat7111

    Re : matlab vidéo

    Citation Envoyé par nanoucha31 Voir le message
    aidez moi svp
    Sans un exemplaire de la variable raw_video, argument de la fonction, il me parait difficile de faire quoi que ce soit, a part peut-etre chercher une erreur de syntaxe mais la longueur est peu engageante...
    Plutôt appliquer son intelligence à des conneries que sa connerie à des choses intelligentes...

Discussions similaires

  1. [matlab] programmation : peut-on générer un arbre des fonctions d'un code Matlab ?
    Par bratisla dans le forum Logiciel - Software - Open Source
    Réponses: 3
    Dernier message: 09/07/2015, 10h12
  2. Réponses: 4
    Dernier message: 04/03/2009, 18h50
  3. Pb avec le Lecteur Vidéo sur le site de M6 Vidéo via « Windows Media 10 »
    Par invite82cf4694 dans le forum Logiciel - Software - Open Source
    Réponses: 6
    Dernier message: 05/08/2007, 15h29
  4. [MatLab] Sb2Sl => Matlab classique = pb intégration.
    Par invite6e6d5361 dans le forum Logiciel - Software - Open Source
    Réponses: 0
    Dernier message: 03/08/2005, 21h02
  5. video avec matlab
    Par invitea2790947 dans le forum Logiciel - Software - Open Source
    Réponses: 2
    Dernier message: 20/08/2004, 15h02
Découvrez nos comparatifs produits sur l'informatique et les technologies.