Facilea (Visual Programming Tool For Image Processing) : CKD Corporation

Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

311A-00300A/3

Facilea (Visual programming tool for image processing)

Tutorial

CKD Corporation
311A-00300A/3

Contents
1. Basic procedures ......................................................................................................... 2
2. Basic information of image data ................................................................................. 3
3. Load the image ............................................................................................................. 4
4. Pre-process the image ................................................................................................. 6
4.1 Change the color image to gray image ................................................................................ 6
4.2 Binarize the image ................................................................................................................. 8

5. Measure the image ......................................................................................................10


5.1 Measure the area ................................................................................................................. 10
5.2 Measure the distance .......................................................................................................... 12
5.3 Count the number of objects .............................................................................................. 16
5.4 Judge OK/NG ....................................................................................................................... 17

6. Output the result .........................................................................................................19


6.1 Output the input image ....................................................................................................... 19
6.2 Output the result to CSV ..................................................................................................... 22
6.3 Output the result with sound .............................................................................................. 24

7. Turn the light on ..........................................................................................................26


8. Link with external system ...........................................................................................28
8.1 Link with CONTEC digital input/output .............................................................................. 28
8.2 Link with timer ..................................................................................................................... 30

1
311A-00300A/3

1. Basic procedures

Procedure 1
Connect the blocks in the toolbox pane to the flow pane to create an image processing flow that meets
the purpose.
The blocks in the flow pane are executed in order from the top.

Image
processing
flow

Lighting

Toolbox Flow Detail


Image
input
1 Drag & drop

Pre-
process

2 Click & set


Main
process

Block
Output

Procedure 2
Click a block in the flow pane to make it selected and make necessary settings.

Procedure 3
Click the flow execution button on the menu bar to see the result in the detail pane.
When necessary, make changes to the settings in the detail pane, and then click the flow execution
button.

3 Flow execution button

2
311A-00300A/3

2. Basic information of image data

This section describes the basic information of image data.


An image is a collection of many pixels. A pixel is the smallest element, or unit, of information that makes
up an image. A square with one color that can be seen in the enlarged image below is the pixel.

Pixel

Enlarged image

A pixel contains information on brightness and color, and the numerical representation of this information
is called a pixel value.
Brightness is expressed as a pixel value from 0 to 255, and the larger the value, the brighter the color
(closer to white in the case of a gray image).

0 (Black) 127 (Gray) 255 (White)

The color information is expressed with the three primary colors red, green, and blue, each of which has
brightness information (0 to 255) in the RGB model. The color of each pixel is expressed as a
combination of the RGB values (0 to 255 x 3 colors).

B
0 127 255

This is the end of the section describing the basic information of image data.

3
311A-00300A/3

3. Load the image

Here is the instruction on loading an image saved in PC.

Select "Image input" in the toolbox pane and drag and drop block into the
adjacent flow pane.

Click the added block to make it selected.

Click in the added block to select the image.


In this state, click the flow execution button on the menu bar.

4
311A-00300A/3

The flow has been executed successfully if the image is displayed in the detail pane.

If block is deselected by clicking anywhere other than this block, the image is
not displayed in the detail pane.

To delete a block from the flow pane, drag and drop the block into the toolbox pane.

● How to input image with a camera

Set the following parameters.


Serial number: Set the serial number of the connected camera.
Exposure time: The higher the value, the brighter the image.
Gain: The higher the value, the brighter the image but the image quality may be worse.

5
311A-00300A/3

4. Pre-process the image

4.1 Change the color image to gray image


When measuring area and distance, it is necessary to change the image to a gray image.

Here is the instruction on changing the loaded color image to a gray image.

Select "Pre-process" in the toolbox pane and drag and drop block into the
adjacent flow pane.

Click the added block to make it selected.

In this state, click the flow execution button on the menu bar.

6
311A-00300A/3

The flow has been executed successfully if the gray image is displayed in the detail pane.

7
311A-00300A/3

4.2 Binarize the image


Binarization is a pre-process step that divides the pixel information in an image into two values
corresponding to white and black.

0 (Black) 127 (Gray) 255 (White) Threshold

When measuring in the main process, binarization is performed to make the measurement range stand
out.

Here is the instruction on binarizing the loaded image.

Select "Pre-process" in the toolbox pane and drag and drop block into the
adjacent flow pane.
After adding the block, set the threshold in the block.

After setting the threshold, click the added block to make it selected.

In this state, click the flow execution button on the menu bar.

8
311A-00300A/3

The flow has been executed successfully if the binarized image is displayed in the detail pane. If the
input image is a color image, R: Red, G: Green, and B: Blue are binarized respectively.

There are various other pre-processing blocks such as color extraction and filtering.

9
311A-00300A/3

5. Measure the image


5.1 Measure the area
Here is the instruction on measuring the area of an object from a binarized image.

Select "Main process" in the toolbox pane and drag and drop block into the adjacent
flow pane.

Click the added block to make it selected.

In this state, click the flow execution button on the menu bar.

10
311A-00300A/3

The measured value of the area is displayed in the detail pane for the selected block.
The measured value of the area is the number of pixels that have a value other than 0.
In case of a binarized image, the number of white pixels (pixel value: 255) is the measured value of the
area.
A threshold can be set to judge whether the object is OK or NG.

● How to measure only a part of the image


To perform the main process only on a part of the image, set the region of interest (ROI).
There are five options to choose from.
・ Entire image :Perform main process on the entire image.
・ Origin + Size :Set the upper left coordinates and the size of the region of interest.
・ 4 Sides :Set the top, bottom, left, and right positions.
・ Center + Size :Set the center coordinates and the size of the region of interest.
・ Fixed region setting :Set the region of interest by clicking the "..." button.

After setting the region of interest, click and display "Measurement".

11
311A-00300A/3

5.2 Measure the distance


Here is the instruction on measuring the edge distance of an object from a binarized image.

Select "Main process" in the toolbox pane and drag and drop block into the
adjacent flow pane.

Click the added block to make it selected.

Selecting the block makes "Measurement" selected in the detail pane. Select "Setting".

12
311A-00300A/3

Next, set the setting items.


Edge detection threshold: If the difference between adjacent pixel values is greater than or equal to this
threshold, that boundary is determined to be the edge detection position.
Edge detection direction: For vertical, edge detection is performed for each column between top and
bottom.
For horizontal, edge detection is performed for each row between left and right.

After setting the setting items, click the added block to make it selected.
In this state, click the flow execution button on the menu bar.

The measured value of the distance is displayed in the detail pane for the selected block.

The measured items are as follows:


Max. distance: The maximum value among the detected edge distances is displayed.
Min. distance: The minimum value among the detected edge distances is displayed.
Avg. distance: The average value of the detected distances is displayed.
A threshold can be set to judge whether the object is OK or NG.

13
311A-00300A/3

In this section, the edge detection threshold and edge detection direction are explained using a sample
image (gray image).

Sample image

1) Edge detection threshold: 50 2) Edge detection threshold: 49

A change is made to the edge detection threshold of the sample image. The edge detection position is
shown in red. Changing the edge detection threshold from 50 to 49 has changed the edge detection
position. (When the threshold is 50: the boundary between white and gray; when the threshold is 49: the
boundary between gray and black)

To measure the edge detection distance between top and bottom, set the edge detection direction to
vertical.
To measure the edge detection distance between left and right, set the edge detection direction to
horizontal.

14
311A-00300A/3

1) Edge detection direction: Vertical

2) Edge detection direction: Horizontal

15
311A-00300A/3

5.3 Count the number of objects


Here is the instruction on measuring the number of white (pixel value: 255) objects from a binarized
image.

Select "Main process" in the toolbox pane and drag and drop block into the adjacent
flow pane.

Click the added block to make it selected.

In this state, click the flow execution button on the menu bar.

The measured value of the number of objects is displayed in the detail pane for the selected block.

16
311A-00300A/3

5.4 Judge OK/NG


Here is the instruction on judging OK/NG using the result of the area measurement described in 5.1.
The result of the measurement in 5.1 shows that the measured value is 113688.

Next, put a check next to the measurement item "Area". The check allows the threshold to be entered.
If the measured value is within the range of the threshold, it is judged OK; if it is outside the range, it is
judged NG.
Based on the measured value, set the threshold to "110000 to 120000".

In this state, click the flow execution button on the menu bar.

17
311A-00300A/3

The result is displayed in the block and in the judgment result in the detail pane.

Following is the result of the inspection conducted on a different workpiece using the same flow. The
measured value is 79627; and therefore, the judgment result shows NG.

18
311A-00300A/3

6. Output the result


6.1 Output the input image
Here is the instruction on outputting the input image from the result of executing the flow.

Select "Output" in the toolbox pane and drag and drop block into the adjacent
flow pane.

Click the added block to make it selected.

The detail pane for block is displayed.

19
311A-00300A/3

Next, make the settings in the detail pane.


A) Outputting by selecting "Specify folder"
There are five setting items.
First file name: Set the first character string of the name of the file to be saved.
Save folder: Set the folder path for saving the images.
Image format: Set the format (.bmp, .png, .jpg) for saving the images.
Switch folder: 1) None: Folders are not switched.
2) Date: A folder is created and switched by the date.
3) 1 hour: A folder is created and switched by the hour.
Save only NG: Put a check if only the images for which the judgment result is NG are to be saved.

Set each item and execute the flow.


As a result, since "Date" is selected for "Switch folder" in the example, a file folder with the date in its
name is created in the specified folder.

First file name + date + time is inserted in the file name, and the image is output in the bmp format (the
specified format).

20
311A-00300A/3

B) Outputting by selecting "Specify file name"

Specify the file name and image format (bmp, png, jpg).

After setting "Save file name", execute the flow.


As a result, the image with the specified file name + image format is output to the specified folder.

21
311A-00300A/3

6.2 Output the result to CSV


Here is the instruction on outputting the result of executing the flow to CSV.

Select "Output" in the toolbox pane and drag and drop block into the
adjacent flow pane.

Click the added block to make it selected.

The detail pane for block is displayed.

22
311A-00300A/3

Specify the CSV file to save with "Save file name".


Use the "Add item" button to add items to output to CSV.

After adding the items, select "ID", "Measurement item", and "Target".
For "ID", specify the ID of the main process block.
For "Measurement item", specify the measurement item to output from the main process block.
For "Target", specify "Measurement value" or "Judgment result".

Executing the flow with this setting will output the results to CSV every time it is executed.

The time data when the flow is executed is automatically output in the first column.

23
311A-00300A/3

6.3 Output the result with sound


Here is the instruction on outputting the result of executing the flow with sound.

Select "Output" in the toolbox pane and drag and drop block into the adjacent flow
pane.

Click the added block to make it selected.

The detail pane for block is displayed.

24
311A-00300A/3

Next, these are the setting items.


OK Sound File: Set the sound to be played when the judgment result is OK. (File is set in WAV format.)
NG Sound File: Set the sound to be played when the judgment result is NG or Error.

Executing the flow after making the above settings will output the sound that corresponds to the result.

The results can be output in other file formats such as JSON.

25
311A-00300A/3

7. Turn the light on


The light can be turned on using the CONTEC digital input/output terminal.
* Devices such as CONTEC digital input/output terminal and lighting power source unit are required
separately to turn the light on.
The system overview diagram is shown below.

System overview diagram:

Input/output Lighting power


PC Lighting
terminal source unit

I. Set the pin number to output with Facilea.


II. The ON signal of the set pin number is input to the lighting power source unit.
III. The lighting power is output by the ON signal of the input/output terminal, and the light
turns on.

Select "Lighting" in the toolbox pane and drag and drop block into the

adjacent flow pane.

Click the added block to make it selected.

26
311A-00300A/3

Set the name of the device to be used and the output pin number. In this state, click the flow execution
button on the menu bar.
The lighting wait time is the time after the light is turned on until the camera takes an image.

27
311A-00300A/3

8. Link with external system


When linking with the external system, the server mode is used.

Click the server mode button on the menu bar to switch from the edit mode.

8.1 Link with CONTEC digital input/output


Execute the flow using the input port of CONTEC digital input/output terminal as the trigger.
*Input/output signal wires from the CONTEC digital input/output terminal are required separately.
Click the server mode button on the menu bar to switch from the edit mode.

Next, drag and drop block from the toolbox pane into the adjacent flow
pane.

After adding the block, click the added block to make it selected.

28
311A-00300A/3

Next, set the setting items.


Device name: Set the device name of the input/output terminal to be used.
Execution flow settings: 1) Pin number: Put a check next to the pin number to be executed.
2) Execution flow: Set the flow number to be executed.
3) Detection edge: Set "Rising" or "Falling".

After making the settings, click the run server button. If the server starts, the settings are complete.
The flow settings cannot be changed while the server is running.

Start server

29
311A-00300A/3

8.2 Link with timer


Here is the instruction on running the flow at regular intervals.
Click the server mode button on the menu bar to switch from the edit mode.

Next, drag and drop block from the toolbox pane into the adjacent flow pane.

After adding the block, click the added block to make it selected.

30
311A-00300A/3

Next, set the setting items.


Flow: Select the name of the flow to be executed.
Execution interval: Set the interval at which to execute the flow.

After making the settings, click the run server button. If the server starts, the settings are complete.
The flow settings cannot be changed while the server is running.

Start server

31

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy