Reshape array for 256 by 256 matrix showing 16 by 256
Mostra commenti meno recenti
I have 65536 real data points saved from an image. I have used reshape command to make square matrix. But result I am getting is 16 by 256 . Why is it so? Can I reconstruct the image ??
a = load('fname.txt');
y=reshape (a,256,256)
but instead of 256 by 256 it is showing 16 by 256
5 Commenti
the cyclist
il 27 Giu 2013
It's impossible to know what went wrong if you do not post your code.
sudipta
il 28 Giu 2013
sudipta
il 28 Giu 2013
George Papas
il 28 Giu 2013
Hi Sudipta! Have you tried to use the command double before resizing? As far as I understood you would like to resize your image.
1) So, from the beginning, first you can get the file:
[Get_file,Get_pathname]=uigetfile;
2) Then it is very important to read and double it:
Temp_Image=double(dicomread(fullfile(Get_pathname,Get_file)));
3) At the end you can resize it:
Image=imresize(Temp_Image,resizefactor);
I think the most important thing is to double the image before any further post-processing step.
I hope that helps,
Giorgos
Risposta accettata
Più risposte (3)
It is impossible that Matlab's reshape changes the number of elements of the processed array. Therefore I'm convinced, that something completely different went wrong:
- You do not read the file your assume to read
- "It is showing 16 by 256" does not explain, how you check the size. Perhaps the bug is found in your method to obtain the array size.
- You do not use Matlab's reshape but a user-defined function. Check this by:
which reshape -all
David Sanchez
il 28 Giu 2013
To reshape/resize an image, use:
imresize
Type:
help imresize
Or
doc imresize
for all the information needed to handle the issue.
Categorie
Scopri di più su Signal Attributes and Indexing in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!