Bonsoir,
Je ne parviens pas à comprendre comment mettre en place la syntaxe utilisant la fonction reshape (malgre l'aide de Matlab)
dans un premier temps je m'informe des informations de l'image en question, avec la commande suivante : info = imfinfo(file)
Puis j'écris ce script :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 info = Filename: [1x84 char] FileModDate: '27-août-2011 08:49:48' FileSize: 4543354 Format: 'jpg' FormatVersion: '' Width: 2376 Height: 4224 BitDepth: 24 ColorType: 'truecolor' FormatSignature: '' NumberOfSamples: 3 CodingMethod: 'Huffman' CodingProcess: 'Sequential' Comment: {} Make: 'Panasonic ' Model: 'DMC-LX2 ' Orientation: 1 XResolution: 72 YResolution: 72 ResolutionUnit: 'Inch' Software: 'Microsoft Windows Photo Viewer 6.1.7600.16385 ' DateTime: '2012:11:10 11:12:42 ' YCbCrPositioning: 'Co-sited' DigitalCamera: [1x1 struct] UnknownTags: [3x1 struct] ExifThumbnail: [1x1 struct]
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 clear all, close all; clc; rep = 'C:\Users\toto\Pictures\2012-11-10 vacances Normandie\'; fichier = 'vacances Normandie 001.JPG'; file = [rep fichier]; % info = imfinfo(file) fid = fopen (file, 'r'); b1=4224;b2=2376; b3=3; t_vec = fread(fid,b1*b2*b3); fclose(fid); % fermeture du fichier tmp = reshape(t_vec, [b1 b2 b3]); imshow(tmp);
Et Matlab répond ceci :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 ??? Error using ==> reshape To RESHAPE the number of elements must not change.
Je ne comprens pas comment faire. Je sais comment travailler avec la fonction imread, mais j'aimerais mieu maitriser reshape sur un flot de données concernant une image.
Pouvez-vous m'éclairer ?
Merci
Partager