A list,
1 Application background Pointer type mechanical dial has many advantages such as easy installation and maintenance, simple structure, anti-electromagnetic interference and so on. It is widely used in industrial and mining enterprises, energy and metering departments. With the increase of the number of instruments and the development of precision instrument technology, manual interpretation has been unable to meet the needs of practical applications. With the continuous development of computer technology and image processing technology, the automatic reading technology of pointer type mechanical watch arises at the historic moment. The technology improves the degree of automation and real time of dial recognition, and will be widely used instead of traditional industrial instrument reading. Objective (1) To understand the basic principle of automatic reading technology of mechanical dial. (2) Understand the basic methods and related algorithms of instrument dial recognition technology. (3) Learn to use MATLAB to realize image edge detection, image edge sharpening, binarization processing, Hough transform and other image processing technologies. 3 Principle According to the image characteristics of mechanical dial, the center location method of counting the normal direction of image edge points and the linear detection algorithm of passing the fixed point are adopted to achieve the target of dial recognition. The calibration detection process is as follows: the camera collects the dial image and sends it to the computer for preprocessing and edge detection; The computer detects the rotation center and radius of the dial, and locates the effective display area of the dial; In this region, Hough linear transformation of the over-fixed point (center of rotation) is used to identify the pointer center line based on the peak search algorithm of the corresponding Angle of the feature point, so as to output the detection results. Request (1) read a picture of an instrument. Read the image, the image preprocessing and edge detection operations. (2) The smoothing filtering method is used to process the image, and the edge of the image is sharpened at the same time. (3) Through the processing of the read instrument image, can clearly identify the dial pointer index, and has a more accurate identification accuracy.
Ii. Source code
function varargout = code(varargin) % CODE M-file for code.fig % CODE, by itself, creates a new CODE or raises the existing % singleton*. % % H = CODE returns the handle to a new CODE or the handle to % the existing singleton*. % % CODE('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in CODE.M with the given input arguments. % % CODE('Property','Value',...) creates a new CODE or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before code_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to code_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help code % Last Modified by GUIDE V2.5 05-Jan-2012 20:44:26 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @code_OpeningFcn, ... 'gui_OutputFcn', @code_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before code is made visible. function code_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to code (see VARARGIN) % Choose default command line output for code handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes code wait for user response (see UIRESUME) % uiwait(handles.figure1); backgroundImage = importdata('yalibiao.jpg'); axes(handles.axes1); image(backgroundImage); axis off; % --- Outputs from this function are returned to the command line. function varargout = code_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output; % --- Executes on selection change in listbox1. function listbox1_Callback(hObject, eventdata, handles) % hObject handle to listbox1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns listbox1 contents as cell array % contents{get(hObject,'Value')} returns selected item from listbox1 % --- Executes during object creation, after setting all properties. function listbox1_CreateFcn(hObject, eventdata, handles) % hObject handle to listbox1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: listbox controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); endCopy the code
3. Operation results
Fourth, note
Complete code or simulation consultation QQ1575304183