T Haniszewski - Conversion of experimentalchartsto digital dataasa toolfor furtherprocessingof results - страница 1

Страницы:
1 

UDS 004.92:621.391

Haniszewski T. г. Катовице, Польша

CONVERSION OF EXPERIMENTALCHARTSTO DIGITAL DATAASA TOOLFOR FURTHER

PROCESSINGOF RESULTS

An article presents the problem of frequently occurring difficulties in analyzing the obtained research results. The problem is directly related to the lack of test stands adaptation to the modern research computing. Testing machines frequently have only an analogue record or are able only to read those measured data which were obtained directly on the test stand. What is more very often testing machines have the ability to plot a data only in graphical form. Article shows how to easily cope with the problem of reading out data based on the diagram image only.

Key words: MATLAB, conversion, image processing

Introduction

A common problem in the research results preparation is the inability to export data as a series of numerical values. The only possibility then is to made a screenshot an read the data manually. It is called "point by point reading". This process is time consuming and in order to improve it aspecific application was developed. The application enables to read the measuring points based on the analysis of a diagram image only.

The basis for reading the data is to have a graphical file in any format (lossless formats are recommended). BMP format is recommended in developed method (conversion on the BMP format is not a problem). The BMP file format, or BITMAP is called as a bitmap and this is the standard format in the Windows environment. It is the Windows environment where file size depends mainly on the number of colors included. As shown in Figure 1 the BMP file structure consists of four basic elements. In developed article two elements are interesting: color palette and pixel array.

Fig. 1. The BMP file structure [4]

Colourspalette

The first element after the BMP file heading is usually a colour palette. It is possible to distinguish two

cases:

8-bit palette modes consists of colours descriptions where each colour is described using 4 bytes (B, G, R, unused, or alpha). Each of the colour components should be divided by 4.

In modes with more than 256thcolor palette does not occur and the colour of the pixel in the image is recorded using the number of following colour, which is calculated from the formula (1) [4]:

Color.number = R + 256 • G + 65536 • B

(1)

.        value of red component, G - value of green component, B - value of blue where: * component

Figure 2 shows example of the picture parts. To theanalysis the simplest and the most convenient (for data processing) blackand white image was chosen. It consisting only binary elements.

2 colours

Fig. 2. Example of the picture (1 square - 4 pixels - zoom 800%) Pixel array, image import

Pixel arrayis the another element in the BMP file, where the image data are located. The image lines are written from bottom to top. Figure 3 shows the image in a matrix form.

cdata

 

1

1

1

1

1

1

1

 

1

1

1

1

1

1

1

 

1

1

1

1

1

0

0

 

1

1

1

1

1

0

0

 

1

1

1

0

0

1

1

 

1

1

1

0

0

1

1

 

1

0

0

1

1

1

1

 

1

0

0

1

1

1

1

0

0

1

1

1

1

1

1

0

0

1

1

1

1

1

1

1

1

1

1

1

1

1

1

colormap

0 0 0

1 1 1

Fig. 3.The image in fig. 2 was imported in the form of matrix, with acolour map

A key function is IMREAD [3] included in the package Matlab. It is used to read graphics formats, including BMP which is concerned in this paper. The syntax is as follows: A = imread (filename), because of this command the researcher is able to read colour images or images in a grayscale. Variable A is returned as a matrixcontaining the data of imported image. If the image is in a grayscale or black and white theMxN matrix is got (Fig. 3).

After the data importation two matrices are obtained. The first matrix contains the colour codes - "the colour-map". The second matrix is called as a pixel location matrix "CDATA" if the number of colors is less than the 256th. Image of figure 2 stored in the matrix is shown in Figure 3.

If the image contains more than 256th colours the MxNx3 matrix is obtained.MxNx3 matrix is the matrix where the colour code does not exist [1].

Image analysis

In order to convert the analyzed image is to made the series of action on the matrix containing the image of analyzed data. In order to demonstrate the results of the research the diagram in figure 4 was analyzed. Conversion process runs in several phases. The first step is to separate manually the diagram image, it means to erase axis, scale, etc.. The Image after step one is ready to analysis. In step two the "Meazure" [5] application was used to read the scale of the image. "Meazure" application enables reading the scale because of the number of pixels between successive values on the scale x and y axis are calculated in it (Fig. 5).

Fig 4. Real Signal, (image)

Knowing the number of the pixels between the values, the value of the scaling factor for x and y axis can be determinated. In this case, the scale measure is the numerical value of a one pixel, which implies the analysis accuracy. For the presented case:

OsX = 0,1( s )/48( px) OsY = 0,2(mm)/50( px)

(2)

Having the scale value and the matrix containing the image data, the pixel array need to be converted into distance matrix (the matrix containing the coordinates of each image pixel). To the matrix transformation the "FOR" [2] loop was used. Reading of the matrix (Fig. 6) is started from bottom to the top of each column, where the black pixels (with value "0") are stored in. The location matrix contains coordinates of the pixel values "0". For example the first matrix (the image data) column (Fig. 6) includes two black pixels, while those two pixels are recorded on the second and third position in location matrix, etc.

Fig 5. Distance measurement

Due to this process the position of pixel matrix for the y axis was founded out. Data for the x axis are read from the following column number in matrix. This location matrix contains the pixels location. Repeatability of the value depends on the number of pixels in the column. Author's application (program) code, which was written in Matlab is shown in table 1. Figure 7 shows a program flow chart which illustrate how the author's application (program) is running.

 

 

к 2

1

1

1

1

11

 

1

1

1

1

1

1

1 1

 

1

1

1

1

1

1

0 0

 

1

1

1

1

1

1

0 0

 

1

1

1

1

0

0

1 1

data =

1

1

1

1

о

1)

1 1

 

1

1

0

0

1

1

1 1

 

1

1

0

0

1

1

11

©

0

0

1

1

1

1

11

©

0

0

1

1

1

1

11

1

1

1

1

1

1

1

11

 

1...

2

 

 

 

 

 

location _ matrix

©355779 9 (2 2446688

1. 2

Fig 6. The way how to read matrix data and reading results.

Fig. 7. Program flow chart

Tab. 1

Program code

clearall; clc;

PLIK=input('Podaj nazwe pliku w formacie "nazwa.bmp" : ','s'); OBRAZ = imread(PLIK);

A=input('Podaj skale dla osi x np. (wartosc/ile pixeli):'); B=input('Podaj skale dla osi y np. (wartosc/ile pixeli):');

ILE_LITER = length(PLIK);

for k = 1:ILE_LITER if (PLIK(k) == '.') kropka = k;

NazwaPliku = PLIK(1:k-1);

end end

NazwaPliku = char(NazwaPliku); Rozszerzenie = '.xls';

NazwaPliku = [NazwaPliku,Rozszerzenie]; KONTROLA = isbw(OBRAZ); if KONTROLA == 0

level = graythresh(OBRAZ); OBRAZ = im2bw(OBRAZ,level);

end;

j=0;

ROZMIAR = size(OBRAZ);

for KOLUMNA=1:ROZMLAR(2)

j=0;

for i=1:ROZMIAR(1)

if OBRAZ(i,KOLUMNA) == 0; j=j+1;

MACIERZ_POLOZENIA(j,KOLUMNA) = ROZMIAR(

end;

end; end;

OS_X = 0;

j=0;

ROZMIAR = size(MACIERZ_POLOZENIA);

for KOLUMNA=1:ROZMIAR(2) for i=1:ROZMIAR(1)

if MACIERZ_POLOZENIA(i,KOLUMNA) ~= 0;

j=j+1;

OS_X(j) = KOLUMNA;

end;

end; end;

OS_Y = 0;

j=0;

ROZMIAR = size(MACIERZ_POLOZENIA);

for KOLUMNA=1:ROZMIAR(2) for i=1:ROZMIAR(1)

if MACIERZ_POLOZENIA(i,KOLUMNA) ~= 0;

j=j+1;

OS_Y(j) = MACIERZ_POLOZENIA(i,KOLUMNA);

end;

end; end;

i = 0;

ROZMIAR_OSI = size(OS_X);

for i=1:ROZMIAR_OSI(2)

OS_X(1,i) = OS_X(1,i) - 1; end;

i = 0;

ROZMIAR_OSI = size(OS_Y);

for i=1:ROZMIAR_OSI(2)

OS_Y(1,i) = OS_Y(1,i) - 1; end;

SKALA_Y = B;

OS_Y = SKALA_Y*OS_Y;

SKALA_X = A;

OS_X = SKALA_X*OS_X;

OS_X = OS_X';

OS_Y = OS_Y';

Opis = {'Droga [mmjVSila [N]'}; xlswrite(NazwaPliku,Opis, 1, 'B2');

DANE = [OS_X, OS_Y];

xlswrite(NazwaPliku,DANE, 1, 'B3'); % Koniec

Thanks to the author's program for image conversion the cloud of measuring point was obtained. As a results of author's program using, it was possible to received data directly as a XLS file. However, prior to graph drawing the data need to be moved to the starting point (in this case [0;0]). Figure 8 shows the obtained diagram in comparison to the original one.

-Inputdata --------data which was obtained during the image analysis

0,6

■0,6 J

t{s)

Fig. 8. Comparison of the real signal and the signal which was developed based on the image analysis

Fig. 9. The differences between the real signal and analyzed signal based on image

As shown in Figure 8 the differences between diagrams are insignificant and the time spent on the analysis is short. In order to show the detailed differences between the real and analyzed signal the results were shown in figure 9

Summary

Developed and described method of image analysis, with sufficient accuracy enable to reduce the time needed to prepare data to edition. However, it should be emphasized that the program needed to implement several additional modules, including automatic scale recognition, automatic diagram separation and ect.

"The work was co-financed by the European Union under the European Social Fund within the Project" Activation of the academic community, as part of the Regional Innovation Strategy "POKL.08.02.01-24-019/08." Numerical calculations were carried out in Matlab system, which was shared in the calculation grant. The grant number: MNiSW/IBM_BCHS21/PSl£iska/047/2011.

References

1. Holland O.T., Marchand P.:Graphics and GUIs with MATLAB, Third Edition,Naval Surface Warfare Center, Dahlgren, A CRC Press Company 2003

2. Manassah J. T.:Elementary Mathematical and Computational Tools for Electrical and Computer Engineers Using

MATLAB, A CRC Press LLC2001

3. Product Documentation. R2011a Documentation-MATLAB http://www.mathworks.com/help/techdoc/index.html

4. Wikipedia. BMP (format).http://pl.wikipedia.org/wiki/BMP_(format)

5. MeazureTM 2.0. http://www. cthing.com/Meazure.asp

Статья посвящена проблеме часто встречающихся сложностей при анализе полученных результатов исследований. Проблема напрямую связана с отсутствием у некоторых испытательных стендов адаптации к современной вычислительной технике. Испытательные машины зачастую используют только аналоговый способ записи или способны только считывать данные измерений, которые были получены непосредственно на стенде. Более того, очень часто испытательные машины имеют возможность построить данные только в графической форме.Статья показывает, как легко справиться с проблемой считывания данных на основе диаграммы только в графической форме.

Ключевые awsaiMATLAB, преобразование, обработка изображений

Стаття присвячена проблемі складнощів, які часто зустрічаються при аналізі отриманих результатів досліджень .Проблема пов'язана з відсутністю у деяких випробувальних стендів адаптації до сучасної обчислювальної техніки. Випробувальні машини часто використовують тільки аналоговий спосіб запису або здатні тільки зчитувати дані вимірювань, які були отримані безпосередньо на стенді. Більш того, дуже часто випробувальні машини маютьможливість побудувати дані тільки в графічній формі. Стаття показує, як легко впоратися з проблемою зчитування даних на основі діаграми тільки в графічній формі.

Ключові слова: MATLAB, перетворення, обробка зображень

Ханишевский Т.  магистр,   аспирант   кафедры   логистики   и   промышленного   транспорта Силезского технологического университета, г. Катовице, Польша

Рецензент:

д.т.н., проф. Сладковский А.

Страницы:
1 


Похожие статьи

T Haniszewski - Conversion of experimentalchartsto digital dataasa toolfor furtherprocessingof results