OpenCV &Custom Boards.
Concurrent Computer Corporation.
Professional Service Dept.
Concurrent Computer Corporation

2013/5/15

1

PEX‐530215• 5-Channel NTSC Frame Grabber PCI ExpressProductConcurrent Computer Corporation

2013/5/15

2

VCC‐F22V39APCL• VCC-F22V39APCL is a high-resolution industrial color
digital video camera module utilizing a 1/3 type PS
IT CCD.
• 330K CCD image sensor with on-chip micro-lenses
realizes high sensitivity and high resolution.
• At Full Frame Scan Mode, entire pixels can be readout within approx. 1/120s. Interface of F22V39APCL• complies with camera link standard.

Concurrent Computer Corporation

2013/5/15

3

VCC‐F22V39APCLKey Features• Either PoCL or PoCL-Lite interface output can beselectable.
• Camera settings can be changed via serialcommunications.
• Selectable RGB and RAW 8 bit or 10 bit.
• 1/120～1/100,000s shutter speeds can be set per 1H.
• Full frame scan mode and three different partial scanmodes are available.
• Approx. 120 fps at full frame scan mode.
• Only 29mm cubic in size (excluding projection), lightweight 50g, and speed makes it a best match for• use in embedded systems.

Concurrent Computer Corporation

2013/5/15

4

APX‐3312 CameraLink I/F

Concurrent Computer Corporation

2013/5/155

APX‐3312
Specification

Model
Supported Cameras

APX‐3312
CameraLink
Monochrome/Color camera
Area/Line scan camera
PoCL
Safe Power mode
Acquisition I/F: CameraLink Base Configuration×2ch

Sampling Clock 85MHz（MAX）24bit（MAX）
Image Input
Formats
Synchronous Output（Camera control signals）
Synchronous Input
Encoder

Concurrent Computer Corporation

RGB color: 24bit
Monochrome: 8/10/12bit（1/2TAP） *1
CC1 to CC4
GPOUT 2ch asynchronous
External trigger（TTL/Open collector/Differential signal RS‐422)
RS‐422（Line driver）
A/B/Z phase 1MHz（MAX）
32‐bit counter, 32‐bit/16‐bit comparator (each one set )(Generates image capture trigger when comparatormatched)
2013/5/15

6

APX‐3312
Specification Cont.
GPINMemory
Other Functions

TTL/Open collector
128MByte
Serial communication for camera control(Virtual COM）

System Bus

PCI Express 1.0a Gen1(2.5GT/s)×4 lane *2

Power Requirements
Environment+12V 0.9A *3
Operating temperature: 0℃ to 50℃
Humidity: 35% to 85% (non‐condensing)

Dimension
OSSoftware(Option)

Concurrent Computer Corporation

168mm×112mm, Panel width 20mm (non‐projection)
WindowsXP/Vista/7 (32/64bit) or linux (32/64bit)
Development kit: SDK‐AcapLib2

2013/5/15

7SummaryID

Interface

Pixel Clock

Ch or Size

PoCLe.t.c.

PEX‐530215#0NTSC

24.545454 MHz

5(multiplex)
640x480320x240‐32bit DMA
30 Hz

APX‐3312#0Camera Link Base85 MHz (max)2

Yes

64Bit DMA
NormalCamera Link 1Tap
Base

49.0908 MHz

640x480
1Tap

APCL: Yes
CL:No

120 Hz

F22V39PoCL : Power over Camera Link

Concurrent Computer Corporation

2013/5/15

8Performance• APX 3312,3313,3318

CameraUser
BufferOn Board
MemoryCamera• PEX-530215

64bits DMA

32bits DMA
ReservedMemorymemcpy()

32bits DMAmemcpy()

CameraConcurrent Computer CorporationOn BoardMemoryUser
BufferUserBuffer

HiSpeedNot
Support2013/5/15

9

OpenCV 2.4.3
••••
•

•

OpenCV (Open Source Computer Vision) is a library ofprogramming functions for real time computer vision.
OpenCV is released under a BSD license and hence it’s freefor both academic and commercial use.
It has C++, C, Python and Java interfaces and supports
Windows, Linux, Mac OS, iOS and Android. OpenCV wasdesigned for computational efficiency and with a strong focus
on real-time applications.
Written in optimized C/C++, the library can take advantage ofmulti-core processing.
Adopted all around the world, OpenCV has more than 47
thousand people of user community and estimated number ofdownloads exceeding 5.5 million.
Usage ranges from interactive art, to mines inspection,stitching maps on the web or through advanced robotics.
Concurrent Computer Corporation

2013/5/15

10

OpenCV documentation•••http://docs.opencv.org/
Welcome to opencv documentation!
OpenCV API Referenceooooooooooooooooo•

OpenCV4Android Referenceoo•

Android OpenCV ManagerJava API

OpenCV User Guideoooo•

Introduction
core. The Core Functionality
imgproc. Image Processing
highgui. High-level GUI and Media I/O
video. Video Analysis
calib3d. Camera Calibration and 3D Reconstruction
features2d. 2D Features Framework
objdetect. Object Detection
ml. Machine Learning
flann. Clustering and Search in Multi-Dimensional Spaces
gpu. GPU-accelerated Computer Vision
photo. Computational Photography
stitching. Images stitching
nonfree. Non-free functionality
contrib. Contributed/Experimental Stuff
legacy. Deprecated stuff
ocl. OpenCL-accelerated Computer Vision

Operations with images
Features2d
HighGUI
Cascade Classifier Training

OpenCV Tutorials

Concurrent Computer Corporation

2013/5/15

11

High‐level GUI andMedia I/O• Add 4 Boards Interface
o INTEFACE• PEX-530215 NTSC signal Input
o AVAL DATA• APX-3312 (PoCL)• APX-3313 (Not PoCL)• APX-3318 (Not PoCL)• Tested 2 Camera Link Device
o VCC-F22V39APCL(PoCL) with AVALDATA APX3312&3313
o IMPERX DVICL (not PoCL)• AVALDATA APX3312&3313
VGA,XGA,

Concurrent Computer Corporation

2013/5/1512OpenCV’s Structure
OpenCV Apprications
OpenCV library
High‐level GUI and Media I/O Class library
APX library

PEX libraryConcurrent Computer Corporation

Other OpenCV Class library

Other Classlibraryy2013/5/15

13

OpenCV : Example0#include <cv.h>#include <highgui.h>
using namespace cv;
int main (int argc, char **argv){
const double WIDTH = 640;
const double HEIGHT = 480;
const int CAMERANUM = CV_CAP_AVALDATA3312+0;
CvCapture *capture = NULL;
IplImage *frame = 0;
int ch;CV_CAP_AVALDATA3312+0 // #0 for F22V39APC
CV_CAP_AVALDATA3312+1 // #1 for DVI‐CL VGA
CV_CAP_PEX530215// for NTSC

capture = cvCreateCameraCapture(CAMERANUM);
cvSetCaptureProperty (capture, CV_CAP_PROP_FRAME_WIDTH, WIDTH);
cvSetCaptureProperty (capture, CV_CAP_PROP_FRAME_HEIGHT, HEIGHT);
namedWindow ("Capture", CV_WINDOW_AUTOSIZE | CV_WINDOW_FREERATIO);}

while (1) {frame = cvQueryFrame (capture);
cvShowImage ("Capture", frame);ch = cvWaitKey ( 5 );if (ch == '¥x1b') {break;}}cvReleaseCapture (&capture);
cvDestroyWindow ("Capture");return 0;

Concurrent Computer Corporation

Display Speed(Hz)

2013/5/15

14OpenCV:Makefile
OPTIMIZECCFLAGS
LDFLAGSLDLIBS= -O4= $(OPTIMIZE) -I/usr/local/include/opencv2 -I/usr/local/include/opencv= -L/usr/local/lib= -lopencv_highgui -lopencv_core

EX0
all:

= ex0$(EX0)TEMPFILES = core core.* *.o
EX0_SRC$(EX0):
clean::###ex1.o:= ex0.cc
g++ $(CCFLAGS) $(LDFLAGS) -o $@ $(EX0_SRC) $(LDLIBS)
rm -f $(EX0)ex1.ccConcurrent Computer Corporation

2013/5/15

15

Support Capture Property•

Only Size••••

cvSetCaptureProperty (capture, CV_CAP_PROP_FRAME_WIDTH, WIDTH);
cvSetCaptureProperty (capture, CV_CAP_PROP_FRAME_HEIGHT, HEIGHT);WIDTH, HEIGHT
320,240 or 640,480 or 1024x768
Default 640x480

Concurrent Computer Corporation

2013/5/15

16

Image file read & display#include <cv.h>#include <highgui.h>
using namespace cv;
int main( int argc, char** argv ){Mat rgb;
rgb = imread( "/usr/local/OpenCV-2.4.3/samples/c/fruits.jpg",/* 3-channel color image */ 1 );namedWindow( "Display Image", CV_WINDOW_AUTOSIZE |CV_WINDOW_FREERATIO );imshow( "Display Image", rgb );waitKey(0);}return 0;

Concurrent Computer Corporation

2013/5/15

17

Conversion in the gray scale
picture of a color image#include <cv.h>#include <highgui.h>
using namespace cv;
int main( int argc, char** argv ){Mat rgb, gray;rgb = imread( "/usr/local/OpenCV-2.4.3/samples/c/fruits.jpg", /* 3-channel color image */ 1 );cvtColor(rgb, gray, CV_BGR2GRAY);
namedWindow( "Display Image", CV_WINDOW_AUTOSIZE |CV_WINDOW_FREERATIO );imshow( "Display Image", gray );waitKey(0);}return 0;

Concurrent Computer Corporation

2013/5/15

18Morphologic operation
using a structural element.
r - use rectangle structuring element

Concurrent Computer Corporation

2013/5/15

19

Cont.
e - use elliptic structuring element

Concurrent Computer Corporation

2013/5/15

20

Cont.
c - use cross-shaped structuring element

Concurrent Computer Corporation

2013/5/15

21

Maximal External Regionsinterest point detect.

Concurrent Computer Corporation

2013/5/15

22

Camera Input Dynamic
Display & Optical Flow.
• This program demonstrate dense Farneback opticalflow.
• It read from camera 0, and shows how to use anddisplay dense Franeback optical flow

Concurrent Computer Corporation

2013/5/15

23

Camera Configuration file/usr/local/share/avaldata
apx3312-00ch0.ini Linked VCC-F22V39APCL.ini
apx3312-00ch1.ini Linked VGA.ini

Concurrent Computer Corporation

2013/5/15

24

Other Sample Programs• Device library Direct callo /usr/local/Acplib2/sample_x/sample_x.c
o /usr/local/CNC/drivers/PEX530215/util/pex530215_example.c• Real time example program
o /home/program/*

Concurrent Computer Corporation

2013/5/1525

Easy tunings• run –b0 –u0 all user0 process assigned by CPU 0• run –b0 –g0 all group0 process assigned by CPU 0• shield –a 1-11 all IRQ , Local Interrupt , Daemon
assigned by CPU 0• run –b 1-11 –s fifo(rr) –P 99 realtime_process• more tunings.( IRQ assigned by CPU X)
o echo 2 > /proc/irq/*/smp_affinity

1 is CPU0
2 is CPU1:
Concurrent Computer Corporation

IRQ Number
2013/5/1526

Traffics• VCC-F22V39APCL.ini
o 640x480x4(bytes)x120Hz = 147.456 Mbytes/sec 120Hz• VGA
o 640x480x4(bytes)x 60Hz = 73.728 Mbytes/sec 60Hz

• NTSC( Interlace )All Interrupts
Assigned by CPU 0

o 640x480x4(bytes)x 30Hz = 36.864 Mbytes/sec 320Hz• Total 221.184 Mbytes/sec × 2
more than 500Hz Interrupts
CameraVGA

Main memory

NvidiaNTSC
Concurrent Computer Corporation

2013/5/15

27

Remark• APX 3312(3threads/Process)CameraOn Board
Memory64bitsAddres
DMA

OpenCV
Buffer• PEX-530221(1thread/Process)Camera32bitsAddress
DMA

64bitsAddress
memcpy()OpenCV
Reserved
BufferMemory
Only Support
SimWB 4MB/sec• Scramnet
On Board
Memory64bitsAddress
memcpy()Reserved
Memory32bitsAddress
DMA

Concurrent Computer CorporationSimW
B

User
Buffer64bitsAddress
memcpy()2013/5/15

28

Thanks.
• Questions？

Concurrent Computer Corporation

2013/5/15

29