What is the fastest way to eliminate noise in the frames ?
Show older comments
What is the fastest way to eliminate noise in frames for real time applications?
I am asking specifically what is the fastest for noisy pixels for real time app?
7 Comments
The fastest way to eliminate noise is always to set the frame to a constant value, e.g.,
frame(:)=0
although that's usually a price people aren't willing to pay for the speed.
frame=imread('cameraman.tif');
subplot(1,2,1)
imshow(frame); title 'Frame'
subplot(1,2,2)
frame(:)=0;
imshow(frame); title 'Noiseless Frame'
M
on 4 Oct 2023
@M I was trying to imply that your original question is greatly under-formulated. There is no way to reduce noise in an image without accepting some degree of damage to its underlying contents, for example some degree of edge blur. The speed of a noise reduction method can depend in part on how much damage you are prepared to accept.
Therefore, because you only specifed a priority on speed without specifying a constraint on damage, I gave you a solution with the best speed and noise reduction under the assumption that you don't care about damage to the image contents at all.
Walter Roberson
on 4 Oct 2023
Are we to understand that this is a question related to Simulink Real-time Toolbox for running on Speedgoat hardware? Or are you using the Linux distribution that was designed to support real-time extensions and you are using MATLAB Coder to generate the code framework with dynamic memory allocation turned off? (You can't do real-time work when there is a variable amount of time needed to allocate memory.)
Answers (1)
Walter Roberson
on 9 Oct 2023
0 votes
What is the fastest way to eliminate noise in frames for real time applications?
The fastest way is to use zeros() to set the output to a constant value.
When you use zeros() specifically (no other function!) then internal short-cuts are used which save time in memory allocation.
But you should do timing tests comparing to calling https://www.mathworks.com/matlabcentral/fileexchange/31362-uninit-create-an-uninitialized-variable-like-zeros-but-faster which just might be slightly faster... not necessarily. Although uninitialized arrays should in theory be faster (since the operating system just needs to return the pointer to the area), it is common for memory controllers to have a Demand Zero memory allocation function that uses hardware assistance to zero the memory.
To be more explicit: the fastest way is to set the output to a constant without looking at the input at all -- and it is common for the special constant 0 to be the fastest constant to use to initialize.
If you want the input to somehow control the output, then the fastest thing to do is to use as little as the input as possible and do as little calculation with it as possible. Depending on the hardware, keeping all of the calculation within 8 bytes (one doublee) or 64 bytes or 128 bytes (varies with CPU) is fastest (a single "cache-line")
Categories
Find more on Video Formats and Interfaces in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
