Ask an expert. Trust the answer.

Your academic and career questions answered by verified experts

Applying temporal median filter to a video

Date: 2022-11-30 11:58:19

I want to apply Temporal Median Filter to a depth map video to ensure temporal consistency and prevent the flickering effect. Thus, I am trying to apply the filter on all video frames at once by:

First loading all frames, 

 

%%% Read video sequence numfrm = 5; infile_name = 'depth_map_1920x1088_80fps.yuv'; width = 1920; %xdim height = 1088; %ydim fid_in = fopen(infile_name, 'rb'); [Yd, Ud, Vd] = yuv_import(infile_name,[width, height],numfrm); fclose(fid_in); then creating a 3-D depth matrix (height x width x number-of-frames), %%% Build a stack of images from the video sequence stack = zeros(height, width, numfrm); for i=1:numfrm RGB = yuv2rgb(Yd{i}, Ud{i}, Vd{i}); RGB = RGB(:, :, 1); stack(:,:,i) = RGB; end

and finally applying the 1-D median filter along the third direction (time)

temp = medfilt1(stack);

However, for some reason this is not working. When I try to view each frame, I get white images.

 frame1 = temp(:,:,1);
 imshow(frame1);

Any help would be appreciated! 

Expert Answer:

My guess is that this is actually working but frame1 is of class double and contains values, e.g. between 0 and 255. As imshow represents double images by default on a [0,1] scale, you obtain a white, saturated image.

I would therefore suggest: 

caxis auto

after imshow to fix the display problem.

Best, 

Why Matlabhelpers ?

Looking for reliable MATLAB assignment help? Our expert MATLAB tutors deliver high-quality, easy-to-understand solutions tailored to your academic needs. Whether you're studying at Monash University, the University of Sydney, UNSW, or the University of Melbourne, we provide trusted MATLAB assistance to help you excel. Contact us today for the best MATLAB solutions online and achieve academic success!

MATLAB Assignment Help Services

Personalized Tutoring: Get one-on-one guidance from our MATLAB experts. Whether you're tackling basic concepts or advanced algorithms, we provide clear, step-by-step explanations to help you master MATLAB with confidence.

Assignment Assistance: Struggling with tight deadlines or complex assignments? Our team offers end-to-end support, from problem analysis to code development and debugging, ensuring your assignments meet the highest academic standards.

Project Development: Need expert help with your MATLAB research project? We assist in designing and implementing robust solutions, covering project planning, data collection, coding, simulation, and result analysis.

Coursework Support: Enhance your understanding of MATLAB with our comprehensive coursework assistance. We help you grasp lecture concepts, complete lab exercises, and prepare effectively for exams.

Thesis and Dissertation Guidance: Incorporate MATLAB seamlessly into your thesis or dissertation. Our experts provide support for data analysis, modeling, and simulation, ensuring your research is methodologically sound and impactful.

Contact us on WhatsApp for MATLAB help

Contact us on Telegram for MATLAB solutions