Hello,
i have an image displayed as an array u(:,:,k) and i need to apply a filter function in my image, so i used imagesc to convert the array to an image . now, my problem is how to convert the image to an array?

 Réponse acceptée

DGM
DGM le 5 Jan 2022
Modifié(e) : DGM le 5 Jan 2022
Imagesc() doesn't convert arrays to images. Images are arrays.
If you have something that needs to be normalized with respect to its extrema, use normalize() or mat2gray().
That said, a routine cause of errors is normalizing to extrema when there is some prevailing convention for the nominal range of the data. If so, specify the normalization limits in the call to normalize() or mat2gray().
Let's say you have an array which is some sort of angle map. The nominal range of values is 0 to 360.
A = [69 266 87 331 97 276 68 103 32 208];
B = mat2gray(A)
B = 1×10
0.1237 0.7826 0.1839 1.0000 0.2174 0.8161 0.1204 0.2375 0 0.5886
[min(B) max(B)]
ans = 1×2
0 1.0000
Normalizing to the data extrema eliminates all information describing the scale and position of the data with respect to the nominal limits. Normalizing to the nominal limits retains that information.
C = mat2gray(A,[0 360])
C = 1×10
0.1917 0.7389 0.2417 0.9194 0.2694 0.7667 0.1889 0.2861 0.0889 0.5778
[min(C) max(C)]
ans = 1×2
0.0889 0.9194
You'll have to decide what suits your needs.

Plus de réponses (0)

Catégories

En savoir plus sur Convert Image Type dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by