Difference between revisions of "Dice Statistics"

From wwwelab
Jump to navigation Jump to search
Line 86: Line 86:
 
\bar{\mu} = \frac{6N+N}{2}
 
\bar{\mu} = \frac{6N+N}{2}
 
\]
 
\]
 +
 +
 +
<!--
 +
<div class="toccolours mw-collapsible mw-collapsed" style="width:800px">
 +
'''Manual de Utilização'''
 +
<div class="mw-collapsible-content">
 +
 +
É possível escolhermos os parâmetros todos da análise de imagem.
 +
 +
* ''Black&White Threshold'': para definir o valor, em escala de cinzento, acima do qual os pixéis ficam a branco.
 +
 +
* Para a Transformada de Hough:
 +
** ''Threshold1'': define o valor acima do qual um pixel da imagem da transformada de Hough é considerado para análise posterior;
 +
** ''Threshold2'': faz a média dos pixéis na vizinhança do pixel que passou o teste anterior e, se essa média for acima deste Threshold2, esse pixel é considerado para análise posterior;
 +
** ''Threshold3'': à partida, qualquer pixel detectado numa zona a branco do dado é desprezado, mas, se esse pixel apresentar uma média (calculada para o teste anterior) superior a este Threshold3, então esse pixel é aproveitado. Isto, porque os dados têm, por vezes, o centro das pintas a branco.
 +
 +
* Convolution Thresold: define o valor acima do qual um pixel da imagem da convolução é considerado para análise posterior;
 +
 +
* Propriedades dos dados:
 +
** Raio da pinta: raio esperado, em pixéis, para a(s) pinta(s) do(s) dado(s) ('''Nota:''' Este algoritmo espera que as pintas sejam circulares).
 +
** Largura do dado: distância máxima, em pixéis, entre pintas. Ou seja, para dados de 6 pintas, esta será a distância duma pinta num canto ao outro, na diagonal.
 +
** Número de dados esperado: quantidade de dados esperada. Se for detectada uma quantidade superior e alguns desses não forem detectados como "compatíveis" com dados, então estes serão eliminados ('''Nota:''' O algoritmo compara as posições das pintas com conjuntos detectados, com base na proximidade das pintas. Estes conjuntos são comparados com o que se espera obter num dado com a quantidade de pintas que esse conjunto tiver; se essa comparação der positiva, o conjunto fica marcado como "compatível", se não tenta-se fazer trocas e/ou eliminação de pintas até se obter conjuntos "compatíveis" com dados).</div>
 +
 +
</div>
 +
-->
 +
 +
 +
=Links=
 +
*[[Estatística de Dados | Portuguese version (versão em português)]]

Revision as of 17:09, 12 March 2013

Description

This experiment consists on a apparatus that automatically shuffle a set of six-sided dice. To count the spots, it acquires and process an image recognition pattern from the top side of each of these dice.

By recording the number of times each side appears, one can to study the law of probabilities and develop a statistical study of random phenomena. Using the images that this experiment outputs, one can also develop his own algorithms using them in the study of computer recognition software.

Links

  • Video: [unavailable]
  • Laboratory: Básico em e-lab.ist.eu[1]
  • Control room: Aleatório
  • Grade: ***
The #evp parser function was deprecated in EmbedVideo 2.0. Please convert your parser function tag to #ev.

<swf height="320" width="320">http://www.elab.tecnico.ulisboa.pt/anexos/descricoes-flash/EstatisticaDados.swf</swf>



Experimental Apparatus

In this experiment there is an loudspeaker positioned horizontally with a platform on top of the cone made of k-line (structured light cardboard with polyurethane), where fourteen dice are spread. Above it, at 300mm from the platform is a video camera equiped with a white high brightness LED to illuminate it.

Apparatus for the Dice Statistics experiment
Apparatus

The release (i.e. shuffling) of the dice is achieved trough the exciting of the speaker with a sound wave, which makes the platform to vibrate with the same frequency of the wave.

This platform has a wall that prevents the dice from leaving the platform (and the field of view of the web-cam). The wall is quite high to prevent the entry of light from outside of the lighting system.

With this apparatus, pictures are obtained as we can see in figure 2.

Figure 2: Photograph of the dice

The image processing is made according to the flowchart below and the result of this process leads to an image like the one in figure 3.

Figure 3: Figure 2 after software recognition
Fluxogram

Protocol

The execution protocol of the experience is simple because consists in excite, conveniently, the platform so that it can scramble the dice. And then, we describe the main features of the configurator control room for a better understanding thereof.

Figure 4: "Control room" configuration for the experiment

Dice shuffling

The dice are release (shuffled) by the oscillating movement of the platform where they are. The user can select the starting and ending frequencies of the sound wave that will be transmitted to the platform. This sound wave is synthesized on demand, there are no pre-recorded sound files.

The frequency can be chosen between 20Hz and 150Hz. Bellow 20Hz there is no response from the hardware to vibrate the platform; above 150Hz, the inertia "forces" a low amplitude motion, so the dice don't move.

The user can also choose the duration of the sound wave from 1.5 to 10 seconds. The lower value is enough for shuffle some of the dice at lower frequency but it will ultimately result in a small randomization. The upper limit allows very high randomization and is not even necessary in some cases.

Images

The user chooses how many frames should be analysed by choosing the number of samples between 1 and 20.

One sample can be used to check how the recognition software works (what are the steps and how long they take). With 20 samples the results start to show a distributions that evolves towards the Gaussian distribution (even though, in theory, this only happens after 30 samples, minimum).

Video

The user can choose whether or not to see the video of the shuffling process.

This video is composed of a series of .jpg pictures, which means that it is not an actual video, and the rate of display can change substantially with the connection quality.

Since the video feed has a high demand on the internet connection, the user is advised to use it only once, since it's purpose is merely to satisfy curiosity.

Advanced Protocol

After enough samples a graph can be constructed with the number of times each number is recorded in each bin and a Gaussian distribution can be fitted:

\[ p(x) = y_0 + A e ^{- \frac{(x- \mu)^2}{\sigma ^2}} \]

Figure 5: Example distribution

Since there are 14 dice, the expected mean value is 49 (why?) which is confirmed by the fitting to the build-up of values.

The best way to conduct this study is to merge the results of several users and see and the fit is improved with increasing number of samples.

The expected value for the average of N 6-sided dice is:

\[ \bar{\mu} = \frac{6N+N}{2} \]



Links