Azzera filtri
Azzera filtri

Its says error :Variable im_final must be of size [691 546]. It is currently of size [546 691]. Check where the variable is assigned a value. I canont figure it out

1 visualizzazione (ultimi 30 giorni)
fid=fopen('Alien_Message');
data = fread(fid,[1 inf],'uint8'); %data is size 1x402741
fclose(fid);
% Βρείτε το μήκος της γραμμής εξετάζονται οπτικά τα επαναλαμβανόμενα μοτίβα των δεδομένων.
% Αν υπάρχει line-header θα το βρείτε να επαναλαμβάνεται στην αρχή της κάθε γραμμής.
figure; plot(data(1:2000));
title('First 2000 elements of raw data')
line_length = 582; % Αν υπάρχει
len_line_header = 36; % Αν υπάρχει
len_main_header = 144; % Αν υπάρχει
% Ανοίγουμε πάλι το αρχείο για να πετάξουμε τον main header.
fid=fopen('Alien_Message');
main_header = fread(fid,[1 len_main_header],'uint8');
% Αρχίζουμε να διαβάζουμε ξανά το άγνωστο μνμ μετά τον main header.
im_raw = fread(fid,[line_length inf], 'uint8'); % Η εικόνα έχει διαστάσεις ??? x ????
fclose(fid);
% Βρείτε τo πλήθος των γραμμών.
% Υπόδειξη: Αφαιρέσατε 1 για την ακολουθία τέλους της εικόνας.
num_lines = size(im_raw) - 1;
% Καθαρίστε και ετοιμάστε την τελική εικόνα αφαιρώντας ότιδήποτε πρόσθετο: line-header και ακολουθία τέλους
% H τελική εικόνα έχει διαστάσεις: ??? x ???
im = im_raw(len_line_header+1:end,1:num_lines ) ;
figure; imagesc(im); colormap(gray)
im_final=uint8(im) ; % Προσοχή με τον τύπο της εικόνας, θέλουμε να είναι uint8.
figure; imshow(im_final);
name_of_hero='Yoda';

Risposte (1)

Binaya
Binaya il 28 Set 2023
Hi Tasos,
I understand that you want to find where the “im_final” variable is initialized and what it’s dimensions are.
The “im_final” variable assignment depends upon the assignment of “im” and “im_raw” variables. The dimension of “im_raw” is [582 inf] as can be seen in its definition in line number 15.The dimension of “im” is [546 “num lines”] from line number 22.
Following this, “im_final” is assigned value in line number 24 which is aninteger transformation of “im” and retains the size of “im”.
I hope this helps.
Regards
Binaya

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by