V.Tekst's Application of the modelling program of definition of indications of the liquid crystal display


#ifndef CofAC unitH

#define CofAC_unitH









//Structure 4-bajtnogo pixel

union TPixel


unsigned int pixel4byte;



BYTE low;

BYTE middle;

BYTE high;

BYTE sign;

} part;


//Type-set (consists of possible indications of the segment indicator) enum TIndicatorSet {ind0, ind1, ind2, ind3, ind4, ind5, ind6, ind7, ind8, ind9,

empty, degree, minus};


class TfmMain: public TForm


__ published://IDE-managed Components

TImage *imInputImage;

TGroupBox *gbInputInfo;

TEdit *edInputFile;

TLabel *Label1;

TLabel *Label2;

TButton *bbLoad;

TGroupBox *gbOutput;

TSpeedButton *SpeedButton1;

TOpenDialog *OpenDialog;

TPanel *Panel1;

TLabel *Label3;

TLabel *lbMode;

TPanel *Panel2;

TLabel *Label5;

TLabel *lbResults;

TGroupBox *gbControl;

TBitBtn *bbRunControl;

TBitBtn *bbStopControl;

TRadioButton *rbSpeed;

TRadioButton *rbPetrol;

TRadioButton *rbTemperature;

TRadioButton *rbTemperature2;

TLabel *Label4;

TLabel *lbControlStatus;

void __ fastcall SpeedButton1Click (TObject *Sender);

void __ fastcall bbLoadClick (TObject *Sender);

void __ fastcall edInputFileKeyPress (TObject *Sender, char &Key);

void __ fastcall bbRunControlClick (TObject *Sender);

void __ fastcall bbStopControlClick (TObject *Sender); private:



//Function of a leading-out of a diagnostic message for an error

void ShowErrorMessage (void);

//Function of definition of presence/absence of a symbol

bool IsSymbolDefined (BYTE *pObject, unsigned short size, unsigned short limit);

//Function of definition of a symbol on a template from initial assemblage of templates

TIndicatorSet DefineSymbol (BYTE *pObject);

//Function of interpolation of the image by a method of bilinear interpolation

void BilinearInterpolation (BYTE *pImage, BYTE *pFinalImage,

unsigned int oldWidth, unsigned int oldHeight,

unsigned int newWidth, unsigned int newHeight);

//Function of removal of superfluous octads from the image

BYTE *ZipImage (Graphics:: TBitmap *pImage, unsigned int HeightOfImage,

unsigned int WidthOfImage);

//Function of algorithm of recognition of a picture

void RecognitionAlgorithm (Graphics:: TBitmap* pImage);

__ fastcall TfmMain (TComponent* Owner);

__ fastcall ~TfmMain ();



extern PACKAGE TfmMain *fmMain;



File «CofAC_unit.cpp»



#pragma hdrstop

#include "CofAC unit.h"



#pragma package (smart_init)

#pragma resource "*.dfm"

TfmMain *fmMain;

//Boundary numbers of black pixels for definition of presence/absence of symbols

const limitLitre = 52;//all = 69

const limitPerHundred = 213;//all = 284

const limitPerHour = 105;//all = 140

const limitKilometre = 233;//all = 310

const limitAccum = 171;//all = 228

const limitPetrol = 244;//all = 325

const limitPoint2 = 8;//all = 12

const limitCar = 158;//all = 210

const limitPoint1 = 8;//all = 19

const limitPark = 136;//all = 181

const limitAlarm = 82;//all = 109

const limitClock = 106;//all = 141

//Sizes of the final image




//Sizes of area of recognition for segment indicators const WIDTH_OF_INDICATOR = 48;


//Sizes of the initial image

unsigned int WidthOfImage;

unsigned int HeightOfImage;

//Containers for the image

Graphics:: TBitmap *pImage;

BYTE *Image;

BYTE *FinalImage;

//Containers for templates

Graphics:: TBitmap *pTemplate;

BYTE *Ind0;//Figure "0"

BYTE *Ind1;//Figure "1"

BYTE *Ind2;//Figure "2"

BYTE *Ind3;//Figure "3"

BYTE *Ind4;//Figure "4"

BYTE *Ind5;//Figure "5"

BYTE *Ind6;//Figure "6"

BYTE *Ind7;//Figure "7"

BYTE *Ind8;//Figure "8"

BYTE *Ind9;//Figure "9"

BYTE *IndDegree;//a grade Symbol

BYTE *IndMinus;//a minus Symbol

BYTE *IndEmpty;//It is empty

//Identifiers of streams xxxControlThread

DWORD dwSpeedControlThreadId;

DWORD dwTemperatureControlThreadId;

//Descriptors of streams xxxControlThread

HANDLE hSpeedControlThread = NULL;

HANDLE hTemperatureControlThread = NULL;

//Prototypes of functions of streams

DWORD WINAPI SpeedControlThread (LPVOID lpParam);

DWORD WINAPI TemperatureControlThread (LPVOID lpParam);

//Parameters of streams

DWORD dwSpeedCtrlThrdParam;

DWORD dwTempCtrlThrdParam;

//a Variable defining a regime of formation of operating signals/*unsigned char stateControlSignal; */


__ fastcall TfmMain:: TfmMain (TComponent* Owner)

: TForm (Owner)


//Loading of templates for recognition of indications of segment indicators pTemplate = new Graphics:: TBitmap ();

pTemplate-> LoadFromFile ("Pictures \\Templates \\0.bmp");//Figure "0"

Ind0 = ZipImage (pTemplate, pTemplate-> Height, pTemplate-> Width);

pTemplate-> LoadFromFile ("Pictures \\Templates \\1.bmp");//Figure "1"

Ind1 = ZipImage (pTemplate, pTemplate-> Height, pTemplate-> Width); pTemplate-> LoadFromFile ("Pictures \\Templates \\2.bmp");//Figure "2"

Ind2 = ZipImage (pTemplate, pTemplate-> Height, pTemplate-> Width); pTemplate-> LoadFromFile ("Pictures \\Templates \\3.bmp");//Figure "3"

Ind3 = ZipImage (pTemplate, pTemplate-> Height, pTemplate-> Width); pTemplate-> LoadFromFile ("Pictures \\Templates \\4.bmp");//Figure "4"

Ind4 = ZipImage (pTemplate, pTemplate-> Height, pTemplate-> Width); pTemplate-> LoadFromFile ("Pictures \\Templates \\5.bmp");//Figure "5"

Ind5 = ZipImage (pTemplate, pTemplate-> Height, pTemplate-> Width);

pTemplate-> LoadFromFile ("Pictures \\Templates \\6.bmp");//Figure "6"

Ind6 = ZipImage (pTemplate, pTemplate-> Height, pTemplate-> Width);

pTemplate-> LoadFromFile ("Pictures \\Templates \\7.bmp");//Figure "7"

Ind7 = ZipImage (pTemplate, pTemplate-> Height, pTemplate-> Width);

pTemplate-> LoadFromFile ("Pictures \\Templates \\8.bmp");//Figure "8"

Ind8 = ZipImage (pTemplate, pTemplate-> Height, pTemplate-> Width);

pTemplate-> LoadFromFile ("Pictures \\Templates \\9.bmp");//Figure "9"

Ind9 = ZipImage (pTemplate, pTemplate-> Height, pTemplate-> Width);

pTemplate-> LoadFromFile ("Pictures \\Templates \\degree.bmp");//a grade Symbol

IndDegree = ZipImage (pTemplate, pTemplate-> Height, pTemplate-> Width); pTemplate-> LoadFromFile ("Pictures \\Templates \\minus.bmp");//a minus Symbol

IndMinus = ZipImage (pTemplate, pTemplate-> Height, pTemplate-> Width); pTemplate-> LoadFromFile ("Pictures \\Templates \\empty.bmp");//Empty IndEmpty = ZipImage (pTemplate, pTemplate-> Height, pTemplate-> Width); delete pTemplate; pTemplate = NULL;



//Destruktor forms--------------------------------------------------------

_ fastcall TfmMain:: ~TfmMain ()


//Clearing of memory from under containers for templates

delete [] Ind0; Ind0 = NULL;

delete [] Ind1; Ind1 = NULL;

delete [] Ind2; Ind2 = NULL;

delete [] Ind3; Ind3 = NULL;

delete [] Ind4; Ind4 = NULL;

delete [] Ind5; Ind5 = NULL;

delete [] Ind6; Ind6 = NULL;

delete [] Ind7; Ind7 = NULL;

delete [] Ind8; Ind8 = NULL;

delete [] Ind9; Ind9 = NULL;

delete [] IndDegree; IndDegree = NULL;

delete [] IndMinus; IndMinus = NULL;

delete [] IndEmpty; IndEmpty = NULL;

//End of streams

CloseHandle (hSpeedControlThread); CloseHandle (hTemperatureControlThread);



//Functions of work with ports------------------------------------------------

//Function of feeding into of octad of the information from port

BYTE inportb (UINT portid)


unsigned char value;


mov edx, portid

in al, dx

mov value, al


return value;


//Function of a leading-out of octad of the information in port

void outportb (UINT portid, BYTE value)



mov edx, portid

mov al, value

out dx, al




//Function of a stream of formation of control actions---------------------

DWORD WINAPI SpeedControlThread (LPVOID lpParam)


//the Leading-out in impulse signal port LPT1

for (;;)


outportb (0x378, 0x01);

Sleep (3);

outportb (0x378, 0x00);

Sleep (3);




//Function of a stream of formation of control actions---------------------

DWORD WINAPI TemperatureControlThread (LPVOID lpParam)


//the Leading-out in port LPT1 of a signal of constant voltage



mov edx, 0x378

mov al, 0x03

@out: out dx, al

jmp @out




//Function of sampling of a file of a picture

void __ fastcall TfmMain:: SpeedButton1Click (TObject *Sender)


if (OpenDialog-> Execute ())


//we Will inferred a full way to a picture file

edInputFile-> Text = OpenDialog-> FileName;

//we Will load a picture

bbLoad-> Enabled = true;

bbLoadClick (Sender);




//Function of representation of a picture on the shield and start of process of recognition void fastcall TfmMain:: bbLoadClick (TObject *Sender)


//Preparation for work

lbMode-> Caption = "";

lbResults-> Caption = "";

lbMode-> Font-> Color = clNavy;

lbResults-> Font-> Color = clNavy;

//we Will represent a picture on the shield if it matches to a format of 1 bit/pixel

pImage = new Graphics:: TBitmap (); pImage-> LoadFromFile (edInputFile-> Text);

if (pImage-> PixelFormat! = pf1bit)


MessageBox (Handle, "the Initial file has an inadmissible format", "the Error!", MB_OK | MB_ICONSTOP | MB_APPLMODAL);

delete pImage; pImage = NULL;



imInputImage-> Picture-> LoadFromFile (edInputFile-> Text);

//we Will count sizes of an initial picture

WidthOfImage = pImage-> Width;

HeightOfImage = pImage-> Height;

//we Will start recognition process

RecognitionAlgorithm (pImage);



//Function of removal of superfluous octads from the image

/* On an entry: an index copy on an initial picture, altitude and width of the image

On an exit: an index copy on the final container


BYTE *TfmMain:: ZipImage (Graphics:: TBitmap *pImage,

unsigned int HeightOfImage, unsigned int WidthOfImage)


Image = new BYTE [HeightOfImage * WidthOfImage];//memory Allocation

//container Filling

TPixel pixel = Ї0};

unsigned int index = 0;

for (unsigned int y = 0; y Pixels [x] [y]; Image [index] = pixel.part.low;//a low-order byte


return Image;



//Function of interpolation of the image by a method of bilinear interpolation void TfmMain:: BilinearInterpolation (BYTE *pImage, BYTE *pFinalImage,

unsigned int oldWidth, unsigned int oldHeight,

unsigned int newWidth, unsigned int newHeight)


unsigned int i, j;//Index variables

int y, x;//New values of pixels

double dy, dx;//Deviations from old values of pixels

double tmp;

for (j = 0; j Color = clRed;

lbResults-> Caption = "the Error in indications!";

delete [] FinalImage; FinalImage = NULL;//to Free memory



//Function of algorithm of recognition of a picture

//On an entry: an index copy on an initial picture

void TfmMain:: RecognitionAlgorithm (Graphics:: TBitmap* pImage) Ї

//1. Reduction of an initial picture to an aspect 1bajt/pixel

Image = ZipImage (pImage, HeightOfImage, WidthOfImage); delete pImage; pImage = NULL;//to Free memory


Picture interpolation (a dimensional change on 256х91 pixels) FinalImage = new BYTE [SIZE_OF_FINAL_IMAGE];

BilinearInterpolation (Image, FinalImage, WidthOfImage, HeightOfImage, WIDTH_OF_FINAL_IMAGE, HEIGHT_OF_FINAL_IMAGE);

delete [] Image; Image = NULL;//to Free memory

//3. Binarizatsija

for (unsigned short i = 0; i Enabled = false;

rbPetrol-> Enabled = false;

rbTemperature-> Enabled = false;

rbTemperature2-> Enabled = false;

bbRunControl-> Enabled = false;

bbStopControl-> Enabled = true;

lbControlStatus-> Caption = "is switched on";



//Function of the termination of control action

void __ fastcall TfmMain:: bbStopControlClick (TObject *Sender)


//Definition of stopped affecting

if (rbSpeed-> Checked)

SuspendThread (hSpeedControlThread);

if (rbTemperature-> Checked)

SuspendThread (hTemperatureControlThread);

//Representation of change of conditions

rbSpeed-> Enabled = true;

rbPetrol-> Enabled = true;

rbTemperature-> Enabled = true;

rbTemperature2-> Enabled = true;

bbRunControl-> Enabled = true;

bbStopControl-> Enabled = false;

lbControlStatus-> Caption = "is switched out";



<< | >>
A source: Lysenko JAn Aleksandrovich. MODEL, the METHOD And the OPTIKO-ELECTRONIC DEVICE of PARALLEL MACHINING of IMAGES of INDICATORS of the PANEL of DEVICES. The dissertation on competition of a scientific degree of a Cand.Tech.Sci. Kursk - 2019. 2019

More on topic V.Tekst's Application of the modelling program of definition of indications of the liquid crystal display:

  1. 3.6.2 machining of the image of the liquid crystal display apparatus-oriented algorithm
  2. Mathematical model of machining of the image of the liquid crystal display
  3. About a procedure of examination of change of the shape and structural performances nanochastits at phase transition a crystal-liquid
  4. Function of definition of indications of indicators
  5. 3.2 Definition of parametres of the liquid affiliated to a mechanical pendulum
  6. 1.2. Indications and possibilities of application of a method kriokonservatsii oocytes in programs VRT
  7. Reliability of results of work of algorithms of definition of indications of indicators
  8. 2.2 Working out of the program «POLIFUN" for modelling of process of rectification
  9. 2.3 Program of statistical modelling «REGMOD»
  10. the Technique of numerical modelling by means of program complex ANSYS
  11. Appendix A. The text of the modelling program of calculation of the schedule of diagnosing
- Acoustic devices and systems - Aerials, OHF devices and their technologies - Aerodynamics and processes of heat exchange of flying machines - Automation and management of technological processes and manufactures (on branches) - Aviation and space-rocket technics - Bases and the bases, underground constructions - Biotechnology of foodstuff (on branches) - Building - Building designs, buildings and constructions - Building materials and products - Building mechanics - Cars, motor industry - Chemical technology of fuel and high-energy substances - Chemistry technology - Computer science, computer facilities and management - Computers and systems - Control and test of flying machines and their systems - Designing and a design of courts - Designing and building of roads, undergrounds, airdromes, bridges and transport tunnels - Designing, a design and manufacture of flying machines - Devices and a quality monitoring of an environment, substances, materials and products - Devices and measurement methods by kinds of measurements - Devices and methods for measurement of an ionising radiation and x-ray devices - Devices and methods of transformation of images and a sound - Devices, systems and products of medical appointment - Document-knowledge, архив-knowledge - Documentary information - Durability and thermal modes of flying machines - Dynamics, ballistics, traffic control of flying machines - Electrical engineer - Electromecanics and electric devices - Electronics - Electrotechnical complexes and systems - Electrotechnical materials and products - Electrotechnologies and an electric equipment in agriculture - Electrotechnology - Elements and devices of computer facilities and control systems - Energy devices on the basis of renewed kinds of energy - Engineering geometry and computer drawing - Engineering geometry and computer drawing - Engineering technology - Fire and industrial safety (on branches) - Foundry manufacture - Friction and deterioration in machines - Goodsknowing foodstuff and technology of products of public catering - Goodsknowing the industrial goods and light industry raw materials - Heat supply, ventilation, an air conditioning, gas supply and illumination - Hromatogrophy and Hromatogrophyses devices - Hydraulic engineering building - Hydraulic machines and Hydropneumaticunits - Hydraulics and an engineering hydrology - Industrial fishery - Industrial power system - Information systems and processes, legal aspects of computer science - Information-measuring and operating systems (on branches) - Instrument making, metrology both information-measuring devices and systems - Knowing machines, systems of drives and a detail of machines - Labour safety (on branches) - Land complexes, the starting equipment, operation of flying machines - Library science and bibliology - Light engineering - Machines and devices, processes of refrigerating and cryogenic technics, central airs and life-support - Machines, units and processes (on branches) - Management in social and economic systems - Management of processes of transportations - Manufacture Organization (on branches) - Materials Science - Materials technology (on branches) - Materials technology of manufactures textile and light industry - Mathematical and software of computers, complexes and computer networks - Mathematical modelling, numerical methods and complexes of programs - Mechanical engineering and knowing machines - Membranes and membraneses technology - Metallurgical science and thermal processing of metals - Metallurgy - Metallurgy of black, colour and rare metals - Metallurgy of technogenic and secondary resources - Methods and systems of protection of the information, информационня safety - Metrology and metrological maintenance - Motor transport Operation - Mountain machines - Navigation and an air traffic control - Navigation Devices - Nuclear and radiating safety - Nuclear power installations, including designing, operation and a conclusion from operation - Nuclear reactor building, machines, units and technology of materials of the nuclear industry - Operation of air transport - Optical both optiko-electronic devices and complexes - Physical fields of the ship, ocean, atmosphere and their interaction - Powder metallurgy and composite materials - Power - Power electronics - Power plants and power systems - Power systems and complexes - Power, metallurgical and chemical mechanical engineering - Processes and devices of chemical technologies - Processes and devices of food manufactures - Processes and machines of agroengineering systems - Processing of constructional materials in mechanical engineering - Processing of metals by pressure - Quality monitoring and diagnostics in mechanical engineering - Quantum electronics - Radar-location and radio navigation - Radio engineering and communication - Radio engineering, including systems and TV devices - Radio measuring devices - Road, building and hoisting-and-transport machines - Robots, mechatroniks and roboticses systems - Rolling stock of railways, draught of trains and electrician - Safety in extreme situations (on branches) - Safety of activity of the person - Sailing charter Operation, navigation - Ship power installations and their elements (main and auxiliary) - Shipbuilding - Solid-state electronics, radio-electronic components, micro-and наноэлектроника on quantum effects - Standardization and product quality control - System analysis, management and information processing (on branches) - Systems of automation of designing (on branches) - Systems, networks and devices of telecommunications - Technical aesthetics and design - Technical science - Technics of high pressure - Technologies and machines of processing by pressure - Technologies and machines Weldining manufactures - Technologies and maintenance service means in agriculture - Technologies and means of mechanisation of agriculture - Technology and building organisation - Technology and equipment for manufacture of semiconductors, materials and devices of electronic technics - Technology and a preprocessing of textile materials and raw materials - Technology and machines of timber cuttings and a forestry - Technology and processing of polymers and composites - Technology and the equipment of chemical processing of a biomass of a tree; wood chemistry - Technology and the equipment of mechanical and physicotechnical processing - Technology of a skin and fur - Technology of electrochemical processes and protection against corrosion - Technology of fats, essence and perfumery-cosmetic products - Technology of food products - Technology of garments - Technology of inorganic substances - Technology of instrument making - Technology of materials and products textile and light industry - Technology of meat, dairy and fish products and refrigerating manufactures - Technology of mechanical engineering - Technology of organic substances - Technology of processing, storage and processing of cereal, bean cultures, groats products, fruits-vegetables production and wine growing - Technology of rare, absent-minded and radioactive elements - Technology of shipbuilding, ship repair and organisation of ship-building manufacture - Technology of shoe and kozhevenno-notions products - Technology of silicate and refractory nonmetallic materials - Technology of sugar and sugary products - Technology of tea, tobacco and biologically active substances and subtropical cultures - Technology, machines and the equipment of timber cuttings, a forestry, tree-processings and chemical processing of a biomass of a tree - Telecommunication systems and computer networks - Theoretical bases of computer science - Theoretical the electrical engineer - Theory of mechanisms and machines - Theory of the ship and building mechanics - Thermal engines - Thermal power plants, their power systems and units - Thermal, electrorocket engines and energydevice flying machines - Track, research and designing of railways - Transport - Transport and transportno-technological systems of the country, its regions and cities, manufacture organisation on transport - Transport, mountain and building mechanical engineering - Turbomachines and combined turbounits - Vacuum and plasma electronics - Vacuum, compressor technics and pneumatic systems - Water supply, water drain, building systems of protection of water resources - Waterways of the message and hydrography - Wheel and tracklaying vehicles - Wood-knowledge, technology and the equipment tree-processings -