complex values are not supported for video data matlab
4 次查看(过去 30 天)
显示 更早的评论
I have made an app in MATLAB app designer. Function of this app is to display videos corresponding to given input. My app is working well and the video is getting displayed after providing the input. But, I am facing an error /warning. But still, my video is running.
My error is: Every time the video gets displayed, a new window pops up showing a statement "complex values are not supported for video data".
Can any one suggest me how to handle this issue and get rid of this unnecessary window and statement?
In case you need more information on this, feel free to comment.
2 个评论
dpb
2023-8-7
Video formats don't have complex data -- the only way to remove the warning will be to fix your generation of the video frame data to not have complex data values in it.
It runs because as the warning says, MATLAB plotting routines just ignore the imaginary part of the complex number and use the real part.
But, something is wrong in the video input if it is complex...but we have no information on what/how the video data were created nor where came from that would have caused such.
回答(1 个)
Udit06
2023-8-22
Hi Navneet,
You can try out the following two approaches to solve the problem you are facing due complex data in the video frames.
- Since the MATLAB automatically ignores the imaginary part of the data, you can suppress the warning using the specific warning id. To get the warning id corresponding to the warning you are encountering, you can use the lastwarn function as follows:
% Get the last warning message and its identifier
[warnMsg, warnId] = lastwarn;
warning('off', warnId)
2. Otherwise, you can first check if your video contains any complex data or not. In case, the video contains complex data, you can remove the imaginary part of the data before showing the video.
% Assuming you have a variable 'videoData' containing the video frames
% Check the data format
if ~isreal(videoData)
% Handle complex data by extracting the real component
videoData = real(videoData);
end
% Display the video frames
imshow(videoData); % Or any other function you are using to display the video
I hope this helps.
2 个评论
dpb
2023-8-22
Those alternatives simply mask the warning in one way or another; it doesn't address the fundamental issue that video frames simply do NOT contain complex data values. That OP's does indicates that something went horribly wrong in the generation of those...
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!