Convert signal to image??
이전 댓글 표시
Hy,
I read analog signal from external device "ECG" by serial rs232 connection, I need to cut this signal to stored as image by code in matlab because my m file program is depended of Image processing not signal processing and my project is about image processing, so I can't write my program by signal processing.
my problems is:
1- read the signal from serial port.
2- convert this signal to image, and stored this image in current folder of matlab.
3- Please, I need answers for the last problems as codes not as Block. because I work at M file.
thanks for everyone try to help me,
답변 (2개)
Image Analyst
2012년 11월 5일
1 개 추천
You could use reshape() to turn your 1D signal into a 2D image, though I don't know if that would help. Anyway, many or most functions in the Image Processing Toolbox work on 1D images (just a single row or column of "pixels") so you may not need to do anything at all with your 1D ECG signal..
댓글 수: 12
Tariq Nazzal
2012년 11월 5일
편집: Walter Roberson
2021년 2월 6일
Walter Roberson
2012년 11월 7일
Your line
a=rgb2gray(a);
is trying to convert the serial port object "a" to grayscale.
Walter Roberson
2012년 11월 7일
We are going to need a look at your normal.png file. Please upload it and tell us the URL; see http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
Tariq Nazzal
2012년 11월 7일
편집: Walter Roberson
2021년 2월 6일
Walter Roberson
2012년 11월 7일
Your line
perab = sum(xor(a(:), b(:)) ~= 0) / numel(a);
is trying to process the serial port object.
Tariq Nazzal
2012년 11월 8일
Walter Roberson
2012년 11월 8일
The problem is that a(:) is the serial port object, not data read from the serial port object.
Tariq Nazzal
2012년 11월 8일
Walter Roberson
2012년 11월 8일
You will need to fgets() or fscanf() enough data to represent the signal.
If you are reading ECG data from the serial port rather than an image, then you will need to plot the ECG data using exactly the same routine and settings and size as was used to create your normal.png file, and then you will need to take a snapshot of that graph and compare the information in the snapshot to b.
It would probably be much simpler if you had the data used to create normal.png rather than the plotted version of the data.
Tariq Nazzal
2012년 11월 9일
Tariq Nazzal
2012년 11월 10일
Walter Roberson
2012년 11월 10일
getframe()
kh rezaee
2021년 2월 6일
Use spectogram functions of signal to convert as an image. I guess you need this method to process images using deep learning. It should be noted that you must segment the signal before applying it to the network. Use these functions:
spectrogram(1DSignal)
pspectrum(1DSignal,FS,'spectrogram')
wvd(1DSignal,FS,'smoothedPseudo')
댓글 수: 4
Walter Roberson
2021년 2월 6일
Back in 2012 when the question was asked, the Deep Learning functions did not exist.
Also, the person specifically asked not to use signal processing functions because they were working on an image processing problem.
kh rezaee
2021년 2월 6일
Dear Walter
Agreed, I had not looked at date of the comment. However this can be done for 2017 or highr. Calm down.
Walter Roberson
2021년 2월 7일
wvd() was introduced in R2018b, in the Signal Processing Toolbox. pspectrum needs R2017b (and so would not work in R2017a)
Tariq Nazzal
2021년 2월 7일
카테고리
도움말 센터 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!