background image

57

ICAM-500 Programming Guide

C

ha

pte

r 4
C

am

N

av

i2 S

D

K A

PI 

M

an

ua

l

4.10

Exception

iCam500 properties value out of range would raise ValueError exceptions.

try:

    camera.lighting.seletor = 8

except ValueError:

    print("lighting selector out of range")

Summary of Contents for ICAM-500 Series

Page 1: ...Programming Guide ICAM 500 Series Industrial AI Camera ...

Page 2: ...tallation Advantech assumes no liability under the terms of this warranty as a consequence of such events Because of Advantech s high quality control standards and rigorous testing most of our customers never need to use our repair service If an Advantech product is defec tive it will be repaired or replaced at no charge during the warranty period For out of warranty repairs you will be billed acc...

Page 3: ...mful interference to radio communications Opera tion of this equipment in a residential area is likely to cause harmful interference In this event users are required to correct the interference at their own expense Technical Support and Assistance 1 Visit the Advantech website at www advantech com support to obtain the latest product information 2 Contact your distributor sales representative or A...

Page 4: ...nsient overvoltage 13 Never pour any liquid into an opening This may cause fire or electrical shock 14 Never open the equipment For safety reasons the equipment should be opened only by qualified service personnel 15 If any of the following occurs have the equipment checked by service person nel The power cord or plug is damaged Liquid has penetrated the equipment The equipment has been exposed to...

Page 5: ...gger 12 3 5 Lens Focusing Control 13 3 5 1 Digital Input flow 14 Chapter 4 CamNavi2 SDK API Manual 15 4 1 Requirement 17 4 1 1 Basic 17 4 1 2 Option 17 4 2 module CamNavi2 17 4 2 1 class CamNavi2 17 4 3 module iCam500 26 4 3 1 class iCam500 26 4 3 2 enum CameraMode 39 4 4 module image 40 4 4 1 class CImage 40 4 5 module focus 50 4 5 1 class Focus 50 4 6 module lighting 51 4 6 1 class Lighting 51 4...

Page 6: ...ICAM 500 Programming Guide vi ...

Page 7: ...Chapter 1 1 Introduction ...

Page 8: ...n CAMNavi SDK on the ICAM 500 Connect to HDMI display and USB 3 hub for keyboard mouse then ICAM 500 is ready to development To use CAMNavi SDK support Python 3 6 version above Jetpack 4 4 for mono version 4 5 1 for Color version and Linux Ubuntu 18 04 1 3 Limitations The CAMNavi SDK only operates on ICAM 500 To disable the web service before program ICAM 500 with CAMNavi SDK since web service con...

Page 9: ...Chapter 2 2 ICAM 500 SDK Architecture ...

Page 10: ...ICAM 500 Programming Guide 4 2 1 ICAM 500 Web Service ICAM 500 could use Web browser Chrome to operate from its web service The service use ICAM 500 restful API to control functions of ICAM 500 device ...

Page 11: ...Navi2 SDK Operation ICAM 500 web service uses CamNavi2 SDK to control ICAM 500 device Only one instance could control ICAM 500 functions If developer use SDK to writing python appli cations web service should turn off to release SDK control This flow chart shows start stop web service decision path ...

Page 12: ...ICAM 500 Programming Guide 6 ...

Page 13: ...Chapter 3 3 Operation Flow ...

Page 14: ...uld turn off web service 1 Temporary stop web service sudo systemctl stop web service 2 Stop iCAM 500 web service persistently sudo systemctl stop web service sudo systemctl disable web service sudo systemctl disable autoui service 3 1 Open Close Camera Flow ...

Page 15: ...9 ICAM 500 Programming Guide Chapter 3 Operation Flow 3 2 Image Acquisition ...

Page 16: ...ICAM 500 Programming Guide 10 3 3 Image Trigger Flow ...

Page 17: ...11 ICAM 500 Programming Guide Chapter 3 Operation Flow 3 4 HW trigger Control flow ...

Page 18: ...ICAM 500 Programming Guide 12 3 4 1 Software trigger ...

Page 19: ...13 ICAM 500 Programming Guide Chapter 3 Operation Flow 3 5 Lens Focusing Control ...

Page 20: ...ICAM 500 Programming Guide 14 3 5 1 Digital Input flow ...

Page 21: ...Chapter 4 4 CamNavi2 SDK API Manual ...

Page 22: ...eline Camera property configuration advcam_open Open camera instance advcam_close Close camera instance advcam_play Start image acquisition process Continuous or single shot advcam_stop Stop image acquisition process advcam_snap_image Snap an image from streaming 10ms image advcam_register_new_image_handler Register async new image event handler Module Description image Configure frame properties ...

Page 23: ...CamNavi2 args kwargs CamNavi2 is a module for management ICAM device enum_camera_list Enumerate devices on iCam 500 Returns dict A dict device name and device path mapping get_device_by_name name Get device instance by device name Parameters name str Device name Returns ABSCamera Camera instance If camera does not find return None get_info General information provides by SDK Provide BSP informatio...

Page 24: ...mple default mode output jpeg image format simple mode output raw image See also HYPERLINK l iCam500 iCam500 config_pipeline advcam_open cam frame_count 1 Open camera device Parameters cam ABSCamera Camera instance from get_device_by_name frame_count int Burst images acquisition Returns str Device name None Camera cannot open advcam_close cam Close camera device Parameters cam ABSCamera Camera ins...

Page 25: ... cam Start image acquisition step Continuous mode or single shot Parameters cam ABSCamera Camera instance Returns bool True success See also iCam500 iCam500 play advcam_snap_image cam timeout 60 Snap an image in 10 ms period Parameters cam ABSCamera Camera instance timeout int Break waiting loop in timeout second unit second Returns None or int None No image or timeout array Image data in JPEG for...

Page 26: ...de property Parameters cam ABSCamera Camera instance acq_mode int Acquisition mode 0 Free run mode 1 Software trigger mode 2 Hardware trigger mode advcam_get_focus_distance cam Get lens focusing motor distance Parameters cam ABSCamera Camera instance Returns int Lens focusing motor distance See also iCam500 iCam500 get_focus_distance advcam_set_focus_distance cam distance Set lens focusing motor d...

Page 27: ..._lighting_pos cam pos Set LED lighting location mode Parameters cam ABSCamera Camera instance pos int Trigger 8 LED lighting location init value 3 range 0 7 0 off Returns int 0 Success See also iCam500 iCam500 set_lighting_pos advcam_set_focus_distance cam distance Set LED lighting location mode Parameters cam ABSCamera Camera instance distance int Lens focusing motor distance init value 0 range 0...

Page 28: ... cam gain Get LED lighting gain Parameters cam ABSCamera Camera instance gain int LED lighting gain value init value 9 range 0 25 step 1 Returns int 0 Success See also iCam500 iCam500 set_lighting_gain advcam_get_lighting_strobe_enable cam Get LED lighting enable state Parameters cam ABSCamera Camera instance Returns int LED lighting enable state init value 1 range 0 1 See also HYPERLINK l iCam500...

Page 29: ...ness cam Get camera sensor brightness Parameters cam ABSCamera Camera instance Returns int Sensor brightness value See also iCam500 iCam500 get_img_brightness advcam_set_img_brightness cam brt Set camera sensor brightness Parameters cam ABSCamera Camera instance brt Brightness value init value 100 range 0 255 step 1 Returns int 0 Success See also iCam500 iCam500 set_img_brightness advcam_get_img_g...

Page 30: ...ss value Parameters cam ABSCamera Camera instance Returns int Camera image sharpness value advcam_set_img_sharpness cam sharpness Set camera image sharpness value Support GRAY8 and YUY2 pixel format Parameters cam ABSCamera Camera instance sharpness Camera image sharpness value init value 0 range 0 100 step 1 Returns int 0 Success advcam_status cam Get camera instance status Parameters cam ABSCame...

Page 31: ...am_set_output_resolution cam out_res Set frame resolution Parameters cam ABSCamera Camera instance out_res tuple int int Tuple contains width height Returns tuple int int Assigned value width height Raises ValueError width or height not in valid_resolution_list advcam_get_fw_info Get firmware information Returns str Firmware version information advcam_query_fw_sku cam Get camera sku from firmware ...

Page 32: ...orted resolution ICAM 500 1408 1080 1280 960 640 480 320 240 type dict image Camera sensor properties control type CImage focus Lens focusing motor control Lens movement properties type Focus lighting Camera LED lighting control Strobe control on ICAM 500 type Lighting dev ICAM 500 device control Device network configuration Firmware update board Device board I O controls Digital Input Output type...

Page 33: ...r Read hardware trigger delay time value Setter Set hardware trigger delay time value Value init value 0 range 0 65535 unit us microsecond Type int Raises ValueError Input value out of range property hw_trigger_exp_src Set hardware trigger exposure source Sku color Getter Read hardware trigger exposure source Setter Set hardware trigger exposure source Value init value 0 range 0 1 0 Exposure time ...

Page 34: ...s dict str str Set pipeline parameters format YUY2 BGRA Mono sku only has GRAY8 acq_mode 0 Continuous 1 Software Trigger 2 Hard ware Trigger width 640 height 480 frame_count 1 1 continuous 0 frame count icam500 frame rate 60 timestamp 0 1 Print timestamp on image pipeline_mode default simple default mode output jpeg image format simple mode output raw image Returns str Full pipeline string Notes w...

Page 35: ...uf smaple get_buffer Parameters new_sample_cb New image event handler callback Returns int 0 Success play Start camera acquisition Returns bool True Success See also CamNavi2 CamNavi2 advcam_play Wrapped function in CamNavi2 stop Stop image acquisition procedure Returns bool False pipeline does not setting True Success See also CamNavi2 CamNavi2 advcam_stop Wrapped function in CamNavi2 set_acq_fra...

Page 36: ...LED lighting location init value 3 range 0 7 0 off Returns int 0 Success See also lighting Lighting selector Control by lighting instance get_lighting_gain Get LED lighting gain Returns int LED lighting gain value See also lighting Lighting gain Control by lighting instance set_lighting_gain gain Set LED lighting gain Parameters gain int LED lighting gain value init value 9 range 0 25 step 1 Retur...

Page 37: ...ing enable state Parameters strobe enable 1 disable 0 Returns int 0 Success See also lighting Lighting strobe_enable Control by lighting instance get_img_brightness Get camera sensor brightness Returns int Sensor brightness value See also image CImage brightness Control by image instance set_img_brightness brightness Set camera sensor brightness Parameters brightness Brightness value init value 10...

Page 38: ...uccess See also image CImage gain Control by image instance get_img_sharpness Get camera image sharpness value Returns int Camera image sharpness value See also HYPERLINK l image CImage sharpness Control by HYPERLINK l image instance set_img_sharpness sharpness Set image sharpness value Support GRAY8 and YUY2 pixel format Parameters gain Image sharpness value init value 0 range 0 100 step 1 Return...

Page 39: ...g_exposure_time exp_time Set camera sensor exposure time value Parameters exp_time Camera sensor exposure value init value 50 range 1 1000 step 1 Convert equation exp_time 100 micro sec Returns int new exposure time See also image CImage exposure_time Control by image instance get_img_auto_exposure Get camera auto exposure fuction status Returns int Camera auto exposure function status 1 Enabled 0...

Page 40: ...xposure range min max Value convert equation value 100 micro sec See also image CImage auto_exposure_range Control by image instance set_img_auto_exposure_range min max Set auto exposure range Exposure time value spec init value 50 10000 range 1 10000 step 1 Convert equation exp_time 100 micro sec Parameters min Minimum value of auto exposure time max Maximum value of auto exposure time Returns tu...

Page 41: ...1 Enabled 0 Disabled Returns bool Camera auto gain function status 1 Enabled 0 Disabled See also image CImage auto_gain Control by image instance get_img_auto_gain_range Get auto gain range Returns tuple int int Auto gain range min max See also image CImage auto_gain_range Control by image instance set_img_auto_gain_range min max Set auto gain range Gain value spec init value 0 24 range 0 24 step ...

Page 42: ... new_dgain New camera digital gain Returns int New digital gain value See also image CImage digital_gain Control by image instance get_focus_distance Get lens focusing motor distance Returns int Lens focusing motor distance value See also focus Focus distance Control by focus instance set_focus_distance distance Set lens focusing motor distance Parameters distance int Lens focusing motor distance ...

Page 43: ...sing motor movement direction And invoke set_focus_distance step to move lens Parameters new_direction Change motor direction 1 Forward 0 Backward Returns int New direction value See also focus Focus direction Control by focus instance get_led_color Get board LED color value Returns int 0 off 1 green 2 orange 3 yellow set_led_color new_color Set board LED color Parameters new_color Change LED colo...

Page 44: ...ains width height Returns tuple int int Assigned value width height Returns ValueError width or height not in valid_resolution_list get_roi Get frame ROI value Returns tuple int int int int Current image frame ROI value tuple top left right bottom set_roi roi Change frame image ROI value Parameters roi tuple int int int int New image ROI value tuple top lef right bottom Returns bool True Success s...

Page 45: ...using motor to home See also focus Focus pos_zero Control by focus instance focus_abs_position Get lens focusing motor abs position Returns int Motor position See also focus Focus position Control by focus instance class iCam500 CameraMode value Camera device status Disconnected 0 Camera disconnected Connected 1 Camera connected Playing 2 Camera start acquisition Paused 3 Camera stop acquisition ...

Page 46: ...0 range 0 255 Type int Raises ValueError Input value out of range property gain Image gain setting Getter Read sensor gain setting Setter Set sensor gain setting Value init value 0 range 0 24 Type int Raises ValueError Input value out of range property saturation_op Color image enable saturation setting Sku color Getter Read enable saturation setting Setter Enable saturation setting Value init val...

Page 47: ...UY2 pixel format Getter Read sensor sharpness setting Setter Set sensor sharpness setting Value init value 0 range 0 100 Type int Raises ValueError Input value out of range property gamma Image gamma setting Getter Read sensor gamma setting Setter Set sensor gamma setting Value init value 70 range 0 400 Type int Raises ValueError Input value out of range property hue Color image hue value Enable p...

Page 48: ... balance mode setting Setter Set auto white balance mode setting Value init value 0 range 0 1 0 Narrow Mode 1 Wide Mode Type int Raises ValueError Input value out of range property awb_rgb Read color image auto white balance value Example r g b camera image awb_rgb Sku color Getter Read auto white balance value Type tuple red green blue Raises ValueError Input value out of range property awb_red S...

Page 49: ...f range property color_trans_op Color image enable color transform setting CCM color correction matrix Gain00 Gain10 and Gain20 are group for R channel Gain01 Gain11 and Gain21 are group for G channel Gain02 Gain12 and Gain22 are group for B channel Sku color Getter Read enable color transform setting Setter Enable color transform setting Value init value 1 range 0 1 0 Disable 1 Enable Type int Ra...

Page 50: ...lor_trans_02 Color image color transform 02 value CCM color correction matrix C00 C01 C02 C10 C11 C12 C20 C21 C22 Sku color Getter Read color transform 02 value Setter Set color transform 02 value Value init value 1024 range 4096 4096 Type int Raises ValueError Input value out of range property color_trans_10 Color image color transform 10 value CCM color correction matrix C00 C01 C02 C10 C11 C12 ...

Page 51: ...rans_12 Color image color transform 12 value CCM color correction matrix C00 C01 C02 C10 C11 C12 C20 C21 C22 Sku color Getter Read color transform 12 value Setter Set color transform 12 value Value init value 1024 range 4096 4096 Type int Raises ValueError Input value out of range property color_trans_20 Color image color transform 20 value CCM color correction matrix C00 C01 C02 C10 C11 C12 C20 C...

Page 52: ...value out of range property color_trans_22 Color image color transform 22 value CCM color correction matrix C00 C01 C02 C10 C11 C12 C20 C21 C22 Sku color Getter Read color transform 22 value Setter Set color transform 22 value Value init value 1024 range 4096 4096 Type int Raises ValueError Input value out of range property width Image width setting Getter Read image width setting Setter Set image...

Page 53: ...ter Read sensor exposure time setting Setter Set sensor exposure time Value init value 50 range 1 10000 Type int Raises ValueError Input value out of range property auto_exposure_value Read sensor auto exposure value Read only Getter Read sensor auto exposure value Type int Raises ValueError Input value out of range property auto_exposure Sensor auto exposure Getter Read sensor auto exposure setti...

Page 54: ...uto gain value Read only Getter Read sensor auto gain value Type int Raises ValueError Input value out of range property auto_gain Sensor auto gain Getter Read sensor auto gain setting Setter Enable sensor auto gain setting Value init value 0 range 0 1 Type int Raises ValueError Input value out of range property auto_gain_range Camera sensor auto gain range setting Getter Read sensor gain range se...

Page 55: ...ut of range property pixel_format Camera sensor pixel format Getter Read sensor pixel format setting Setter Set sensor pixel format Value init value GRAY8 in mono sku YUY2 in color sku range GRAY8 YUY2 GBRA Type str Raises ValueError Input value out of range property x_mirror Sensor image x mirror Getter Read sensor pixel format setting Setter Enable sensor image x mirror Value 0 Disable default 1...

Page 56: ...motor movement step Setter Set motor movement step Value init value 0 range 0 300 Type int Raises ValueError Input value out of range property direction Lens focusing motor movement direction control Getter Read motor movement direction Setter Set motor movement direction Value 0 Backward 1 Foreward Type int Raises ValueError Input value out of range position Get lens focusing motor position Retur...

Page 57: ... Set LED lighting flash location Value init value 3 range 0 7 0 off Type int Raises ValueError Input value out of range property gain LED lighting gain control Getter Read LED lighting gain value Setter Set LED lighting gain Value init value 9 range 0 25 step 1 Type int Raises ValueError Input value out of range property strobe_enable Enable LED lighting function Getter Read LED lighting enable st...

Page 58: ...ameters camera dio di0 register_event di_handler Register di0 signal handler camera dio di0 mode 1 Enable DI mode camera dio di0 source 1 DI in rising edge camera dio di0 debounce_time 100 camera dio do0 user_output 1 DO high DI low time sleep 1 camera dio do0 user_output 0 DO low DI high Verify DI handler invoke times assert Counter 1 Close camera cn2 advcam_close camera di event handler Digital ...

Page 59: ...put 0 type DigitalOutput do1 digital output 1 type DigitalOutput class lighting Lighting board dev_name property level Digital input level state Getter Read input level state Value 1 high 0 low Type int property mode Enable digital input mode Getter Read mode Setter Enable mode Value 1 Enable DI 0 Off Type int Raises ValueError Input value out of range property source DI source configuration Gette...

Page 60: ...et debounce time Value range 0 65535 unit Milli second Type int Raises ValueError Input value out of range property debounce_mode Configure DI trigger signal debounce mode Getter Read DI debounce mode Setter Enable DI debounce mode Value 0 Disable 1 Enable Type int register_event event_handle Register DI trigger event handler Example def di_event pass Parameters event_handle Event handler function...

Page 61: ...er Set output signal level Value 0 low level 1 high level Raises ValueError Input value out of range property op_mode DO signal generate mode Getter Read DO op mode Setter Set DO op mode Value 0 User output DO 1 DI bypass diabled Raises ValueError Input value out of range property delay_time DO signal delay output Getter Read delay time Setter SSet DO delay time Value range 0 65535 unit Milli seco...

Page 62: ...fig mode dhcp ip None netmask None gateway None Configure ICAM 500 network info Get ICAM 500 device network configuration Parameters mode str dhcp Set network in DHCP mode ip netmask gate way must set None static Set a static IPv4 address ip str IPv4 address ex 192 168 0 100 netmask str IPv4 netmask ex 255 255 255 0 gateway str IPv4 gateway ex 192 168 0 1 Raises AttribureError If mode is dhcp ip n...

Page 63: ...amming Guide Chapter 4 CamNavi2 SDK API Manual 4 10 Exception iCam500 properties value out of range would raise ValueError exceptions try camera lighting seletor 8 except ValueError print lighting selector out of range ...

Page 64: ...re subject to change without notice No part of this publication may be reproduced in any form or by any means such as electronically by photocopying recording or otherwise without prior written permission from the publisher All brand and product names are trademarks or registered trademarks of their respective companies Advantech Co Ltd 2022 ...

Reviews: