473,772 Members | 2,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Flicker detection with DFT Problem

Hello Everybody,
I'm not very experienced with DFT and FFTW library and I want to ask
your opinion about the results I get.
My aim is to determine if the sample input sequence is flickering with
some frequency.
In my project, I'm capturing frames from a video and geting the mean
pixel value of some pixels with a certain property. I get one mean
value for each frame. I want to check if these mean pixel values are
flickering with the time or staying flat in comparison (not changing
very much). For example:
if I'm capturing 25 frames per second, I can detect if the pixel mean
values are changing with a frequency close to 10Hz. if the input sample
to be used in DFT is like: 230, 212, 236, 214, 243,...
then I can say that values are changing up and down (flickering) with a
frequency near 10 Hz. If the output array has some positive values
corresponding to 8,9,10,11,12Hz' s I can classify this input sequence as
flickering.

In order to detect some frequencies in the sample input, I have used
the following code:
//n is the number of input samples
// averageRed is the array that holds the mean pixel values of each
frame

long double *in;
fftwl_complex *out;
fftwl_plan p;
in = (long double*) fftw_malloc(siz eof(long double) * n);
for (int i=0; i<n; i++){
in[i] = (long double)averageR ed[i];
}
out = (fftwl_complex* ) fftw_malloc(siz eof(fftwl_compl ex) *
averageIndex);
p = fftwl_plan_dft_ r2c_1d(n, in, out, FFTW_ESTIMATE);
fftwl_execute(p );
fftwl_destroy_p lan(p);
fftw_free(in);
for (int i=0; i<averageIndex ; i++){
fprintf(output, "output %d -%f, %f\n", i, out[i][0], out[i][1]);
}
fftw_free(out);

The resuls of this calculation are as follows:
First 15 input to the transform: 223.000000,195. 000000, 238.000000,
217.625000, 232.600000, 218.857143, 215.333333, 233.000000, 225.800000,
223.600000, 226.2857, 182.500000, 222.200000, 213.750000, 213.400000,
....
First 10 Outputs of the transform:
output 0 --2.000000, 0.000000
output 1 -0.000000, -2.000000
output 2 -0.000000, -0.000000
output 3 --2.000000, 0.000000
output 4 --0.000000, -2.000000
output 5 -0.000000, -0.000000
output 6 --2.000000, 0.000000
output 7 --0.000000, -2.000000
output 8 -0.000000, -0.000000
output 9 --2.000000, 0.000000
output 10 --0.000000, -2.000000

My questions are:
1-) It goes like: -2,0,0 until 264th output and later values are all 0
but the input array had 353 samples. Shouldn't it go until 176th frame
instead of the 264th?
*2-) The output values doesn't seem right to me. I think real parts
should not be negative and they should'nt repeat the same pattern!
3-) I should normalize the output by multiplying each output value by
25/353 (sample rate/N) right?

Hope that I can get some help about this.
Regards.

Jan 10 '07 #1
2 2015
Excuse me, I was going to send this to the comp.dsp mailing list. But I
would appreciate any help from here too ofcourse.
Sorry again.

Eren AYKIN yazdi:
Hello Everybody,
I'm not very experienced with DFT and FFTW library and I want to ask
your opinion about the results I get.
My aim is to determine if the sample input sequence is flickering with
some frequency.
In my project, I'm capturing frames from a video and geting the mean
pixel value of some pixels with a certain property. I get one mean
value for each frame. I want to check if these mean pixel values are
flickering with the time or staying flat in comparison (not changing
very much). For example:
if I'm capturing 25 frames per second, I can detect if the pixel mean
values are changing with a frequency close to 10Hz. if the input sample
to be used in DFT is like: 230, 212, 236, 214, 243,...
then I can say that values are changing up and down (flickering) with a
frequency near 10 Hz. If the output array has some positive values
corresponding to 8,9,10,11,12Hz' s I can classify this input sequence as
flickering.

In order to detect some frequencies in the sample input, I have used
the following code:
//n is the number of input samples
// averageRed is the array that holds the mean pixel values of each
frame

long double *in;
fftwl_complex *out;
fftwl_plan p;
in = (long double*) fftw_malloc(siz eof(long double) * n);
for (int i=0; i<n; i++){
in[i] = (long double)averageR ed[i];
}
out = (fftwl_complex* ) fftw_malloc(siz eof(fftwl_compl ex) *
averageIndex);
p = fftwl_plan_dft_ r2c_1d(n, in, out, FFTW_ESTIMATE);
fftwl_execute(p );
fftwl_destroy_p lan(p);
fftw_free(in);
for (int i=0; i<averageIndex ; i++){
fprintf(output, "output %d -%f, %f\n", i, out[i][0], out[i][1]);
}
fftw_free(out);

The resuls of this calculation are as follows:
First 15 input to the transform: 223.000000,195. 000000, 238.000000,
217.625000, 232.600000, 218.857143, 215.333333, 233.000000, 225.800000,
223.600000, 226.2857, 182.500000, 222.200000, 213.750000, 213.400000,
...
First 10 Outputs of the transform:
output 0 --2.000000, 0.000000
output 1 -0.000000, -2.000000
output 2 -0.000000, -0.000000
output 3 --2.000000, 0.000000
output 4 --0.000000, -2.000000
output 5 -0.000000, -0.000000
output 6 --2.000000, 0.000000
output 7 --0.000000, -2.000000
output 8 -0.000000, -0.000000
output 9 --2.000000, 0.000000
output 10 --0.000000, -2.000000

My questions are:
1-) It goes like: -2,0,0 until 264th output and later values are all 0
but the input array had 353 samples. Shouldn't it go until 176th frame
instead of the 264th?
*2-) The output values doesn't seem right to me. I think real parts
should not be negative and they should'nt repeat the same pattern!
3-) I should normalize the output by multiplying each output value by
25/353 (sample rate/N) right?

Hope that I can get some help about this.
Regards.
Jan 10 '07 #2
RKS
long double *in;
fftwl_complex *out;
fftwl_plan p;
Just a tip before posting to comp.dsp.

You may also want to give the header file where fftwl_complex and
fftwl_plan are defined. You have to provide complete code if you want
some one to help you. Its important that you dont loose the fractions
in the whole process.

RKS.

Jan 12 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3867
by: Marek Mänd | last post by:
This seems an IE issue only: 4253 bytes testcase: http://www.hot.ee/idaliiga/testcases/ieselect/bnlinkingselectinmsie.htm Can one have 1) a mouseover/mouseout element on TBODY 2) change in thoise event handler background colors 3) have a specified heighted SELECT element, that doesnt flicker when the event handlers are get called.
5
6672
by: Ian Stiles | last post by:
I have tried everything under the sun to get rid of horrible flashing and flickering that occurs on a CSharp form when the form hosts a TreeView or WebBrowser control and then you resize the form. Here is what I've tried so far: 1. Turning off CS_VREDRAW and CS_HREDRAW in both the parent form and a subclass of the control via the "override CreateParams" property (these values were already off). 2. Setting various styles and handling...
20
5114
by: Charles Law | last post by:
This is actually a follow on from yesterday's post about masking mouse clicks in a user control. The solution I have implemented - from Herfried - places a transparent window over the entire user control, which then uses the various mouse events to allow the user to drag the control without any clicks going through to the buttons and dropdowns on the control below. All well and good. However, I am getting an unsightly flicker when I...
3
3531
by: Per Dunberg | last post by:
Hi all, I have to develop a "skinned" application and I have a problem with the graphics. When a form is loaded and displayed there's aways a flicker where all the controls are located on the form. It seems like the controls erase the background and this cause a flicker everytime a form i loaded. When I hide and show forms that are already loaded there's no flicker, it's just when the form is loaded the first time.
3
5669
by: seamlyne | last post by:
The first method I ever used for multiple state buttons was to create a graphic for each button for each state: AboutUs_on, AbooutUs_over, AboutUs_out, etc. That works great when there are just a few buttons. I'm creating interfaces now with many more buttons than "just a few". I solved the maintenance problem by having generic button images, one for each state, and having them be background images for text containers, DIVs in this...
17
4756
by: pigeonrandle | last post by:
Hi, I have seen loads of different ways to do this, but the all seem to yield the same result - text that doesn't flicker when it's moving too slowly! Does anyone know 'the best way' to make text scroll... eg Override OnPain and OnPaintBackground Override WndProc
1
3661
by: Wayne | last post by:
I've noticed some screen flicker when using Access 2003 under Vista and I'm curious as to whether this is a bug or peculiar to my machine. In design view, if I make changes to a form and then close the form, a couple of seconds after I have OKed the save prompt the Database Window that shows all my objects gives one flicker. Once again, in design view if I change a property for a control in the Properties box and then move the mouse...
4
10761
by: Frank Rizzo | last post by:
Hello, I inherited a large Winforms project that is suffering from excessive flicker when switching between portions of the application. I've noticed that most parts of the application (user controls and forms) have DoubleBuffered set to true. In addition to that, in the constructor of every form and user control, there is this line: SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
0
1142
by: Rainer Queck | last post by:
Hello NG, I had/have a bad flicker Problem with my Application. On starting some applications, while my app was running, the whole Display started to flicker. Even the desktop Icons! Looking for help on this issue, I ran over a anser Linda Liu at : http://groups.google.de/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/39e9f7d0b96b048f?hl=de where I found the following (quick and dirty )solution to the flicker
10
3262
by: Conrad Lender | last post by:
In a recent thread in this group, I said that in some cases object detection and feature tests weren't sufficient in the development of cross-browser applications, and that there were situations where you could improve the application by detecting the browser vendor/version. Some of the posters here disagreed. Since then, I've had to deal with a few of these cases; some of them could be rewritten to use object detection, and some couldn't....
0
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.