complex values are not supported for video data matlab

조회 수: 3 (최근 30일)
NAVNEET NAYAN
NAVNEET NAYAN 2023년 8월 7일
댓글: NAVNEET NAYAN 2023년 8월 23일
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
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.
NAVNEET NAYAN
NAVNEET NAYAN 2023년 8월 8일
Thank You. I shall find and fix the generation of video frames.

댓글을 달려면 로그인하십시오.

답변 (1개)

Udit06
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.
  1. 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
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...
NAVNEET NAYAN
NAVNEET NAYAN 2023년 8월 23일
In my MATLAB App Designer, I was earlier creating an object using VideoPlayer to play my video on the assigned axes. The videos were playing along with opening a new window of video player that displayed the warning. I removed the use of VideoPlayer to display the video and simply displayed the frames of the videos as per my desired speed on the pre-assigend axes using imshow.
This is how I solved the problem. As per your suggestions @dpb I had checked regarding values of video data. There were no complex values.
Thank You both of you for showing interest in the problem and providing your valuable time.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by