complex values are not supported for video data matlab
2 views (last 30 days)
Show older comments
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 Comments
dpb
on 7 Aug 2023
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.
Answers (1)
Udit06
on 22 Aug 2023
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 Comments
dpb
on 22 Aug 2023
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...
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!