Select Git revision
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
notes_B 7.54 KiB
###############################
## PART B
###############################
git@gitlab.idiv.de:sugu/vimba.git
Does
> camera produces frames and stores them with timestamps
###############################
use opencv to convert raw cam images into JPEG pixel format
###############################
* camera sends the raw pictures to a storage server via a network (IP/UDP) connection
* internal real time clock and delivers high precision TIME STAMPS, which were simultaneous recorded for every frame (use milliseconds)
* compress frames as jpeg
used opencv version 3.2 imwrite() with parameter:
IMWRITE_JPEG_QUALITY 100; IMWRITE_JPEG_OPTIMIZE 1; IMWRITE_JPEG_RST_INTERVAL 4;
## deploy
operating on the storage server
VM on ssh thomasboy@172.18.115.7 -> ask Dirk!
# build/setup Vimba
> uses Vimba SDK 6.0 / C++ 1.9
> download from https://www.alliedvision.com/en/products/vimba-sdk/#c1497
> see Vimba_installation_under_Linux.pdf
> unpack Vimba SDK
> tar -xzf ./Vimba.tgz
> sudo ./VimbaGigETL/Install.sh #add api to path
## SETUP GT1920C:
> connect lap and cam directly via ethernet
> set MTU to 8228 (jumbo frames/packets)
> set fixed IP for eth-adapter first and then cam (use Vimbaviewer -> force IP)
eth 169.254.100.1
cam ip 169.254.x.x # on restart will pick random IP...
mac
000f310338D3
000f310338D4
ID: DEV_000F310338D4
Name: GT1920C
sub 255.255.0.0
(gat 0.0.0.0 local / none)
-> ip address of each adapter needs to be on a unique subnet
-> for multiple cams calc bandwith and use switch
#####################
What bandwidth do i have? Do i need multiple ports?
bandwith = fps * pixel format(bpp) * resolution (* ncams)
StreamBytesPerSecond = 1 * 1456*1936 * 3 * 1 = 8 456 448 ~= 8,4 MBps < 125MBps
14×3×1936×1456 ~= 118,4 MBps ## max res, 3 bpp -> max FPS: 14!
44×1×1936×1456 ~= 124,1 MBps ## max res, 1 bpp -> max FPS: 44!
a 10 min -> 74 GB?
a 60 min -> 446 GB?
6×1×1936×1456 ~= 16,9 MBps ## find optimal FPS to reduce size!
8×1×1936×1456 ~= 22,6 MBps ## find optimal FPS to reduce size!
10×1×1936×1456 ~= 28,2 MBps ## find optimal FPS to reduce size!
a 10 min -> 17 GB?
a 60 min -> 102 GB?
1. Determine max_speed with highest fps!
2. Take max_speed and reduce fps so it still fits 2*max_speed
-> subsample same video ?
3. calc mean_err through comparing 1. and 2. -> add to 2. as it will be lower.
!! exposure and fps: on 10fps exposure can't be more then 10ms!
Best practice: set gain to lowest possible val and increase exposure as needed
!! if you use more than one cam on one interface, the available bandwidth has to be shared between interfaces.
MAX BANDWITH = Gigabit ethernet ~= 125 Mbps
MAC1 00:0F:31:03:38:D4
YUV 422 = 2 bpp, YUV 444 = 3 bpp
TL - Transport Layer -> GIGE as Camera Interface
GENICAM - open TL -> GiGE
Prosilica GX:
2 ethernet ports...
configure LAG (Link aggregate group)
-> double available bandwith to 240 MB/s!
#####################
> list currently connected cameras
> control cam features
> receive images
> notifications about connections/disconnections
pixel format
vimbasystem = api
> entry point
> singleton
> init / shutdown
> access to cams and if's
api > cam > feature (settings like exposuretime or pixelformat)
cam > frames > img data
> ancillary data (cam settings at time of acquisition -> can be queried via feature access)
api > interface > settings/feature
Features:
> frame:
> ChunkAcquisionFrameCount #nFrames from cur acquisition
> ChunkExposureTime, ChunkGain
> system:
>
> cam:
> Width, Height
frames = img data + ancillaryData
> create by api and queue in cam
> when image is rcv, frame will be filled -> notification
> process and re-enqueue at cam
GenICam - camera standard
TL - Transport Layer - transports data from cam to sw
Buffer management
###############################
Every image acquisition requires allocating memory and handling frame buffers:
1. Allocate memory for frame buffers on the host
2. Announce the buffer (this hands the frame buffer over to the API).
3. Queue a frame (prepare buffer to be filled).
4. Vimba fills the buffer with an image from the camera.
5. Vimba returns the filled buffer (and hands it over to the user -> notification).
6. Work with the image
> store as jpeg
> send to HPC
7. Requeue the frame to hand it over to the API
Img Capture and Acquisition C++
###############################
sync acquisition <> async acquisition
Vimba API *captures* images <> camera *acquires* images
1. prepare img acquisition
cam.AnnounceFrame() # make vimba aware of buffer
cam.StartCapture() # start capture engine
cam.QueueFrame() # hand buffer to vimba
2. start img acquisition
AcquisitionStart()
3. image in callback func
cam.QueueFrame()
4. stop img acquisition
AcquisitionStop()
5. clean up
cam.EndCapture()
cam.FlushQueue()
cam.RevokeAllFrames()
>> convenience funcs()
1 buffer | X buffers
restrained fps | unrestrained fps
| while working with img, the nxt img is acquired!
#VimbaSystem #api
Startup()
RegisterCameraListObserver() #for gigE cams -> getcams return immediately
GetCameras()
GetCameraByID()
OpenCameraByID ( " 192.168.0.42 ", VmbAccessModeFull , camera )
#or serial number or MAC
UnregisterCameraListObserver()
Shutdown() #blox until all callback are done
#api more
GetInterfaces
# CameraPtr
# static
GetID( string )
GetName( string )
GetModel( string )
GetSerialNumber( string )
GetPermittedAccess( VmbAccessModeType& )
GetInterfaceID( string ) #name/id of connected IF
# dyn
Open()
VmbAccessModeFull - read and write -> features, acquire images
VmbAccessModeConfig - configure IP
VmbAccessModeRead - read-only
Close()
AcquireSingleImage()
AcquireMultipleImages()
StartContinuousImageAcquisition()
StopContinuousImageAcquisition()
StartCapture()
StopCapture()
SaveCameraSettings()
LoadCameraSettings()
GetFeatures()
GetFeaturesByName()
AnnounceFrame()
RevokeFrame()
RevokeAllFrames()
CueFrame()
FlushFrame()
#FeaturePtr
GetValue()
SetValue()
RunCommand()
RegisterObserver()
UnregisterObserver()
Notifications
###############################
> register event handler
> different thread -> !!caution! when using shared data
> ! Not all func from API can be called in event handler
> during event handler Vimba API might be blocked -> exit AFA
## notifications of changed camera states
sys.RegisterCameraListObserver()
# callback/observer func of type ICameraListObserver*
# gets called detect, disconnect, connect, changes to open state
# !! dont call from within observer:
Startup, Shutdown GetCameras GetCameraByID RegisterCameraListObserver UnregisterCameraListObserver Feature::SetValue Feature::RunCommand
#ICameraListObserver
> for GigE: register a CameraListObserver with the VimbaSystem >
//Discovery?
// plug&play or add/rm + press button to call getcams and list their info
difference?
AcquisitionFrameRateAbs <> AcquisitionFrameRate
-> cam feature? (== cam setting)
## FramePtr:
GetImage() - img data
getBuffer - img data + ancillary data
GetAncillaryData - ancillary data [~ genicam chunk data]
chunkmodeactive - true -> transfer ancillaryData
frame count
exposure time [ms]
gain [db]
RegisterObserver() ??
# Sharedpointer
###############################
SP_DECL()
...
CameraPtr sp1;
so.reset( new Camera() ); #ref count 1
CameraPtr sp2 ;
sp2 = sp1; #ref count 2
MISC
###############################
getTimestamp
getFrameID
what buffer size?
is firmware still up-to-date?
https://www.alliedvision.com/en/support/firmware.html
camera feature reference
https://www.alliedvision.com/en/support/technical-documentation.html