2010-05-29 61 views

回答

11

IMFINFO应该向您显示您正在查找的信息。

这里的例子来自MATLAB帮助:

info = imfinfo('ngc6543a.jpg') 

info = 

     Filename: [1x95 char] 
    FileModDate: '01-Oct-1996 17:19:44' 
     FileSize: 27387 
     Format: 'jpg' 
    FormatVersion: '' 
      Width: 600 
     Height: 650 
     BitDepth: 24 
     ColorType: 'truecolor' 
FormatSignature: '' 
NumberOfSamples: 3 
    CodingMethod: 'Huffman' 
    CodingProcess: 'Sequential' 
     Comment: {[1x69 char]} 
+0

是的我想要检索图像的类型,大小和尺寸,并将其显示在静态文本中。 – Achraf 2010-05-29 19:45:56

+0

这就是IMFINFO函数返回的结果。点击链接查看输出的详细信息。 – Jonas 2010-05-29 20:04:56

1

你可以使用imfinfo关于图像文件的信息,这与各个领域,包括宽度,高度和输出的ColorType的结构。

例如:

InfoImage = imfinfo('peppers.png'); 
InfoImage = 
        Filename: '/Applications/MATLAB_R2014a.app/toolbox/matlab/imagesc...' 
       FileModDate: '02-Apr-2013 15:55:52' 
        FileSize: 287677 
        Format: 'png' 
      FormatVersion: [] 
        Width: 512 
        Height: 384 
        BitDepth: 24 
       ColorType: 'truecolor' 
      FormatSignature: [137 80 78 71 13 10 26 10] 
        Colormap: [] 
       Histogram: [] 
      InterlaceType: 'none' 
       Transparency: 'none' 
    SimpleTransparencyData: [] 
      BackgroundColor: [] 
      RenderingIntent: [] 
      Chromaticities: [] 
        Gamma: [] 
       XResolution: [] 
       YResolution: [] 
      ResolutionUnit: [] 
        XOffset: [] 
        YOffset: [] 
       OffsetUnit: [] 
      SignificantBits: [] 
       ImageModTime: '16 Jul 2002 16:46:41 +0000' 
        Title: [] 
        Author: [] 
       Description: 'Zesty peppers' 
       Copyright: 'Copyright The MathWorks, Inc.' 
       CreationTime: [] 
        Software: [] 
       Disclaimer: [] 
        Warning: [] 
        Source: [] 
        Comment: [] 
       OtherText: [] 

然后你就可以得到你想要的信息与普通结构分配:你是好去

With = InfoImage.Width; 
Height = InfoImage.Height; 
Colortype = InfoImage.ColorType; 

之后。更多HERE

set(handles.WidthTextbox,'String',num2str(InfoImage.Width)); 
and so on for the other fields. 

检查:您可以通过他们的“字符串”属性设置为你想要的显示在文本框此信息。