how to convert signal into 2D image gray scale
Mostra commenti meno recenti
hello ,how to convert signal into 2D image gray scale by CWT
Risposte (1)
Ameer Hamza
il 29 Ott 2020
0 voti
The documentation shows that if you call cwt(): https://www.mathworks.com/help/wavelet/ref/cwt.html with an output argument, then it will return a 2D matrix. You can take the absolute value of the matrix and display it as a grayscale image.
15 Commenti
ahmed Altameemi
il 29 Ott 2020
Ameer Hamza
il 29 Ott 2020
Modificato: Ameer Hamza
il 29 Ott 2020
The output of cwt should already by 2D matrix. You don't need to call mat2gray. You might need to rescale it to display it properly
M = cwt(input_signal);
M = abs(M);
M = rescale(M, 0, 1);
imshow(M)
ahmed Altameemi
il 29 Ott 2020
Ameer Hamza
il 30 Ott 2020
I don't have the toolbox so cannot run the code, but can you show the output of
M = cwt(input_signal);
M = abs(M);
size(M)
If it is a 2D matrix, then imwhow will automatically show a grayscale image.
Walter Roberson
il 30 Ott 2020
mat2gray() is an older routine that is suitable for rescaling data to the range [0 1]
However, you would not typically pass a second argument to mat2gray, and when you do pass a second argument it must be a vector of two values that is the range to scale to.
imshow() of a 2D array will not be color, but you might want to
imshow(M, [])
ahmed Altameemi
il 30 Ott 2020
ahmed Altameemi
il 30 Ott 2020
Modificato: Walter Roberson
il 30 Ott 2020
Walter Roberson
il 30 Ott 2020
cwt() only accepts vectors, not images. For grayscale images use cwtft2()
ahmed Altameemi
il 30 Ott 2020
Modificato: Walter Roberson
il 30 Ott 2020
Walter Roberson
il 30 Ott 2020
If the code is designed for color images, then take your grayscale images and repmat(GRAYSCALE,[1 1 3]) to get a color image and process it through the code.
However, the code you posted is for processing 1D EEG signals, not for images of any kind.
Mathworks does not provide any equivalent of cwtfilterbank for 2D.
ahmed Altameemi
il 30 Ott 2020
ahmed Altameemi
il 6 Nov 2020
Ameer Hamza
il 6 Nov 2020
You can use rgb2gray() to convert 3 channels to 1.
ahmed Altameemi
il 6 Nov 2020
ahmed Altameemi
il 6 Nov 2020
Categorie
Scopri di più su Continuous Wavelet Transforms in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!