2010-05-29 3 views

Répondre

11

IMFINFO devrait vous montrer les informations que vous cherchez.

Voici l'exemple de l'aide 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

oui Je veux récupérer le type, la taille, les dimensions de l'image et l'afficher dans le texte statique. – Achraf

+0

Et c'est ce que la fonction IMFINFO retourne. Cliquez sur le lien pour voir les détails de la sortie. – Jonas

1

Vous pouvez obtenir des informations sur un fichier image à l'aide imfinfo, qui délivre une structure à divers domaines, dont la largeur, la hauteur et colorType.

Par exemple:

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: [] 

Ensuite, vous pouvez obtenir l'information que vous voulez avec l'affectation de structure régulière:

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

Après que vous êtes bon d'aller. Vous pouvez afficher ces informations dans les zones de texte en définissant leur « String » bien à ce que vous voulez:

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

EN SAVOIR PLUS HERE CHÈQUE.

Questions connexes