Fabbricazione PCB di precisione, PCB ad alta frequenza, PCB ad alta velocità, PCB standard, PCB multistrato e assemblaggio PCB.
La fabbrica di servizi personalizzati PCB e PCBA più affidabile.
Notizie PCB

Notizie PCB - Applicazione della tabella del codice della catena e della tabella del segmento di linea in PCB

Notizie PCB

Notizie PCB - Applicazione della tabella del codice della catena e della tabella del segmento di linea in PCB

Applicazione della tabella del codice della catena e della tabella del segmento di linea in PCB

2021-11-03
View:259
Author:Kavie

Application of Chain Code Table and Line Segment Table in PCB Hole Position Detection
Abstract: This article studies il positioning of printed circuit boards (Printed-Circuit Board) holes in the industry, and achieves the purpose of benchmarking the Scheda PCB punzonatrice. Effective pre-processing of the image acquired by the CCD, utilizzando la combinazione della tabella del codice della catena e della tabella del segmento di linea per determinare con precisione e rapidità il centroide della posizione del foro PCB. The method in this paper can detect the centroid accurately to 0.Livello pixel 001. And find out the area, perimetro, shape, e centroide del foro. This method runs successfully on the VC++6.0 piattaforma, and its programming speed is fast, e può raggiungere in tempo reale, accurate, intelligente, and batch inspection, che migliora notevolmente la qualità e la velocità di Scheda PCB inspection.

pcb


Introduction

Automated Optical Inspection (AOI, Automated Optical Inspection) is a visual inspection method that has emerged in recent years. It acquires images through CCD, e giudica difetti e malfunzionamenti attraverso elaborazioni e analisi informatiche. The application of AOI on the PCB production line has the advantages of fast detection speed, breve tempo di programmazione, and intelligent detection and control of images in large quantities. Con lo sviluppo della tecnologia industriale, the requirements for the aperture size of the Scheda PCB stanno diventando sempre più precisi, and the requirements for the mass production of machines are also getting higher and higher. Questo articolo è derivato da un progetto di una società che produce macchine per il conteggio dei fori. The technical requirement is that the minimum radius of the PCB hole position is 0.2mm, and there are as many as 2000 round holes on each PCB. Il tempo totale di elaborazione non è più di 10s. The result is obtained after processing. Il centro del cerchio è preciso a 0.01 pixel level, e la deviazione di ogni centro del cerchio dal centro del modello non deve superare 25um. If 80% of the center deviation exceeds this index, è considerato non qualificato, and the equipment benchmark needs to be adjusted.


"Edge" si riferisce alla raccolta di pixel nell'immagine che presentano un cambiamento graduale o un cambiamento simile al tetto nel livello di grigio pixel. It exists between target and background, obiettivo e obiettivo, region and region, primitivo e primitivo. He is very useful for image recognition and analysis. Il bordo può delineare il contorno dell'oggetto di destinazione, so that the observer can see it at a glance, and contains abundant information [1]. Pertanto, to obtain the hole position information, devi prima eseguire il rilevamento dei bordi e il tracciamento del contorno. Use the freeman chain code to trace the contour of the edge, e utilizzare la tabella del codice catena e la tabella del segmento di linea per memorizzare ed elaborare i dati.


1 Image acquisition and preprocessing


(1) This article uses backlighting and high-resolution cameras to obtain high-contrast and high-quality images. The image resolution is 409*096. The quality of the image source is very important, e influenzerà direttamente la successiva elaborazione delle immagini.


(2) Use median filtering to smooth the image, il cui scopo è quello di minimizzare o eliminare l'influenza del rumore e migliorare la qualità dell'immagine. Median filtering can overcome the blurring of image details caused by linear filters such as least mean square filtering and mean filtering under certain conditions, ed è il più efficace per filtrare l'interferenza dell'impulso e il rumore di scansione delle immagini. For the images involved in this article, the Scheda PCB Hole details are flawed, quindi il filtraggio mediano è più appropriato. Its advantage is that it can eliminate noise without destroying the edges of the image.


(3) Use OSTU (Maximum Between-Class Variance Method) for threshold segmentation. This method is simple, stabile ed efficace. It is a binarization method that automatically selects the threshold on the basis of judging the minimum function and the principle of the square method. L'idea è quella di dividere l'immagine L'istogramma è diviso in due gruppi con un certo livello di grigio. When the variance of the divided two groups is the largest, the gray level is set to the best threshold [2].


2 Use chain code table and line segment table [3] to describe the data results of the image


(1) Use Freeman chain code contour tracking Freeman chain code [4] is divided into eight-connected and four-connected chain codes. Il codice catena otto-connesso è definito dalla direzione in cui il pixel centrale punta ai suoi 8 vicini, and the four-connected chain uses the central pixel. Indicare la direzione dei suoi 4 vicini, with a value of 0ï½ 3. Questo articolo utilizza un codice catena a otto connessioni, come mostrato nella figura 2, the 8-connected chain code rotates in a clockwise direction, e il valore del codice della catena diminuisce di 1 quando ruota di 45 gradi in senso orario; se il valore del codice della catena aumenta di 4, the direction is reversed, è aggiunto 8. Then back to the original direction. Quando il valore del codice catena supera 8 o è inferiore a 0, use modulo 8 operation to remove or add 8.


(2) Application of chain code table


For the tracking of a single hole in the Scheda PCB, this article uses the Freeman chain code method to obtain the boundary chain code of the target object. Quando un certo punto viene cercato per il livello di grigio del corpo di destinazione, this point is the boundary point of the target body. Se questo punto non è stato codificato, then this point is the starting point of a certain hole position. Da questo punto, the contour tracking is carried out by Freeman chain code, e il valore del codice a catena di ogni punto sul confine può essere tracciato, and according to The deviation value of the coordinates of the center point and the neighboring points is shown in Table 1. Le coordinate di ciascun punto di confine possono essere ottenute dalle coordinate del punto di partenza, which can be expressed as a two-dimensional array inc[8][2].


Il processo di codifica specifico è: impostare il livello di grigio dell'oggetto target come G1 e il livello di grigio di sfondo come G2. Search the image of the entire Scheda PCB. Quando un certo punto A incontra il livello di grigio di G1, it is regarded as a boundary point. A partire da A, the boundary of the hole position is searched clockwise, e il valore iniziale è definito come il valore del codice catena pari a 4 Cerca il punto successivo nella direzione. If the gray value of the next point is equal to G1, è il prossimo punto di confine. Otherwise, la direzione di ricerca è ruotata di 45 gradi in senso orario, e il valore del codice catena è 3 per continuare a cercare il punto, so that the first point is always found A point B that satisfies the gray value equal to G1. Quindi imposta B come nuovo punto di confine, and set the tracking end flag to 0. Se non si trova alcun punto di confine nei punti vicini, set the tracking end flag to 1, indica che si tratta di un punto isolato.


Point B is taken as the new boundary point. Prendi il suo valore del codice della catena come direzione del codice della catena iniziale. Repeat the above tracking clockwise until the last boundary point is point A. Viene tracciata la bitmap a singolo foro, and Mark this area with color filling, che significa che è stato perquisito, and the tracked chain code value is stored in the chain code table. In questo articolo, the chain code table is stored in a one-dimensional integer array code[ ], i contenuti di archiviazione con sottoscrizioni 0 e 1 sono rispettivamente le coordinate X e Y del punto di confine iniziale, and the total chain code number is stored in the unit with subscript 2 The number N, a partire dall'unità con la sottoscrizione 3, store the chain code value of the first boundary point, il valore del codice catena del secondo punto di confine... until the chain code value of the last Nth boundary point.


3 Line segment table


(1) Definition of line segment table


Since the chain code table can only represent the boundary of the target body, but not the inside and outside of the boundary, la tabella del codice a catena non può rappresentare i pixel interni del corpo di destinazione, but in fact, oltre ad ottenere i punti di confine e il perimetro di un'immagine, it also obtains For other parameters, come i dati del centro del foro e l'area ottenuti in questo articolo, in order to realize the processing and calculation of the internal pixels, un'altra struttura-la tabella del segmento di linea è necessaria.


L'area può anche essere vista come composta da segmenti di linea orizzontali. Each line segment can be represented by its two end points. La tabella endpoint che organizza senza problemi tutti i segmenti di linea orizzontali nell'area in base alla scansione è chiamata tabella del segmento di linea. Each point of the line segment table is composed of two parts. Il punto pari rappresenta le coordinate del punto finale sinistro, and the odd-numbered point represents the coordinates of the right end point. Se una struttura DOT è definita per rappresentare la tabella del segmento di linea, use a one-dimensional array dot[ ], let i represent the line segment The left end of this line segment can be expressed as dot[2*i], and the right end point is dot[2*i+1].


(2) Application of line segment table


The line segment table obtains each line segment and the endpoint value of the line segment, so the internal pixels of the area can be easily obtained through calculations, e altri parametri importanti dell'immagine possono essere ottenuti, such as the parameters required in this article: the area of the calculation area, the center of gravity; Quickly fill a certain area (to avoid repeated searches and improve efficiency); the shape parameter of the area, the formula is expressed as: F = L*L/4 ÏS


The purpose of this project is to detect the center of the circular hole, so it is particularly important for the shape detection of the area. Nella formula di cui sopra, L is the circumference and S is the area. Il parametro forma F ottenuto da questo rapporto è il parametro forma del cerchio. 1. Maggiore è la differenza da 1, the greater the difference from the shape of the circle. Per contare il numero di fori nel foro PCB e il centro del cerchio, this shape parameter can be used for judgment. Se è vicino a 1, it can be approximated as The round hole is processed, altrimenti viene riempito direttamente con un segno di colore del foro non rotondo e non verrà registrato nel risultato.


(3) Conversion of chain code table to line segment table [5]


Use the line segment table to indicate that other important parameters of the image can be obtained, e la conversione dalla tabella del codice di catena alla tabella del segmento di linea può essere conforme alla tabella 2.


Specific steps are as follows:


After the conversion of the table, the chain code obtains three types [6]: middle point, tipo numero 0; punto finale sinistro, type number 1; right end point, tipo numero 2; punto singolare, type number 3. Secondo i dati nella tabella dei codici a catena, the incoming chain code value and the outgoing chain code value can be known, e il tipo di questo punto può essere determinato per la direzione dei due. In the program design, il tipo di punto può essere giudicato secondo la tabella 3. If it is the left and right end points, le coordinate sono memorizzate in una matrice temporanea. The singular point can be regarded as a coincidence of the same left and right points, che è, it should be stored twice, nel mezzo Non depositare punti. The endpoints in the line segment table are sorted by the size of the Y coordinate, e nella stessa riga sono ordinati per la dimensione della coordinata X.


4 Experimental results


This experiment takes a screenshot of the PCB image of this project to process, screenshot ed elabora l'immagine riempita.


Use the algorithm and program in this article to process the screenshots, e utilizzare la tabella del codice catena e la tabella del segmento di linea per memorizzare i dati, and you can get some parameter information of the PCB hole position.


5 Conclusion


In this paper, the backlight source is used to obtain high-quality Immagini PCB, Il metodo di segmentazione soglia OSTU e OSTU viene utilizzato per ottenere l'immagine binaria dell'immagine sorgente in modo stabile e semplice, scan and perform contour tracking, e utilizzare il principio di tracciare il punto successivo a destra. It is more prepared and time-saving. La tabella del codice di catena e la tabella del segmento di linea memorizzano i dati e l'elaborazione dei dati, ed è molto comodo e preciso ottenere il perimetro, area and hole centroid of the Scheda PCB, e risolvere con successo il problema di posizionamento quando il Scheda PCB is punched. This experiment has been run and verified on the Visual C++ software platform. It can detect and process 216 circular holes within 31 us, e ottenere la velocità e la precisione richieste da questo progetto. The results prove that this method is feasible.