Ignore:
Timestamp:
Jun 22, 2012, 3:45:06 PM (12 years ago)
Author:
sommeria
Message:

several bugs corrected
introductyion of functions find_imadoc and read_multimadoc which simplifiy the functions under series

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/get_file_type.m

    r446 r469  
    55% OUTPUT:
    66% FileType: type of file
    7 % FileInfo: structure containing info on the file (case of images)
     7% FileInfo: structure containing info on the file (case of images or video), in particular
     8%      .Height: image height in pixels
     9%      .Width:  image width in pixels
     10%      .BitDepth: nbre of bits per pixel  (8 of 16)
     11%      .ColorType: 'greyscale' or 'color'
     12%      .NumberOfFrames
     13%      .FrameRate: nbre of frames per second, =[] for images
    814% Object: in case of video
    915%
     
    2632        FileType='xls';
    2733    otherwise
    28         if ~isempty(FileExt)&& ~isempty(imformats(FileExt(2:end)))
     34        if ~isempty(imformats(regexprep(FileExt,'^.','')))
    2935            try
    30                 FileType='image';
    3136                imainfo=imfinfo(fileinput);
    3237                if length(imainfo) >1 %case of image with multiple frames
    3338                    FileType='multimage';
    34                     FileInfo=imainfo{1};%take info from the first frame
    35                     FileInfo.NbFrame=length(imainfo);
     39                    FileInfo=imainfo(1);%take info from the first frame
     40                    FileInfo.NumberOfFrames=length(imainfo);
    3641                else
     42                    FileType='image';
    3743                    FileInfo=imainfo;
     44                    FileInfo.NumberOfFrames=1;
    3845                end
    3946            end
     
    7582                    if exist('VideoReader.m','file')%recent version of Matlab
    7683                        VideoObject=VideoReader(fileinput);
    77                         FileInfo.NumberOfFrames=get(VideoObject,'NumberOfFrames');
     84                        FileInfo=get(VideoObject);
    7885                        FileType='video';
    7986                    elseif exist('mmreader.m','file')% Matlab 2009a
    8087                        VideoObject=mmreader(fileinput);
    81                         FileInfo.NumberOfFrames=get(VideoObject,'NumberOfFrames');
     88                        FileInfo=get(VideoObject);
    8289                        FileType='mmreader';
    83                     end             
     90                    end 
     91                    FileInfo.BitDepth=FileInfo.BitsPerPixel/3;
    8492                end
    8593            end
Note: See TracChangeset for help on using the changeset viewer.