How to represent numbers as characters in an image

1 次查看(过去 30 天)
I have a file which contains numbers which are the coefficients obtained from wavelet thresholding of a data/signal by issuing the command signal_coeff=cwt(signal,1:32,'sym2','plot');colormap jet;surf(signal_coeff); .How do I convert this data of numbers to characters based on maximum entropy thresholding and then as an image(24 bit RGB) using a grid like visual representation where each square contains a letter. Should I use num2str or char(coeff) and how do I go about it.Please note that my knowledge in matlab is very limited and as such I could not understand how to do all these steps. Any help would be appreciated.

回答(1 个)

Walter Roberson
Walter Roberson 2012-1-13
Your question is difficult for me to understand.
If you have a number, then if you use num2str() you would end up with multiple characters unless the number was exactly one of 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9. If you use char() on a number then you would end up with one character if the number was an integer in the range 0 to 65535, and you would get warnings if you had negative values or you had any fractions.
Once you have your character or characters, you could arrange them in a matrix, but a matrix of characters cannot be used as an image by any MATLAB routine that I can think of. The MATLAB display routines or image-saving routines require matrices which are of the data type uint8, uint16, or double (some might permit single)
The connection between the numbers in the file and the conversion to characters "based upon maximum entropy thresholding" is not something I do not understand. You said that the coefficients were generated from "a data/signal", which implies that the data was not originally character, so I do not know why you want to output as character.
It would make more sense to me if you had not referred to characters at all, and had instead said that you needed to create a matrix of uint8.
  1 个评论
chitra
chitra 2012-1-13
编辑:Walter Roberson 2017-1-24
The numbers are not integers,they are the coefficients of wavelet transform.The idea is quite similar to compression technique where numbers falling in a range of are assigned a particular unique character.Basically,the "range" would be fixed by something known as Shannon's entropy method and thresholding.I am not sure,but the higher frequency levels are assigned one character and next some other character and so on.If you could kindly see section 3 in link: http://www.math.uni-bremen.de/zetem/DFG-Schwerpunkt/preprints/orig/symbolicdermatology.pdf . I am unable to express clearly.Thank you once again

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 AI for Signals and Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by