Development of
EPICS Embedded
Image Processing System

Takashi Obina, Jun-ichi Odagiri, Ryota Takai
KEK, Accelerator Laboratory

Outline Requirements for Image Processing Our Solution
 Driver/Device Support
 Display Application
 Conclusion

15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

2Requirements for Image Processing
 EPICS !

 Stable operation

Requirements from operation :NOT so severe Update Rate

◦ at least 1Hz; Faster is better◦ 10Hz is enough for most purpose (for Humanbased feedback or tuning)◦ 30 Hz is not necessarily required◦ Needs external trigger
 Background subtraction for Screen Monitor
 Capability for complex calculation◦ Beam Size Monitor with the SR Interferometer◦ Nonlinear curve fitting is required
15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

3

Example images : KEK-PF
ScreenMonitor (Beam Transport Line)SR Monitor

SR Interferometer (Beam Size Monitor)

15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

4There are so many possibilities ...
 Hardware◦ PC / Embedded platform Operating System◦ Linux / Windows Interface◦ Image Grabber Board (PCI, PCIe, etc)
◦ USB / FireWire (IEEE1394)◦ GigE (Ethernet)◦ Camera Link Camera◦ Speed (Frame Rates [fps])◦ Resolution [pixels] / number of bits
◦ CMOS or CCD
15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

5What was important for us?
 Stability Rapid application development
 Cost Effectiveness Support of colleagues and/or company

 Long-term operation◦ “Lifetime” of software and hardware

15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

6Our misery experience We have been used Windows PC andframe grabber for interferometer analysis
 The software is 'discontinued'◦ Hardware/Software Only supports Win98!
 Didn’t work after the “Windows Update”

MUST be avoided in the new system
15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

7Our Solution
 Yokogawa PLC-Based System CPU : F3RP61

with Linux OS Image Acquisition Module (UM02)◦ PCI Interface to CPU

This system is supposed to fulfill the requirements.
Especially for “Hardware Reliability” and “Product Lifetime”,
and “support of colleagues”
15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

8Benefit of PLC-Based system
 Many Digital and Analog I/O module◦ cheaper than VME
 We can easily control other equipments

such as screen monitor driver Reliable Hardware (No FAN)
 Compact

 Easy to handle by EPICS
 Linux have many software tools
15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

9Test on Table

Photo2CPU

UM02

Power Supply
15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

DO10

Main Specifications of F3UM02
item
Number of Channels

Specification
2 chCompatible Camera

Single Tap (8bit/pixel)
Dual Tap (16bit/pixel)
RGB Color (24bit/pixel)

Max. Connections

2 Color RGB Cameras(6 Monochrome Cameras)

ADC

100MHzResolution of Digitizer
Camera ResolutionTrigger

8 bits16K x 16K
External / Internal (software)

15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

11

Record Support
 New record type "graphics record"◦ Originally developed for other project (2003)◦ Just remove several unused functionality
 Raw Image (waveform) Reduced-size Image H/V Size information
 Background subtraction
 Image analysis◦ projection to horizontal/vertical direction◦ peak position, peak value, FWHM, etc◦ Possible to enable/disable these calculations
15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

12Device Support
 PCI bus between CPU and UM02 module devGrF3UM02.c
dbd : device(graphics, INST_IO, devGrF3UM02, "F3UM02")

 Interface graphicsRecord to hardware
 issued by "I/O_interrupt" scan request
 just transfer raw image data to record

15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

13Display For test : python + PIL (Python ImagingLibrary) For Operation : EDM

15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

14

Example : BG Subtraction

15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

15

Example : Profile, peak, etc
These parameters are calculated in the GraphicsRecord

15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

16

Test on Optical Table

F3RP61
F3UM02

15/Jun/2011

SONY
HR-50

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

17

Example : Interferometer

Due to deformation and dirty of the mirror and extraction window, interference
fringe is not good as other beam line. We will replace the mirror and window inthis summer.
15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

18

15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

19As a first step, nonlinear curve fit is tested by gnuplot. If we use other (fast) PCor server machine, we can use matlab or other program.
15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

20Performance Free Run Mode : 15Hz update rate
 Trigger Mode◦ tested : 1Hz, 2Hz, 5Hz, 10Hz
 Linux RT version is not used yet

15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

21Performance : CPU Load (1)1) NO Analysis, NO Channel Access
Repetition Period

CPU Load (Typ)CPU Load (max)

1 sec

3.0 %

4.0 %

0.5 sec

3.7 %

7.3 %

0.2 sec

16.0 %

17.0 %

0.1 sec

31.0 %

32.6 %

Repetition Period

CPU Load (Typ)CPU Load (max)

1 sec

18.6 %

19.0 %

0.5 sec

37.0 %

37.3 %

0.2 sec

91.3 %

91.9 %

0.1 sec

N.A.

N.A.

2) Analysis Only

15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

22

CPU Load (2)3) Channel Access Only. (NO Analysis)
Repetition Period

CPU Load (Typ)CPU Load (max)

1 sec

6.7 %

7.3 %

0.5 sec

13.7 %

14.0 %

0.2 sec

34.0 %

35.0 %

0.1 sec

69.0 %

70.0 %We plan to optimize „Analysis‟ routine.

15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

23

How to do with NTSC signal?
 In the beam transport line, we have beenused about 10 CCD cameras with NTSC
output, and commercial video switcher isused for many years.

 UM02 input signal : RGB color

 We must use NTSC – RGB converter◦ Confirmed to capture the image◦ Linearity is not evaluated yet
15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

24Photo15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

25

Just for fun
 3D Movie with two camera; Phantogram

15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

26

Conclusion
 We have developed image acquisition systemon embedded platform New Record/Device support is developed◦ Basic analysis is performed inside the record

 Testing in PF-Ring, Linac
 What’s Next?

◦ Improvement of RT performance◦ Calibration of NTSC to RGB converter◦ Documentation◦ Asyn / AreaDetector / SynApps ?

15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

27

References PCaPAC◦ http://accelconf.web.cern.ch/AccelConf/pcapac
2010/papers/thpl018.pdf“Channel Access Everywhere” Policy
Adopt: Keep It Simple and Stupid
Avoid : Reinventing the wheel
15/Jun/2011

EPICS Collaboration Meeting, NSRRC, Hsinchu, Taiwan

28