ROC SDK  2.4.0
Scalable Face Recognition Software
roc.h
1 // Copyright © 2015-2022 Rank One Computing Corporation. All rights reserved.
2 
3 #ifndef ROC_H
4 #define ROC_H
5 
6 #include <float.h>
7 #include <limits.h>
8 #include <stdint.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 
12 #include "roc-embedded.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
19 #pragma clang diagnostic push
20 #pragma clang diagnostic ignored "-Wdocumentation"
21 #endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
22 
1292 #ifndef SWIG_ROC_VIDEO
1293 
1294 #ifdef SWIG
1295 %module roc
1296 %module(directors="1") roc
1297 %feature("director") roc_template_pipe_type;
1298 %begin %{
1299 #define SWIG_PYTHON_STRICT_BYTE_CHAR
1300 %}
1301 %include cpointer.i
1302 %include carrays.i
1303 #if defined(SWIGPYTHON) || defined(SWIGJAVA)
1304 %include cdata.i
1305 #endif // SWIGPYTHON || SWIGJAVA
1306 %include stdint.i
1307 %{
1308 #include "roc.h"
1309 %}
1310 #ifdef SWIGJAVA
1311 SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
1312 SWIG_JAVABODY_TYPEWRAPPER(public, public, public, SWIGTYPE)
1313 %include enumtypeunsafe.swg
1315 %{
1316 JNIEXPORT jstring JNICALL
1317 Java_io_rankone_rocsdk_rocJNI_roc_1preinitialize_1android(JNIEnv *,
1318  jclass,
1319  jobject);
1320 %}
1321 
1322 // https://stackoverflow.com/a/33543680
1323 %typemap(jni) uint8_t *UBYTE "jbyteArray"
1324 %typemap(jtype) uint8_t *UBYTE "byte[]"
1325 %typemap(jstype) uint8_t *UBYTE "byte[]"
1326 %typemap(in) uint8_t *UBYTE {
1327  $1 = (uint8_t *) JCALL2(GetByteArrayElements, jenv, $input, 0);
1328 }
1329 %typemap(argout) uint8_t *UBYTE {
1330  JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *) $1, 0);
1331 }
1332 %typemap(javain) uint8_t *UBYTE "$javainput"
1333 %typemap(freearg) uint8_t *UBYTE ""
1334 %apply uint8_t *UBYTE { uint8_t *input_byte_array };
1335 %apply uint8_t *UBYTE { uint8_t *output_byte_array };
1336 %apply uint8_t *UBYTE { uint8_t *y_in };
1337 %apply uint8_t *UBYTE { uint8_t *u_in };
1338 %apply uint8_t *UBYTE { uint8_t *v_in };
1339 #endif // SWIGJAVA
1340 #ifdef SWIGCSHARP
1341 %apply void *VOID_INT_PTR { void * }
1342 %include "arrays_csharp.i"
1343 %apply uint8_t INPUT[] { uint8_t *input_byte_array }
1344 %apply uint8_t OUTPUT[] { uint8_t *output_byte_array }
1345 %apply uint8_t INPUT[] { uint8_t *y_in }
1346 %apply uint8_t INPUT[] { uint8_t *u_in }
1347 %apply uint8_t INPUT[] { uint8_t *v_in }
1348 %typemap(csbase) roc_algorithm_options "long"
1349 #endif // SWIGSCHARP
1350 #ifdef SWIGPYTHON
1351 %include "pybuffer.i"
1352 %pybuffer_binary(const uint8_t *input_byte_array, size_t len)
1353 #endif // SWIGPYTHON
1354 %pointer_functions(bool, bool)
1355 %pointer_functions(int, int)
1356 %pointer_functions(float, float)
1357 %pointer_functions(double, double)
1358 %pointer_functions(size_t, size_t)
1359 %pointer_functions(uint32_t, uint32_t)
1360 %pointer_functions(uint64_t, uint64_t)
1361 %pointer_functions(int64_t, int64_t)
1362 %pointer_functions(roc_gallery, roc_gallery)
1363 %pointer_functions(roc_similarity, roc_similarity)
1364 %pointer_functions(roc_string, roc_string)
1365 %pointer_functions(roc_buffer, roc_buffer)
1366 %pointer_functions(roc_time, roc_time)
1367 %pointer_functions(roc_video, roc_video)
1368 %pointer_functions(roc_video_service, roc_video_service)
1369 %pointer_functions(roc_stream, roc_stream)
1370 %pointer_functions(roc_tracker, roc_tracker)
1371 %pointer_functions(roc_foreground, roc_foreground)
1372 %pointer_functions(roc_database, roc_database)
1373 %pointer_functions(roc_alerter, roc_alerter)
1374 %pointer_functions(roc_algorithm_options, roc_algorithm_options)
1375 %pointer_functions(roc_server, roc_server)
1376 %pointer_functions(roc_template_pipe, roc_template_pipe)
1377 %pointer_functions(roc_uuid_array, roc_dynamic_uuid_array)
1378 %pointer_functions(roc_template_index_array, roc_dynamic_template_index_array)
1379 %array_functions(uint8_t, uint8_t_array)
1380 %array_functions(float, float_array)
1381 %array_functions(roc_template, roc_template_array)
1383 %array_functions(roc_similarity, roc_similarity_array)
1384 %array_functions(roc_candidate, roc_candidate_array)
1385 %array_functions(roc_person_id, roc_person_id_array)
1386 %array_functions(roc_detection, roc_detection_array)
1387 %array_functions(roc_landmark, roc_landmark_array)
1388 %array_functions(roc_adjudication, roc_adjudication_array)
1389 %array_functions(roc_uuid, roc_uuid_array)
1390 %array_functions(roc_hash, roc_hash_array)
1391 %array_functions(roc_roi, roc_roi_array)
1392 %copyctor roc_uuid;
1393 %copyctor roc_hash;
1394 %include roc-embedded.h
1395 #endif // SWIG
1396 
1830 ROC_EXPORT roc_error roc_initialize(const char *license_file,
1831  const char *log_file);
1832 
1833 
1849 ROC_EXPORT roc_error roc_set_keylok_keys(int validateCode1,
1850  int validateCode2,
1851  int validateCode3,
1852  int clientIDCode1,
1853  int clientIDCode2,
1854  int readCode3);
1855 
1872 ROC_EXPORT roc_error roc_set_floating_license_server(const char *hostname);
1873 
1889 ROC_EXPORT roc_error roc_set_cuda_benchmarking(bool benchmark, bool clear_cache);
1890 
1903 ROC_EXPORT roc_error roc_set_cuda_device(int device);
1904 
1951 ROC_EXPORT roc_error roc_enable_cuda(bool enabled, roc_progress progress);
1952 
1953 
1970 ROC_EXPORT roc_error roc_get_cuda_utilization(float *gpu_utilization_percentage,
1971  float *memory_utilization_percentage);
1972 
2005 ROC_EXPORT roc_error roc_set_opportunistic_batching(int ideal_batch_size,
2006  int maximum_latency);
2007 
2008 
2035 ROC_EXPORT roc_error roc_enable_snpe(bool enabled,
2036  roc_string snpe_model_path);
2037 
2038 #if !defined(SWIG)
2039 
2048 ROC_EXPORT roc_error roc_cuda_device_count(unsigned int *device_count);
2049 
2063 ROC_EXPORT roc_error roc_cuda_utilization(unsigned int index,
2064  unsigned int *gpu,
2065  unsigned int *memory);
2066 #endif // !SWIG
2067 
2084 ROC_EXPORT roc_error roc_finalize();
2085 
2098 ROC_EXPORT roc_error roc_get_hostname(roc_string *hostname);
2099 
2110 ROC_EXPORT roc_error roc_get_host_id_extended(roc_string *host_id);
2111 
2140 
2144 typedef enum roc_license_term
2145 {
2150 
2155 
2160 
2165 
2170 
2175 
2181 
2186 
2191 
2196 
2206 
2213 
2219 
2233 ROC_EXPORT roc_error roc_get_license_term(roc_license_term license_term,
2234  bool *enabled);
2235 
2253 ROC_EXPORT roc_error roc_get_thread_limit(int *limit);
2254 
2267 ROC_EXPORT roc_error roc_set_thread_limit(int limit);
2268 
2298 ROC_EXPORT roc_error roc_get_floating_license_limit(uint32_t *clients_remaining,
2299  uint64_t *
2300  comparisons_remaining);
2301 
2311 ROC_EXPORT roc_error roc_get_floating_license_status(bool *is_connected);
2312 
2324 ROC_EXPORT roc_error roc_set_icao_background_color(uint8_t r,
2325  uint8_t g,
2326  uint8_t b); // end of initialization
2328 
2342 typedef struct roc_uuid_string
2343 {
2344  char data[39];
2345 } roc_uuid_string;
2346 
2361 
2369 ROC_EXPORT const char *roc_uuid_string_cast(const roc_uuid_string *uuid);
2370 
2387 ROC_EXPORT roc_uuid roc_uuid_from_string(const char *str);
2388 
2399 ROC_EXPORT roc_uuid roc_uuid_get_random();
2400 
2407 typedef struct roc_hash_string
2408 {
2409  char data[41];
2410 } roc_hash_string;
2411 
2426 
2434 ROC_EXPORT const char *roc_hash_string_cast(const roc_hash_string *hash);
2435 
2454 ROC_EXPORT roc_hash roc_hash_from_string(const char *str);
2455 
2473 ROC_EXPORT roc_hash roc_hash_calc_sha1(const uint8_t *input_byte_array,
2474  size_t length);
2475 
2492 ROC_EXPORT roc_hash roc_hash_calc_sha1_file(const char *file_path);
2493 
2504 ROC_EXPORT roc_hash roc_hash_get_random();
2505  // end of identifiers_and_hashes
2507 
2530 typedef struct roc_alerter_type *roc_alerter;
2531 
2550  roc_alerter *alerter,
2551  const char *key_file_path);
2552 
2572  const roc_alerter alerter,
2573  bool *has_sms_credentials);
2574 
2586  const roc_alerter alerter,
2587  bool *has_email_credentials);
2588 
2600  const roc_alerter alerter,
2601  bool *has_whatsapp_credentials);
2602 
2640 ROC_EXPORT roc_error roc_send_text_message(
2641  const roc_alerter alerter,
2642  const char *phone_number,
2643  const char *message,
2644  roc_buffer image_data,
2645  size_t image_data_length);
2646 
2694  const roc_alerter alerter,
2695  const char *phone_number,
2696  const char *alerts_sender_name,
2697  const char *person_name,
2698  const char *camera_name,
2699  const char *date_time,
2700  roc_buffer image_data,
2701  size_t image_data_length);
2702 
2743 ROC_EXPORT roc_error roc_send_email(
2744  const roc_alerter alerter,
2745  const char *to_email_address,
2746  const char *recipient_name,
2747  const char *subject,
2748  const char *message,
2749  roc_buffer image_data,
2750  size_t image_data_length);
2751 
2767 ROC_EXPORT roc_error roc_free_alerter(
2768  roc_alerter *alerter);
2769  // end of roc_alerts
2771 
2835 ROC_EXPORT roc_error roc_read_image(const char *file_name,
2836  roc_color_space color_space,
2837  roc_image *image);
2838 
2851 ROC_EXPORT roc_error roc_read_image_w(const wchar_t *file_name,
2852  roc_color_space color_space,
2853  roc_image *image);
2854 
2876 ROC_EXPORT roc_error roc_read_exif(const char *jpeg_file_name,
2877  roc_string *exif);
2878 
2897 ROC_EXPORT roc_error roc_write_image(roc_image image,
2898  const char *file_name);
2899 
2926 ROC_EXPORT roc_error roc_decode_image(const uint8_t *input_byte_array,
2927  size_t len,
2928  roc_color_space color_space,
2929  roc_image *image);
2930 
2961 ROC_EXPORT roc_error roc_encode_image(roc_image image,
2962  const char *format,
2963  int quality,
2964  roc_buffer *buffer,
2965  size_t *buffer_length);
2966 
2979 ROC_EXPORT roc_error roc_convert_nv21(const uint8_t *input_byte_array,
2980  size_t width,
2981  size_t height,
2982  roc_image *image);
2983 
2995 ROC_EXPORT roc_error roc_redact_image(roc_image image,
2996  roc_detection detection,
2997  bool blur);
2998 
3011 ROC_EXPORT roc_error roc_render_detection(roc_image image,
3012  const roc_detection detection,
3013  uint8_t r,
3014  uint8_t g,
3015  uint8_t b);
3016 
3026 ROC_EXPORT roc_error roc_resize_image(roc_image src,
3027  roc_image *dst,
3028  size_t width,
3029  size_t height);
3030 
3103 ROC_EXPORT roc_error roc_read_ebts(const char *file_path,
3104  int num_face_images,
3105  roc_string *ebts,
3106  roc_image *images); // end of image_decoding
3108 
3109 #endif // !SWIG_ROC_VIDEO
3110 
3127 typedef struct roc_video_type *roc_video;
3128 
3132 typedef struct roc_video_metadata
3133 {
3134  size_t width;
3135  size_t height;
3143  double frame_rate;
3145  int bit_rate;
3150  bool is_live;
3153 
3158 {
3167 
3168 #if !defined(SWIG) || defined(SWIG_ROC_VIDEO)
3169 
3170 #ifdef SWIG
3171 %module roc_video
3172 #ifdef SWIGJAVA
3173 %include enumtypeunsafe.swg
3174 #endif // SWIGJAVA
3175 %{
3176 #include "roc.h"
3177 %}
3178 %include roc-embedded.h
3179 #endif // SWIG
3180 
3197 
3282 ROC_EXPORT roc_error roc_open_video(const char *file_name,
3283  roc_color_space color_space,
3284  roc_video *video,
3285  roc_video_metadata *metadata);
3286 
3301 ROC_EXPORT roc_error roc_open_video_w(const wchar_t *file_name,
3302  roc_color_space color_space,
3303  roc_video *video,
3304  roc_video_metadata *metadata);
3305 
3352 ROC_EXPORT roc_error roc_open_gst_video(const char *video_url,
3353  roc_color_space color_space,
3354  bool gpu_decoding,
3355  roc_video *video);
3356 
3365  roc_camera_id camera_id);
3366 
3385  roc_time timestamp);
3386 
3387 #endif // !defined(SWIG) || defined(SWIG_ROC_VIDEO)
3388 #ifndef SWIG_ROC_VIDEO
3389 
3413 ROC_EXPORT roc_error roc_open_spinnaker(int index,
3414  roc_color_space color_space,
3415  roc_video *camera);
3416 
3431 ROC_EXPORT roc_error roc_is_live(roc_video video, bool *is_live);
3432 
3476 ROC_EXPORT roc_error roc_seek_keyframe(roc_video video,
3477  roc_time timestamp,
3478  bool backwards);
3479 
3515 ROC_EXPORT roc_error roc_seek_frame(roc_video video,
3516  roc_time timestamp);
3517 
3538 ROC_EXPORT roc_error roc_read_frame(roc_video video,
3539  roc_image *frame);
3540 
3557 ROC_EXPORT roc_error roc_close_video(roc_video video);
3558  // end of video_decoding
3560 
3598 {
3601  int width;
3602 
3605  int height;
3606 
3609  float scale;
3610 
3614  float quality;
3616 
3631  roc_thumbnail_parameters *thumbnail_parameters);
3632 
3642  roc_thumbnail_parameters thumbnail_parameters);
3660 ROC_EXPORT roc_error roc_preload(roc_algorithm_id algorithm_id);
3661 
3671 ROC_EXPORT roc_error roc_set_model_path(const char *path);
3672 
3885 ROC_EXPORT roc_error roc_represent(roc_image image,
3886  roc_algorithm_id algorithm_id,
3887  size_t min_size,
3888  int k,
3889  float false_detection_rate,
3890  float min_quality,
3891  roc_template *templates);
3892 
3935 ROC_EXPORT roc_error roc_represent_roi(roc_image image,
3936  roc_algorithm_id algorithm_id,
3937  float relative_min_size,
3938  size_t absolute_min_size,
3939  size_t min_representation_size,
3940  int k,
3941  float false_detection_rate,
3942  float min_quality,
3943  const roc_roi *include,
3944  size_t num_include,
3945  const roc_roi *exclude,
3946  size_t num_exclude,
3947  float min_roi_overlap,
3948  const roc_string text_filter,
3949  const roc_thumbnail_parameters thumbnail_parameters,
3950  bool rotate_on_failure,
3951  roc_template *templates);
3952 
4028  roc_finger_id finger_id,
4029  const int resolution,
4030  const int k,
4031  float false_detection_rate,
4032  float min_quality,
4033  roc_template *templates);
4034 
4051 ROC_EXPORT roc_error roc_merge_fingerprints(const roc_template *templates,
4052  int n,
4053  roc_template *merged);
4054 
4076 ROC_EXPORT roc_error roc_representation_limit(size_t *representation_limit);
4077  // end of template_generation
4079 
4097 #ifndef SWIG
4098 
4130 ROC_EXPORT roc_error roc_read_template(FILE *file,
4131  roc_template *template_);
4132 
4133 #endif // !SWIG
4134 
4159 ROC_EXPORT roc_error roc_read_template_fd(int fd,
4160  roc_template *template_);
4161 
4175 ROC_EXPORT roc_error roc_read_template_fd_ext(int fd,
4176  roc_template *template_,
4177  bool read_md,
4178  bool read_fv,
4179  bool read_tn);
4180 
4181 #ifndef SWIG
4182 
4205 ROC_EXPORT roc_error roc_write_template(FILE *file,
4206  const roc_template template_);
4207 
4208 #endif // !SWIG
4209 
4228 ROC_EXPORT roc_error roc_write_template_fd(int fd,
4229  const roc_template template_);
4230 
4253 ROC_EXPORT roc_error roc_get_metadata(const roc_template template_,
4254  const char *key,
4255  roc_string *value);
4256 
4282 ROC_EXPORT roc_error roc_set_metadata(roc_template *template_,
4283  const char *key,
4284  const char *value);
4285 
4303 ROC_EXPORT roc_error roc_set_metadata_object(roc_template *template_,
4304  const char *json_object);
4305 
4314 ROC_EXPORT roc_error roc_realloc_metadata(roc_template *template_,
4315  uint32_t md_size);
4316 
4328 ROC_EXPORT roc_error roc_clear_metadata(roc_template *template_);
4329 
4340 ROC_EXPORT roc_error roc_clear_thumbnail(roc_template *template_);
4341 
4354 ROC_EXPORT roc_error roc_clear_feature_vector(roc_template *template_,
4355  roc_algorithm_id representations);
4356 
4357 
4377 ROC_EXPORT roc_error roc_get_metadata_double(const roc_template template_,
4378  const char *key,
4379  double *value);
4380 
4401 ROC_EXPORT roc_error roc_set_metadata_double(roc_template *template_,
4402  const char *key,
4403  double value);
4404 
4427 ROC_EXPORT roc_error roc_to_base64(const uint8_t *input_byte_array,
4428  size_t length,
4429  roc_string *str);
4430 
4450 ROC_EXPORT roc_error roc_from_base64(const char *str,
4451  roc_buffer *buffer,
4452  size_t *buffer_length);
4453 
4454 struct roc_template_pipe_type;
4455 
4460  // end of template_io
4462 
4479 typedef struct roc_stream_type *roc_stream;
4480 
4499 typedef void (*roc_stream_image_callback)(roc_stream stream,
4500  void*,
4501  roc_error,
4502  roc_image);
4503 
4522  void*,
4523  roc_error,
4524  size_t,
4525  const uint8_t*,
4526  roc_time);
4527 
4541  void*,
4542  roc_error,
4543  roc_template);
4544 
4566 ROC_EXPORT roc_error roc_stream_load_configuration(const char* stream_info,
4567  roc_stream *stream);
4598 ROC_EXPORT roc_error roc_stream_start(roc_stream *stream,
4599  float frames_per_second,
4600  int num_worker_threads);
4601 
4610 ROC_EXPORT roc_error roc_stream_set_warmup(roc_stream stream,
4611  roc_time warmup);
4612 
4635 ROC_EXPORT roc_error roc_stream_limit(size_t *stream_limit);
4636 
4651  image_callback,
4652  void
4653  *image_callback_context);
4654 
4670  roc_stream stream,
4672  encoded_image_callback,
4673  void *encoded_image_callback_context);
4674 
4688 ROC_EXPORT roc_error roc_stream_set_video(roc_stream stream,
4689  roc_video video);
4690 
4699 ROC_EXPORT roc_error roc_stream_clear_video(roc_stream stream);
4700 
4710 ROC_EXPORT roc_error roc_stream_stop(roc_stream *stream);
4711 
4721  float frames_per_second);
4722 
4734 ROC_EXPORT bool roc_stream_is_paused(roc_stream stream);
4735 
4750 ROC_EXPORT roc_error roc_stream_set_paused(roc_stream stream,
4751  bool paused);
4752 
4769  float *frames_per_second);
4770 
4785  size_t *ignored,
4786  size_t *queued,
4787  size_t *processed,
4788  size_t *dropped);
4789 
4800 ROC_EXPORT roc_error roc_stream_add_image(roc_stream stream,
4801  roc_image image);
4802 
4829  roc_stream stream,
4830  size_t len,
4831  const uint8_t *input_byte_array,
4832  roc_time timestamp);
4833 
4847 ROC_EXPORT roc_error roc_stream_sync(roc_stream stream,
4848  roc_time timestamp);
4849  // end of video_streaming
4851 
4900 typedef const char *roc_gallery_file;
4901 
4915 typedef struct roc_gallery_type *roc_gallery;
4916 
4920 typedef const struct roc_gallery_type *roc_const_gallery;
4921 
4956 ROC_EXPORT roc_error roc_open_gallery(roc_gallery_file gallery_file,
4957  roc_gallery *gallery,
4958  roc_progress progress);
4959 
4967 typedef size_t roc_template_index;
4968 
4974 extern const roc_template_index ROC_EXPORT ROC_INVALID_TEMPLATE_INDEX;
4975 
4984 
4991 
4998  *template_index_array);
4999 
5035 ROC_EXPORT roc_error roc_enroll(roc_gallery gallery,
5036  const roc_template template_,
5037  roc_template_index *index);
5038 
5051 ROC_EXPORT roc_error roc_fsync(roc_gallery gallery);
5052 
5068 ROC_EXPORT roc_error roc_size(roc_const_gallery gallery,
5069  size_t *size);
5070 
5088 ROC_EXPORT roc_error roc_last_modified(roc_const_gallery gallery,
5089  roc_time *timestamp);
5090 
5116 ROC_EXPORT roc_error roc_take_snapshot(roc_const_gallery gallery,
5117  const char *file_path,
5118  bool defragment);
5119 
5148 ROC_EXPORT roc_error roc_at(roc_const_gallery gallery,
5149  roc_template_index index,
5150  roc_template *template_);
5151 
5167 ROC_EXPORT roc_error roc_at_n(roc_const_gallery gallery,
5168  roc_template_index start_index,
5169  size_t n,
5170  roc_template *templates);
5171 
5195 ROC_EXPORT roc_error roc_get(roc_const_gallery gallery,
5196  roc_template_id template_id,
5197  roc_template *template_);
5198 
5219 ROC_EXPORT roc_error roc_index_for_id(roc_const_gallery gallery,
5220  roc_template_id template_id,
5221  roc_template_index *index);
5222 
5265 ROC_EXPORT roc_error roc_replace(roc_gallery gallery,
5266  roc_template_index index,
5267  const roc_template template_);
5268 
5292 ROC_EXPORT roc_error roc_remove(roc_gallery gallery,
5293  roc_template_index index);
5294 
5311 ROC_EXPORT roc_error roc_remove_n(roc_gallery gallery,
5312  roc_template_index start_index,
5313  size_t n);
5314 
5333 ROC_EXPORT roc_error roc_remove_id(roc_gallery gallery,
5334  roc_template_id template_id);
5335 
5353 ROC_EXPORT roc_error roc_remove_before(roc_gallery gallery,
5354  roc_time timestamp);
5355 
5371 ROC_EXPORT roc_error roc_close_gallery(roc_gallery gallery);
5372 
5395 ROC_EXPORT roc_error roc_template_limit(size_t *template_limit);
5396 
5414 ROC_EXPORT roc_error roc_defragment(roc_gallery_file input,
5415  roc_gallery_file output);
5416 
5432 ROC_EXPORT roc_error roc_validate(roc_gallery_file gallery,
5433  bool truncate,
5434  size_t *templates,
5435  int64_t *bytes_read,
5436  int64_t *bytes_unread);
5437  // end of gallery_construction
5439 
5484 ROC_EXPORT roc_error roc_compare_templates(const roc_template a,
5485  const roc_template b,
5486  roc_similarity *similarity);
5487 
5504 
5511 
5546  roc_const_gallery query,
5547  roc_similarity *similarity_matrix);
5548 
5570 ROC_EXPORT roc_error roc_comparison_limit(size_t *comparison_limit);
5571  // end of comparison
5573 
5595 typedef struct roc_candidate
5596 {
5607 #if defined(__cplusplus) && !defined(SWIG)
5608 
5616  {}
5617 
5625  : person_id(person_id)
5627  , index(index)
5629  {}
5630 
5634  inline bool operator<(const roc_candidate &other) const
5635  {
5636  if (similarity != other.similarity)
5637  return similarity > other.similarity;
5638  return index < other.index;
5639  }
5640 #endif // __cplusplus && !SWIG
5641 } roc_candidate;
5642 
5694 ROC_EXPORT roc_error roc_search(roc_const_gallery gallery,
5695  const roc_template probe,
5696  size_t k,
5697  roc_similarity min_similarity,
5698  roc_candidate *candidates);
5699 
5777 ROC_EXPORT roc_error roc_knn(roc_const_gallery gallery,
5778  roc_const_gallery probes,
5779  size_t k,
5780  roc_similarity min_similarity,
5781  roc_candidate *neighbors,
5782  roc_progress progress);
5783 
5802 ROC_EXPORT roc_error roc_knn_and_cluster(roc_gallery gallery,
5803  size_t k,
5804  roc_similarity min_similarity,
5805  bool incremental,
5806  roc_progress progress);
5807 
5857  roc_const_gallery probes,
5858  size_t k,
5859  roc_similarity min_similarity,
5860  bool one_candidate_per_person_id,
5861  bool ignore_identical,
5862  roc_candidate *candidates);
5863 
5901 ROC_EXPORT roc_error roc_rerank(roc_const_gallery gallery,
5902  size_t k,
5903  roc_candidate *candidates);
5904 
5920 ROC_EXPORT roc_error roc_rank_persons(roc_const_gallery gallery,
5921  const roc_template probe,
5922  size_t k,
5923  roc_person_id *person_ids,
5924  roc_similarity *similarities);
5925 
5940  roc_similarity max_similarity,
5941  size_t k,
5942  roc_candidate *candidates);
5943  // end of search
5945 
5967 typedef struct roc_database_type *roc_database;
5968 
5981 ROC_EXPORT roc_error roc_open_database(const char *path,
5982  roc_database *database);
5983 
5993 ROC_EXPORT roc_error roc_close_database(roc_database *database);
5994 
6012 ROC_EXPORT roc_error roc_database_add_file(roc_database database,
6013  const char *file_path,
6014  roc_hash key);
6015 
6033 ROC_EXPORT roc_error roc_database_add_link(roc_database database,
6034  const char *file_path,
6035  roc_hash key);
6036 
6056 ROC_EXPORT roc_error roc_database_add_data(roc_database database,
6057  const uint8_t *input_byte_array,
6058  size_t length,
6059  roc_hash key);
6060 
6070 ROC_EXPORT roc_error roc_database_has_key(roc_database database,
6071  roc_hash key,
6072  bool *has_key);
6073 
6087  roc_hash key,
6088  roc_string *file_path);
6089 
6103  roc_hash key,
6104  roc_buffer *data,
6105  size_t *length);
6106 
6116 ROC_EXPORT roc_error roc_database_remove(roc_database database,
6117  roc_hash key);
6118 
6130 ROC_EXPORT roc_error roc_database_first_key(roc_database database,
6131  roc_hash *first_key);
6132 
6147 ROC_EXPORT roc_error roc_database_next_key(roc_database database,
6148  roc_hash current_key,
6149  roc_hash *next_key);
6150 
6163 ROC_EXPORT roc_error roc_database_sync(roc_database from,
6164  const char *to,
6165  bool async);
6166  // end of media_database
6168 
6180 typedef struct roc_foreground_type *roc_foreground;
6181 
6197 ROC_EXPORT roc_error roc_new_foreground(roc_foreground *foreground);
6198 
6226 ROC_EXPORT roc_error roc_foreground_add_frame(roc_foreground foreground,
6227  const roc_image frame,
6228  roc_image *mask);
6229 
6244 ROC_EXPORT roc_error roc_foreground_quality(const roc_image mask,
6245  float *foreground_quality);
6246 
6262 ROC_EXPORT roc_error roc_foreground_roi(const roc_image mask,
6263  size_t *x,
6264  size_t *y,
6265  size_t *width,
6266  size_t *height);
6267 
6277 ROC_EXPORT roc_error roc_foreground_render(const roc_image frame,
6278  const roc_image mask,
6279  roc_image *rendering);
6280 
6297 ROC_EXPORT roc_error roc_free_foreground(roc_foreground *foreground);
6298  // end of foreground_modeling
6300 
6317 typedef struct roc_event
6318 {
6321  float quality;
6338  roc_detection first_detection;
6344  uint32_t count;
6346 } roc_event;
6347 
6355 typedef struct roc_tracker_type *roc_tracker;
6356 
6380 ROC_EXPORT roc_error roc_new_tracker(roc_tracker *tracker);
6381 
6382 #ifndef SWIG
6383 
6388 #define ROC_DEFAULT_MIN_TRACKING_SIMILARITY 0.45f
6389 #else // SWIG
6390 %constant float ROC_DEFAULT_MIN_TRACKING_SIMILARITY = 0.45f;
6391 #endif // !SWIG
6392 
6393 #ifndef SWIG
6394 
6401 #define ROC_SUGGESTED_MIN_DETECTION_OVERLAP 0.0f
6402 #else // SWIG
6403 %constant float ROC_SUGGESTED_MIN_DETECTION_OVERLAP = 0.0f;
6404 #endif // !SWIG
6405 
6406 #ifndef SWIG
6407 
6414 #define ROC_DEFAULT_MAX_TIME_SEPARATION 5000
6415 #else // SWIG
6416 %constant int ROC_DEFAULT_MAX_TIME_SEPARATION = 5000;
6417 #endif // !SWIG
6418 
6419 #ifndef SWIG
6420 
6427 #define ROC_DEFAULT_MIN_COUNT 1
6428 #else // SWIG
6429 %constant int ROC_DEFAULT_MIN_COUNT = 1;
6430 #endif // !SWIG
6431 
6432 #ifndef SWIG
6433 
6440 #define ROC_DEFAULT_LICENSE_PLATE_STATE_THRESHOLD 0.9
6441 #else // SWIG
6442 %constant float ROC_DEFAULT_LICENSE_PLATE_STATE_THRESHOLD = 0.9;
6443 #endif // !SWIG
6444 
6452  int k;
6454  float min_quality;
6460  char *text_filter;
6464 
6510  roc_event_type reasons,
6511  roc_time max_time_separation,
6512  float min_detection_overlap,
6513  roc_similarity min_tracking_similarity,
6514  int min_count);
6515 
6541  roc_algorithm_id algorithm_id,
6542  float relative_min_size,
6543  int k,
6544  float false_detection_rate,
6545  float min_quality);
6546 
6560  const roc_tracker_algorithm_parameters *algorithm_params_list,
6561  size_t list_size);
6562 
6574  roc_tracker tracker,
6575  float clip_limit,
6576  int num_tiles);
6577 
6603 ROC_EXPORT roc_error roc_tracker_load_configuration(const char* tracker_info,
6604  roc_gallery *galleries,
6605  size_t gallery_count,
6606  const char *process_id,
6607  roc_tracker tracker);
6608 
6630  const char* template_pipe_file,
6631  bool append,
6632  bool keep_alive,
6633  bool replay_on_failure,
6634  int frame_rate,
6635  int quality,
6636  size_t height);
6637 
6657  bool render_detections,
6658  bool render_foreground,
6659  bool render_timestamps,
6660  bool render_person_ids,
6661  bool render_recording,
6662  uint8_t r,
6663  uint8_t g,
6664  uint8_t b);
6665 
6670 {
6675 
6680 
6685 
6692 
6706  roc_tracker_privacy face_privacy,
6707  bool blur,
6708  roc_tracker_privacy image_privacy);
6709 
6726  roc_tracker tracker,
6727  roc_similarity min_watchlist_similarity);
6728 
6748  roc_gallery watchlist);
6749 
6767  roc_gallery watchlist);
6768 
6792 ROC_EXPORT roc_error roc_tracker_set_rois(roc_tracker tracker,
6793  const roc_roi *include,
6794  size_t num_include,
6795  const roc_roi *exclude,
6796  size_t num_exclude,
6797  float min_roi_overlap);
6798 
6810 
6856  roc_database database,
6857  const char *template_pipe_file,
6858  const char *format,
6859  int quality,
6860  roc_event_type reasons,
6861  bool append,
6862  bool keep_alive,
6863  bool replay_on_failure);
6864 
6883  roc_time threshold_ms,
6884  roc_time interval_ms);
6885 
6955  const roc_template template_);
6956 
6977 ROC_EXPORT roc_error roc_tracker_add_image(roc_tracker tracker,
6978  const roc_image image,
6979  roc_stream stream);
6980 
6997  size_t len,
6998  const uint8_t *input_byte_array,
6999  roc_time timestamp,
7000  roc_stream stream);
7001 
7022 ROC_EXPORT roc_error roc_tracker_update_time(roc_tracker tracker,
7023  roc_time timestamp);
7024 
7048  roc_image *frame,
7049  roc_event *events,
7050  int *num_events);
7051 
7061 ROC_EXPORT void *roc_tracker_cast(roc_tracker tracker);
7062 
7063 #ifdef SWIG
7064 %constant void roc_tracker_add_image_callback(void*, roc_error, roc_image);
7065 #else // !SWIG
7066 
7086 ROC_EXPORT void roc_tracker_add_image_callback(roc_stream stream,
7087  void *tracker,
7088  roc_error error,
7089  roc_image image);
7090 #endif // SWIG
7091 
7092 #ifdef SWIG
7093 %constant void roc_tracker_add_encoded_image_callback(void*, roc_error, size_t, const uint8_t*, roc_time);
7094 #else // !SWIG
7095 
7111  roc_stream stream,
7112  void *tracker,
7113  roc_error error,
7114  size_t len,
7115  const uint8_t *input_byte_array,
7116  roc_time timestamp);
7117 #endif // SWIG
7118 
7143 ROC_EXPORT bool roc_tracker_has_events(roc_tracker tracker, roc_time wait);
7144 
7172 ROC_EXPORT roc_error roc_tracker_take_event(roc_tracker tracker,
7173  roc_event *event);
7174 
7192 ROC_EXPORT roc_error roc_tracker_best_image(roc_tracker tracker,
7193  roc_person_id person_id,
7194  roc_image *image);
7195 
7223  const char *database_path,
7224  bool keep_alive,
7225  int max_frames_stored,
7226  unsigned int idr_interval,
7227  bool persistent_recording_enabled,
7228  roc_time persistent_recording_clips_duration);
7229 
7253 ROC_EXPORT roc_error roc_tracker_get_video_clip(const roc_tracker tracker,
7254  roc_time *start_time,
7255  roc_time *stop_time,
7256  roc_buffer *bit_stream,
7257  size_t *bit_stream_size);
7258 
7278 ROC_EXPORT roc_error roc_tracker_get_next_video_clip(const roc_tracker tracker,
7279  roc_time *start_time,
7280  roc_time *stop_time,
7281  roc_buffer *bit_stream,
7282  size_t *bit_stream_size);
7283 
7301  roc_camera_id camera_id);
7302 
7311  roc_time *timestamp);
7312 
7321  roc_time *timestamp);
7322 
7338 ROC_EXPORT roc_error roc_tracker_store_clip(const roc_tracker tracker,
7339  roc_media_id media_id,
7340  roc_camera_id camera_id,
7341  roc_time *start,
7342  roc_time *stop);
7343 
7359 ROC_EXPORT roc_error roc_tracker_store_next_clip(const roc_tracker tracker,
7360  roc_media_id media_id,
7361  roc_camera_id camera_id,
7362  roc_time *start,
7363  roc_time *stop);
7364 
7380 ROC_EXPORT roc_error roc_free_tracker(roc_tracker tracker);
7381  // end of tracking
7383 
7413 typedef struct roc_video_service_type *roc_video_service;
7414 
7415 #if !defined(SWIG) || defined(SWIG_ROC_VIDEO)
7416 
7425 ROC_EXPORT roc_error roc_new_video_service(roc_video_service *video_service);
7426 
7476 ROC_EXPORT roc_error roc_video_service_start(roc_video_service video_service,
7477  roc_string global_settings);
7483  bool enabled;
7485  size_t events;
7486  char *filename;
7487  float fps;
7488  size_t frames_queued;
7491  char *stream_id;
7493 
7500 
7507 ROC_EXPORT void roc_free_stream_tracker_status_array(
7508  roc_stream_tracker_status_array *stream_tracker_status_array,
7509  size_t status_count);
7510 
7567 ROC_EXPORT roc_error roc_video_service_status(roc_video_service video_service,
7568  roc_stream_tracker_status_array *stream_tracker_statuses,
7569  size_t *num_stream_tracker_statuses,
7570  bool *done,
7571  size_t *pending_transmissions);
7572 
7668  const char *new_stream_configuration);
7669 
7716  const char *updated_stream_configuration);
7717 
7753  const char *removed_stream_id);
7754 
7797  roc_string *current_configuration);
7798 
7810 ROC_EXPORT roc_error roc_free_video_service(roc_video_service video_service);
7811 
7812 #endif // !defined(SWIG) || defined(SWIG_ROC_VIDEO)
7813  // end of roc_video_service
7815 
7888 ROC_EXPORT roc_error roc_cluster(roc_gallery gallery,
7889  size_t k,
7890  const roc_candidate *neighbors,
7891  roc_similarity similarity,
7892  bool incremental,
7893  roc_progress progress);
7894 
7918 typedef struct roc_adjudication
7919 {
7925 
7945 ROC_EXPORT roc_error roc_adjudicate_knn(size_t gallery_size,
7946  size_t k,
7947  roc_candidate *neighbors,
7948  const roc_adjudication *adjudications,
7949  size_t num_adjudications);
7950 
7974 ROC_EXPORT roc_error roc_adjudicate_gallery(roc_gallery gallery,
7975  const roc_adjudication *adjudications,
7976  size_t num_adjudications);
7977 
8026 ROC_EXPORT roc_error roc_extend(roc_gallery gallery,
8027  roc_const_gallery probes,
8028  roc_similarity threshold,
8029  bool spawn);
8030 
8085 ROC_EXPORT roc_error roc_consolidate(roc_gallery gallery,
8086  roc_similarity max_similarity,
8087  size_t max_count);
8088 
8125 ROC_EXPORT roc_error roc_consolidate_persons(roc_gallery gallery,
8126  roc_similarity max_similarity);
8127 
8157 
8168 ROC_EXPORT roc_error roc_get_template_id(roc_gallery gallery,
8169  roc_template_index index,
8170  roc_template_id *template_id);
8171 
8183 ROC_EXPORT roc_error roc_get_person_id(roc_gallery gallery,
8184  roc_template_index index,
8185  roc_person_id *person_id);
8186 
8197 ROC_EXPORT roc_error roc_set_person_id(roc_gallery gallery,
8198  roc_template_index index,
8199  roc_person_id person_id);
8200 
8228  roc_person_id_array *person_ids,
8229  size_t *num_person_ids);
8230 
8253  roc_person_id_array *person_ids,
8254  size_t *num_person_ids);
8255 
8281  roc_person_id person_id,
8283  *template_indicies,
8284  size_t *num_template_indicies);
8285 
8311  roc_media_id media_id,
8313  *template_indicies,
8314  size_t *num_template_indicies);
8315  // end of identity_discovery
8317 
8340 ROC_EXPORT roc_error roc_set_server_credentials(const char *private_key,
8341  const char *certificate);
8342 
8355 ROC_EXPORT roc_error roc_get_ssl_protocols(roc_string *protocols);
8356 
8375 ROC_EXPORT roc_error roc_set_ssl_protocols(const char *protocol_string);
8376 
8389 ROC_EXPORT roc_error roc_get_ssl_ciphers(roc_string *ciphers);
8390 
8413 ROC_EXPORT roc_error roc_set_ssl_ciphers(const char *cipher_string);
8414 
8424 ROC_EXPORT roc_error roc_set_server_protocol(bool use_http);
8425 
8429 typedef struct roc_server_type *roc_server;
8430 
8467  int port,
8468  roc_server *server);
8469 
8473 typedef struct roc_amqp_server_type *roc_amqp_server;
8474 
8512  roc_string location,
8513  roc_gallery gallery,
8514  const char *local_gallery_path,
8515  roc_string stream_name,
8516  int64_t offset);
8517 
8526 ROC_EXPORT roc_error roc_stop_amqp_server(roc_amqp_server *server);
8527 
8541  uint8_t *request_data,
8542  size_t request_len,
8543  roc_buffer *response_data,
8544  size_t *response_len);
8545 
8559  roc_gallery new_gallery,
8560  const char *
8561  original_gallery_file);
8562 
8574  int port,
8575  roc_server *server);
8576 
8588  template_pipe,
8589  int port,
8590  roc_server *server);
8591 
8599 ROC_EXPORT roc_error roc_start_floating_license_server(int port,
8600  roc_server *server);
8601 
8602 
8617 ROC_EXPORT roc_error roc_server_connections(roc_server server,
8618  int *connections);
8619 
8636 ROC_EXPORT roc_error roc_stop_server(roc_server *server);
8637  // end of remote_data_structures
8639 
8652 struct ROC_EXPORT roc_template_pipe_type
8653 #ifdef __cplusplus
8654 {
8655  virtual ~roc_template_pipe_type();
8656 
8660  virtual roc_error transmit(const roc_template &template_) = 0;
8661 
8665  virtual roc_error transmit_event(const roc_event &event)
8666  {
8667  return transmit(event.probe);
8668  }
8669 
8673  virtual roc_error transmit_data(const uint8_t *data,
8674  size_t length,
8675  roc_hash key)
8676  {
8677  (void) data;
8678  (void) length;
8679  (void) key;
8680  return NULL;
8681  }
8682 
8686  virtual roc_error transmit_image(const uint8_t *data,
8687  size_t length,
8688  roc_media_id media_id,
8689  roc_camera_id camera,
8690  roc_time timestamp)
8691  {
8692  (void) camera;
8693  (void) timestamp;
8694  return transmit_data(data, length, media_id);
8695  }
8696 
8700  virtual roc_error transmit_video(const uint8_t *data,
8701  size_t length,
8702  roc_media_id media_id,
8703  roc_camera_id camera,
8704  roc_time start,
8705  roc_time stop)
8706  {
8707  (void) camera;
8708  (void) start;
8709  (void) stop;
8710  return transmit_data(data, length, media_id);
8711  }
8712 
8716  virtual roc_error transmit_log(const char *message)
8717  {
8718  (void) message;
8719  return NULL;
8720  }
8721 
8726  size_t status_count,
8727  bool done,
8728  size_t pending_transmissions,
8729  float gpu_utilization_percent,
8730  float gpu_memory_used_percent)
8731  {
8732  (void) status;
8733  (void) status_count;
8734  (void) done;
8735  (void) pending_transmissions;
8736  (void) gpu_utilization_percent;
8737  (void) gpu_memory_used_percent;
8738  return NULL;
8739  }
8740 }
8741 #endif // _cplusplus
8742 ;
8743 
8765 ROC_EXPORT roc_error roc_open_template_pipe(const char *template_pipe_file,
8766  bool append,
8767  bool keep_alive,
8768  bool replay_on_failure,
8769  const char *sender_id,
8770  roc_template_pipe *template_pipe);
8771 
8779 ROC_EXPORT roc_error roc_template_pipe_transmit(roc_template_pipe template_pipe,
8780  const roc_template template_);
8781 
8790  roc_template_pipe template_pipe,
8791  const roc_event event);
8792 
8803  roc_template_pipe template_pipe,
8804  const uint8_t *data,
8805  size_t length,
8806  roc_hash key);
8807 
8820  roc_template_pipe template_pipe,
8821  const uint8_t *data,
8822  size_t length,
8823  roc_media_id media_id,
8824  roc_camera_id camera_id,
8825  roc_time timestamp);
8826 
8840  roc_template_pipe template_pipe,
8841  const uint8_t *data,
8842  size_t length,
8843  roc_media_id media_id,
8844  roc_camera_id camera_id,
8845  roc_time start,
8846  roc_time stop);
8847 
8856  roc_template_pipe template_pipe,
8857  const char *message);
8858 
8864 
8871 ROC_EXPORT void roc_template_pipe_log_callback(const char *message);
8872 
8879 ROC_EXPORT size_t roc_pending_transmissions();
8880 
8896  size_t status_count,
8897  bool done,
8898  size_t pending_transmissions,
8899  float gpu_utilization_percent,
8900  float gpu_memory_used_percent);
8901 
8910 ROC_EXPORT roc_error roc_close_template_pipe(roc_template_pipe *template_pipe);
8911 
8923  const uint8_t *input_byte_array,
8924  size_t length,
8925  roc_template *template_);
8926 
8937 ROC_EXPORT roc_error roc_encode_protobuf_template(const roc_template template_,
8938  roc_buffer *buffer,
8939  size_t *buffer_length);
8940  // end of template_io
8942 
8943 #endif // !SWIG_ROC_VIDEO
8944 
8945 #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
8946 #pragma clang pop
8947 #endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
8948 
8949 #ifdef __cplusplus
8950 }
8951 #endif
8952 
8953 #endif // ROC_H
struct roc_stream_tracker_status roc_stream_tracker_status
Holds camera feed processing information for a roc_stream.
roc_event_type reasons
Reasons for specified algorithm. See Event Reasons.
Definition: roc.h:6455
virtual roc_error transmit_image(const uint8_t *data, size_t length, roc_media_id media_id, roc_camera_id camera, roc_time timestamp)
Send (caller) / recieve (callee) image data.
Definition: roc.h:8686
roc_error roc_set_opportunistic_batching(int ideal_batch_size, int maximum_latency)
Control batch processing across threads.
roc_error roc_consolidate_candidates(roc_gallery gallery, roc_similarity max_similarity, size_t k, roc_candidate *candidates)
Downsample a candidate list by removing redundant templates.
Printable version of a roc_uuid.
Definition: roc.h:2342
roc_error roc_start_database_server(roc_database database, int port, roc_server *server)
Host a database for remote access.
const char * roc_hash_string_cast(const roc_hash_string *hash)
Helper function for printing roc_hash_string in languages that can't handle fixed-length character ar...
roc_error roc_unique_person_ids(roc_const_gallery gallery, roc_person_id_array *person_ids, size_t *num_person_ids)
Retrieve the set of unique roc_template::person_id in a gallery.
roc_error roc_read_template_fd_ext(int fd, roc_template *template_, bool read_md, bool read_fv, bool read_tn)
Generalized version of roc_read_template_fd.
roc_error roc_extend(roc_gallery gallery, roc_const_gallery probes, roc_similarity threshold, bool spawn)
Extend a labeled gallery with additional templates based on similarity.
roc_error roc_database_retrieve_file(roc_database database, roc_hash key, roc_string *file_path)
Retrieve a file from the database.
roc_license_term
Optional license terms.
Definition: roc.h:2144
roc_uuid roc_uuid_get_random()
Initialize a roc_uuid to a random value.
An adjudication is used to specify the identity match/non-match relationship between two templates wi...
Definition: roc.h:7918
roc_error roc_database_next_key(roc_database database, roc_hash current_key, roc_hash *next_key)
Obtain the next key in the database.
roc_candidate candidate
Highest roc_similarity match against one of the watchlists.
Definition: roc.h:6330
struct roc_stream_type * roc_stream
Handle to a private streaming type.
Definition: roc.h:4479
A license that allows unlocked feature vectors.
Definition: roc.h:2205
roc_template_index b
Second template index.
Definition: roc.h:7921
roc_error roc_initialize_alerter(roc_alerter *alerter, const char *key_file_path)
Create a roc_alerter object.
roc_error roc_video_service_update_stream(roc_video_service video_service, const char *updated_stream_configuration)
Update a video-stream in a roc_video_service configuration.
roc_error roc_get_template_id(roc_gallery gallery, roc_template_index index, roc_template_id *template_id)
Get a template's unique id.
struct roc_event roc_event
A summary of a person in one or more videos.
roc_error roc_video_service_read_configuration(roc_video_service video_service, roc_string *current_configuration)
Read the entire Video Service Parameters configuration for a roc_video_service.
roc_error roc_stream_start(roc_stream *stream, float frames_per_second, int num_worker_threads)
Start a video stream and report frames to a generic callback function.
roc_error roc_consolidate(roc_gallery gallery, roc_similarity max_similarity, size_t max_count)
Downsample a gallery by removing redundant templates for each roc_template::person_id.
roc_candidate()
Default initialize a candidate.
Definition: roc.h:5611
roc_error roc_set_icao_background_color(uint8_t r, uint8_t g, uint8_t b)
Assign the color used by ROC_ICAO_BACKGROUND for thumbnail generation.
A summary of a person in one or more videos.
Definition: roc.h:6317
struct roc_hash_string roc_hash_string
Printable version of a roc_hash.
roc_error roc_gallery_exec_protobuf(roc_gallery gallery, uint8_t *request_data, size_t request_len, roc_buffer *response_data, size_t *response_len)
Execute a ROC Web API ProtoBuf request.
roc_error roc_get_hostname(roc_string *hostname)
Retrieve the hostname of the current machine.
roc_error roc_open_video_w(const wchar_t *file_name, roc_color_space color_space, roc_video *video, roc_video_metadata *metadata)
Open a video from a wide character file path.
A license that allows ROC_ICAO_METRICS.
Definition: roc.h:2174
roc_error roc_search_persons(roc_const_gallery gallery, roc_const_gallery probes, size_t k, roc_similarity min_similarity, bool one_candidate_per_person_id, bool ignore_identical, roc_candidate *candidates)
Search with multiple probe templates for the same person.
roc_time stop
Timestamp of the latest template associated with the event.
Definition: roc.h:6336
roc_error roc_open_spinnaker(int index, roc_color_space color_space, roc_video *camera)
Connect to a Spinnaker USB3 Vision camera.
roc_error roc_encode_image(roc_image image, const char *format, int quality, roc_buffer *buffer, size_t *buffer_length)
Encode an image to a buffer.
roc_uuid roc_uuid_get_null()
Obtain a roc_uuid set to all zeros.
roc_error roc_stream_add_image(roc_stream stream, roc_image image)
Manually add an image to a stream.
roc_error roc_compare_templates(const roc_template a, const roc_template b, roc_similarity *similarity)
Measure the similarity between two templates.
roc_error roc_video_set_camera_id(roc_video video, roc_camera_id camera_id)
Set roc_camera_id for frames read from the video.
roc_error roc_database_sync(roc_database from, const char *to, bool async)
Sync a database to another system.
roc_error roc_get_cuda_utilization(float *gpu_utilization_percentage, float *memory_utilization_percentage)
Retrieve performance characteristics for a GPU.
#define ROC_DEFAULT_LICENSE_PLATE_STATE_THRESHOLD
Default threshold for license plate state classification.
Definition: roc.h:6440
roc_error roc_realloc_metadata(roc_template *template_, uint32_t md_size)
Re-allocate metadata space to allow later in-place editing.
roc_uuid roc_uuid_from_string(const char *str)
Obtain a UUID from a string.
roc_error roc_read_frame(roc_video video, roc_image *frame)
Read the current frame and advance the video to the next frame.
roc_error roc_tracker_set_privacy_parameters(roc_tracker tracker, roc_tracker_privacy face_privacy, bool blur, roc_tracker_privacy image_privacy)
Set privacy parameters.
Messages indicating something went wrong and cannot losslessly be recovered.
Definition: roc.h:3162
roc_template_id template_id
roc_template::template_id of the candidate template in the gallery.
Definition: roc.h:5599
size_t width
Width of the video's picture.
Definition: roc.h:3134
struct roc_uuid_string roc_uuid_string
Printable version of a roc_uuid.
char data[39]
NULL-terminated string.
Definition: roc.h:2344
roc_error roc_video_set_start_time(roc_video video, roc_time timestamp)
Set the start time for pre-recorded videos.
roc_error roc_adjudicate_gallery(roc_gallery gallery, const roc_adjudication *adjudications, size_t num_adjudications)
Update a gallery with ground truth identity information.
roc_error roc_set_ssl_protocols(const char *protocol_string)
Set SSL/TLS supported protocols.
roc_error roc_open_database(const char *path, roc_database *database)
Open a connection to a database.
roc_error roc_search(roc_const_gallery gallery, const roc_template probe, size_t k, roc_similarity min_similarity, roc_candidate *candidates)
Ranked search for a probe template against a gallery of templates.
int min_count
Minimum template count for each event for specified algorithm.
Definition: roc.h:6459
roc_error roc_set_cuda_device(int device)
Control which GPU to use.
roc_error roc_open_video(const char *file_name, roc_color_space color_space, roc_video *video, roc_video_metadata *metadata)
Open a video for reading.
struct roc_tracker_algorithm_parameters roc_tracker_algorithm_parameters
A set of parameters specific to an individual roc_algorithm_id.
Suppresss video decoder logging.
Definition: roc.h:3159
struct roc_amqp_server_type * roc_amqp_server
Server handle specific to RabbitMQ deployments.
Definition: roc.h:8473
roc_error roc_set_template_pipe_log_callback(roc_template_pipe template_pipe)
Initialize roc_template_pipe_log_callback for use as a roc_log_callback in roc_set_logging.
void * roc_tracker_cast(roc_tracker tracker)
Cast and return a roc_tracker as a void*.
roc_error roc_consolidate_fingerprints(roc_gallery gallery)
Consolidate multiple fingerprints from the same person into a single template.
roc_error roc_free_video_service(roc_video_service video_service)
Stop processing and deallocate a roc_video_service object.
roc_error roc_stream_set_paused(roc_stream stream, bool paused)
Pause or unpause a stream.
roc_error roc_new_foreground(roc_foreground *foreground)
Initialize a new foreground model.
float min_quality
Minimum quality for specified algorithm. See roc_represent.
Definition: roc.h:6454
roc_error roc_foreground_render(const roc_image frame, const roc_image mask, roc_image *rendering)
Construct an image that visualizes the foreground.
roc_event_type reasons
Why this event was emitted.
Definition: roc.h:6319
roc_error roc_template_pipe_transmit_event(roc_template_pipe template_pipe, const roc_event event)
Transmit an event.
roc_error roc_start_floating_license_server(int port, roc_server *server)
Host a floating license server for remote access.
void roc_template_pipe_log_callback(const char *message)
roc_log_callback callback function for use by roc_set_logging.
roc_error roc_template_pipe_transmit_video(roc_template_pipe template_pipe, const uint8_t *data, size_t length, roc_media_id media_id, roc_camera_id camera_id, roc_time start, roc_time stop)
Transmit a video.
roc_error roc_tracker_store_clip(const roc_tracker tracker, roc_media_id media_id, roc_camera_id camera_id, roc_time *start, roc_time *stop)
Transmit a video.
char * metadata_object
JSON-formatted object to insert in each template's metadata. See roc_set_metadata.
Definition: roc.h:6462
double frame_rate
Average frame rate of the video in seconds.
Definition: roc.h:3143
#define ROC_DEFAULT_MIN_TRACKING_SIMILARITY
Default minimum tracking similarity.
Definition: roc.h:6388
roc_error roc_write_template_fd(int fd, const roc_template template_)
Write a template to a file descriptor.
roc_error roc_stream_limit(size_t *stream_limit)
The number of streams available in the license.
Printable version of a roc_hash.
Definition: roc.h:2407
Most detailed video decoder information.
Definition: roc.h:3165
struct roc_image roc_image
Common representation for still images and video frames.
size_t roc_pending_transmissions()
Obtain the total number of pending transmissions across all open remote connections.
roc_error roc_resize_image(roc_image src, roc_image *dst, size_t width, size_t height)
Resize an image.
roc_error roc_send_email(const roc_alerter alerter, const char *to_email_address, const char *recipient_name, const char *subject, const char *message, roc_buffer image_data, size_t image_data_length)
Send an email alert.
roc_error roc_get_thread_limit(int *limit)
Get the thread count limit.
roc_error roc_start_gallery_server(roc_gallery gallery, int port, roc_server *server)
Host a gallery file for remote access.
roc_error roc_foreground_roi(const roc_image mask, size_t *x, size_t *y, size_t *width, size_t *height)
Identify a rectangular region of interest that captures the foreground content.
float relative_min_size
Relative minimum size for specified algorithm. see roc_adaptive_minimum_size.
Definition: roc.h:6451
Image region of interest to restrict processing.
Definition: roc-embedded.h:834
Redact all faces.
Definition: roc.h:6689
A license that enables the Explore GUI.
Definition: roc.h:2159
160-bit data hash.
Definition: roc-embedded.h:550
float roc_similarity
A measurement between two faces quantifying the pseudo-probability that they are the same person.
Definition: roc-embedded.h:3195
roc_error roc_tracker_get_next_video_clip(const roc_tracker tracker, roc_time *start_time, roc_time *stop_time, roc_buffer *bit_stream, size_t *bit_stream_size)
Retrieve the next persistently-recorded MP4 video clip.
void roc_tracker_add_image_callback(roc_stream stream, void *tracker, roc_error error, roc_image image)
Alternative to roc_tracker_add_image with signature type roc_stream_image_callback.
roc_error roc_all_person_ids(roc_const_gallery gallery, roc_person_id_array *person_ids, size_t *num_person_ids)
Retrieve the roc_template::person_id for each template in a gallery.
roc_error roc_alerter_has_whatsapp_credentials(const roc_alerter alerter, bool *has_whatsapp_credentials)
Determine whether or not a roc_alerter can send WhatsApp alerts.
roc_error roc_tracker_set_best_image_parameters(roc_tracker tracker, roc_database database, const char *template_pipe_file, const char *format, int quality, roc_event_type reasons, bool append, bool keep_alive, bool replay_on_failure)
Set tracker best frame storage.
roc_error roc_stream_get_frame_counts(roc_stream stream, size_t *ignored, size_t *queued, size_t *processed, size_t *dropped)
Obtain frame count statistics.
#define ROC_DEFAULT_MIN_COUNT
Default minimum template count.
Definition: roc.h:6427
const char * roc_string
Represents a string output value that should be freed with roc_free_string after use.
Definition: roc-embedded.h:1232
roc_error roc_close_video(roc_video video)
Close an open video.
roc_error roc_video_service_add_stream(roc_video_service video_service, const char *new_stream_configuration)
Add video-stream configuration to a roc_video_service.
struct roc_video_service_type * roc_video_service
Handle to a private roc_video_service type.
Definition: roc.h:7413
roc_error roc_get_floating_license_status(bool *is_connected)
Check the status of the floating license connection.
roc_error roc_stream_set_image_callback(roc_stream stream, roc_stream_image_callback image_callback, void *image_callback_context)
Indicate where to send frames.
float quality
Thumbnail quality, where larger values are higher quality at the expense of more storage....
Definition: roc.h:3614
roc_error roc_tracker_set_time_elapsed(roc_tracker tracker, roc_time threshold_ms, roc_time interval_ms)
Configure tracker to emit an event for a person a specified amount of time after they were first seen...
roc_error roc_to_base64(const uint8_t *input_byte_array, size_t length, roc_string *str)
Convert a binary buffer to a Base64 string.
roc_template probe
Representative template for the event.
Definition: roc.h:6320
Do not redact any faces.
Definition: roc.h:6674
Informational messages not indicating erroneous behavior.
Definition: roc.h:3164
Messages indicating something somehow does not look correct.
Definition: roc.h:3163
roc_error roc_set_floating_license_server(const char *hostname)
Set floating license server IP address.
roc_error roc_knn_and_cluster(roc_gallery gallery, size_t k, roc_similarity min_similarity, bool incremental, roc_progress progress)
Convenience functon to call both roc_knn and roc_cluster.
roc_error roc_get_metadata_double(const roc_template template_, const char *key, double *value)
Retrieve the value for a metadata key of type double.
roc_error roc_set_person_id(roc_gallery gallery, roc_template_index index, roc_person_id person_id)
Set a template's identity label.
bool same_person
true if the templates are the same person, false if they are different people.
Definition: roc.h:7922
char * filename
Name of video file or camera URL.
Definition: roc.h:7486
virtual roc_error transmit_log(const char *message)
Send (caller) / recieve (callee) logging information.
Definition: roc.h:8716
roc_error roc_get_application_certificate(roc_string *app_cert)
Retrieve the Application Certificate of the current process.
roc_error roc_get_person_id(roc_gallery gallery, roc_template_index index, roc_person_id *person_id)
Get a template's identity label.
roc_candidate(const roc_person_id &person_id, const roc_template_id &template_id, roc_template_index index, roc_similarity similarity)
Initialize a candidate.
Definition: roc.h:5621
roc_error roc_stream_load_configuration(const char *stream_info, roc_stream *stream)
Configure and start a video stream and report frames to a generic callback function.
uint32_t roc_event_type
A combination of roc_event_reasons.
Definition: roc-embedded.h:3017
struct roc_alerter_type * roc_alerter
Handle to a private roc_alerter type.
Definition: roc.h:2530
struct roc_tracker_type * roc_tracker
A tracker takes templates from one or more videos and outputs events.
Definition: roc.h:6355
roc_error roc_write_image(roc_image image, const char *file_name)
Write an image to a file.
roc_error roc_database_has_key(roc_database database, roc_hash key, bool *has_key)
Determine if a key exists in the database.
roc_error roc_representation_limit(size_t *representation_limit)
Query the remaining representation limit.
struct roc_template_pipe_type * roc_template_pipe
Mechanism for streaming templates.
Definition: roc.h:4459
Messages indicating something went really wrong and we will crash now.
Definition: roc.h:3160
roc_error roc_get_ssl_protocols(roc_string *protocols)
Get SSL/TLS supported protocols.
struct roc_template roc_template
A digital encoding of a face.
roc_error roc_start_amqp_server(roc_amqp_server *server, roc_string location, roc_gallery gallery, const char *local_gallery_path, roc_string stream_name, int64_t offset)
Configure a gallery server to connect with a RabbitMQ Server.
roc_error roc_template_pipe_transmit(roc_template_pipe template_pipe, const roc_template template_)
Transmit a template.
char * stream_id
Unique identifier specific to this video stream.
Definition: roc.h:7491
A license that enables ROC_TATTOO_REPRESENTATION.
Definition: roc.h:2164
roc_error roc_encode_protobuf_template(const roc_template template_, roc_buffer *buffer, size_t *buffer_length)
Encode a Protobuf Template.
roc_error roc_set_server_credentials(const char *private_key, const char *certificate)
Set server SSL/TLS credentials.
roc_camera_id camera
Detection of the most recent template associated with the event.
Definition: roc.h:6343
roc_error roc_indicies_for_person_id(roc_const_gallery gallery, roc_person_id person_id, roc_template_index_array *template_indicies, size_t *num_template_indicies)
Retrieve the set of roc_template_index for a roc_person_id.
roc_error roc_tracker_add_image(roc_tracker tracker, const roc_image image, roc_stream stream)
Convenience function for generating and tracking all templates in an image.
roc_error roc_get_ssl_ciphers(roc_string *ciphers)
Get SSL/TLS supported ciphers.
roc_error roc_send_text_message(const roc_alerter alerter, const char *phone_number, const char *message, roc_buffer image_data, size_t image_data_length)
Send a text message alert.
roc_time start
Timestamp of the earliest template associated with the event.
Definition: roc.h:6334
const char * roc_error
A printable error string.
Definition: roc-embedded.h:206
#define ROC_INVALID_SIMILARITY
An invalid roc_similarity.
Definition: roc-embedded.h:3227
roc_error roc_tracker_add_encoded_image(roc_tracker tracker, size_t len, const uint8_t *input_byte_array, roc_time timestamp, roc_stream stream)
Convenience function for generating and tracking all templates in an encoded image.
A license that allows ROC_FINGERPRINT_REPRESENTATION.
Definition: roc.h:2217
roc_error roc_read_image_w(const wchar_t *file_name, roc_color_space color_space, roc_image *image)
Read an image from a wide character file path.
int width
Image width in pixels. The default is 288, and the range is -1 to 4096.
Definition: roc.h:3601
virtual roc_error transmit_data(const uint8_t *data, size_t length, roc_hash key)
Send (caller) / recieve (callee) key/value data.
Definition: roc.h:8673
A license that allows roc_enable_cuda.
Definition: roc.h:2195
roc_error roc_start_template_pipe_server(roc_template_pipe template_pipe, int port, roc_server *server)
Host a template pipe for remote access.
Messages indicating something went wrong and recovery is not possible.
Definition: roc.h:3161
roc_error roc_tracker_set_recorder_parameters(roc_tracker tracker, const char *database_path, bool keep_alive, int max_frames_stored, unsigned int idr_interval, bool persistent_recording_enabled, roc_time persistent_recording_clips_duration)
Assign and configure an output recorder to a tracker.
void(* roc_stream_image_callback)(roc_stream stream, void *, roc_error, roc_image)
Pointer to a callback function used to report video frames.
Definition: roc.h:4499
roc_error roc_rerank(roc_const_gallery gallery, size_t k, roc_candidate *candidates)
Re-rank roc_search or roc_knn results based on commonly occuring roc_person_id and roc_template_index...
roc_error roc_stream_set_encoded_image_callback(roc_stream stream, roc_stream_encoded_image_callback encoded_image_callback, void *encoded_image_callback_context)
Indicate where to send encoded frames.
Reference to a gallery template associated with a similarity to a probe.
Definition: roc.h:5595
roc_error roc_tracker_get_current_recorded_time(const roc_tracker tracker, roc_time *timestamp)
Return the timestamp of the most recently encoded frame.
struct roc_adjudication roc_adjudication
An adjudication is used to specify the identity match/non-match relationship between two templates wi...
struct roc_video_metadata roc_video_metadata
Video metadata.
roc_error roc_stream_clear_video(roc_stream stream)
Remove the input video from the stream previously assigned by roc_stream_set_video.
roc_error roc_enable_cuda(bool enabled, roc_progress progress)
Enabled/disable CUDA acceleration.
Video metadata.
Definition: roc.h:3132
roc_error roc_tracker_flush_remaining_clips(const roc_tracker tracker, roc_camera_id camera_id)
Retrieve remaining recorded video clips when finished trackering.
float scale
Thumbnail face scale, where larger values are a tighter cropping. The default is 0....
Definition: roc.h:3609
roc_error roc_stream_stop(roc_stream *stream)
Stop a video stream.
roc_error roc_seek_keyframe(roc_video video, roc_time timestamp, bool backwards)
Seek to the nearest keyframe for the given roc_time timestamp.
roc_error roc_enable_snpe(bool enabled, roc_string snpe_model_path)
Enable/disable Qualcomm Snapdragon chipset acceleration.
roc_error roc_decode_image(const uint8_t *input_byte_array, size_t len, roc_color_space color_space, roc_image *image)
Decode an image from a buffer.
struct roc_thumbnail_parameters roc_thumbnail_parameters
Set the characteristics of generated roc_template thumbnails. See ROC_THUMBNAIL for details.
void roc_tracker_add_encoded_image_callback(roc_stream stream, void *tracker, roc_error error, size_t len, const uint8_t *input_byte_array, roc_time timestamp)
Alternative to roc_tracker_add_image with signature type roc_stream_encoded_image_callback.
roc_error roc_set_video_logging(roc_video_log_level log_level)
Set video decoder log level.
roc_error roc_template_pipe_transmit_status(roc_template_pipe template_pipe, roc_stream_tracker_status_array status, size_t status_count, bool done, size_t pending_transmissions, float gpu_utilization_percent, float gpu_memory_used_percent)
Send statuses per-camera-stream.
const char * roc_uuid_string_cast(const roc_uuid_string *uuid)
Helper function for printing roc_uuid_string in languages that can't handle fixed-length character ar...
roc_error roc_write_template(FILE *file, const roc_template template_)
Write a template to a file pointer.
uint8_t roc_finger_id
A single roc_finger_options.
Definition: roc-embedded.h:2152
size_t frames_processed
Number of frames the stream has finished processing.
Definition: roc.h:7490
roc_error roc_get_host_id_extended(roc_string *host_id)
Obtain more complete information about the host system.
roc_error roc_read_template_fd(int fd, roc_template *template_)
Read a template from a file descriptor.
roc_error roc_tracker_get_earliest_recorded_time(const roc_tracker tracker, roc_time *timestamp)
Return the timestamp of the earliest held encoded frame.
size_t events
Number of roc_event detected by this stream.
Definition: roc.h:7485
size_t frames_dropped
Number of frames the stream has dropped without processing.
Definition: roc.h:7489
roc_error roc_cuda_utilization(unsigned int index, unsigned int *gpu, unsigned int *memory)
Wraps nvmlDeviceGetUtilizationRates.
roc_error roc_gallery_server_update(roc_server server, roc_gallery new_gallery, const char *original_gallery_file)
Replaces the gallery currently being served.
roc_error roc_tracker_set_represent_parameters(roc_tracker tracker, roc_algorithm_id algorithm_id, float relative_min_size, int k, float false_detection_rate, float min_quality)
Set tracker template representation parameters.
roc_error roc_merge_fingerprints(const roc_template *templates, int n, roc_template *merged)
Merge multiple individual fingerprint templates into a single comined template.
bool operator<(const roc_candidate &other) const
Sort higher scoring candidates first.
Definition: roc.h:5634
roc_error roc_close_database(roc_database *database)
Close a connection to a database.
roc_similarity similarity
Similarity of the candidate template to the probe.
Definition: roc.h:5604
const uint8_t * roc_buffer
Represents a buffer output value that should be freed with roc_free_buffer after use.
Definition: roc-embedded.h:1272
roc_hash roc_hash_from_string(const char *str)
Convert a string to a roc_hash.
bool roc_stream_is_paused(roc_stream stream)
Check if a stream is paused.
roc_error roc_tracker_set_rendering_options(roc_tracker tracker, bool render_detections, bool render_foreground, bool render_timestamps, bool render_person_ids, bool render_recording, uint8_t r, uint8_t g, uint8_t b)
Set roc_tracker frame rendering options.
roc_error roc_new_tracker(roc_tracker *tracker)
Initialize a new tracker.
roc_error roc_template_pipe_transmit_data(roc_template_pipe template_pipe, const uint8_t *data, size_t length, roc_hash key)
Transmit a key/value pair.
roc_error roc_stream_add_encoded_image(roc_stream stream, size_t len, const uint8_t *input_byte_array, roc_time timestamp)
Manually add an encoded image to a stream.
roc_error roc_video_service_start(roc_video_service video_service, roc_string global_settings)
Configure system settings for a roc_video_service object.
roc_error roc_tracker_get_video_clip(const roc_tracker tracker, roc_time *start_time, roc_time *stop_time, roc_buffer *bit_stream, size_t *bit_stream_size)
Retrieve an MP4 video clip.
roc_error roc_alerter_has_sms_credentials(const roc_alerter alerter, bool *has_sms_credentials)
Determine whether or not a roc_alerter can send SMS/MMS alerts.
A digital encoding of a face.
Definition: roc-embedded.h:2675
roc_media_id media_id
See roc_media_id.
Definition: roc.h:3148
roc_error roc_from_base64(const char *str, roc_buffer *buffer, size_t *buffer_length)
Convert a Base64 string to a binary buffer.
roc_error roc_set_cuda_benchmarking(bool benchmark, bool clear_cache)
Control CUDA benchmarking.
#define ROC_DEFAULT_MAX_TIME_SEPARATION
Default maximum time separation.
Definition: roc.h:6414
roc_error roc_decode_protobuf_template(const uint8_t *input_byte_array, size_t length, roc_template *template_)
Decode a Protobuf Template.
roc_error roc_free_foreground(roc_foreground *foreground)
Free a foreground model.
roc_algorithm_options
Supported algorithm configurations for use in roc_represent.
Definition: roc-embedded.h:1618
roc_error roc_tracker_best_image(roc_tracker tracker, roc_person_id person_id, roc_image *image)
Retrieve the current best image for an active track.
float quality
Face Quality of probe.
Definition: roc.h:6321
roc_error roc_tracker_remove_watchlist(roc_tracker tracker, roc_gallery watchlist)
Remove a watchlist from a tracker.
char data[41]
NULL-terminated string.
Definition: roc.h:2409
roc_error roc_tracker_set_rois(roc_tracker tracker, const roc_roi *include, size_t num_include, const roc_roi *exclude, size_t num_exclude, float min_roi_overlap)
Specify image regions of interest (ROI) for processing.
roc_error roc_get_floating_license_limit(uint32_t *clients_remaining, uint64_t *comparisons_remaining)
Query the floating license server for limits.
uint32_t count
Number of templates associated with the event.
Definition: roc.h:6344
128-bit universally unique identifier.
Definition: roc-embedded.h:325
roc_error roc_tracker_set_foreground_parameters(roc_tracker tracker)
Automatically crop a region of interest based on foreground change relative to a static background mo...
roc_person_id replaced_by
When ROC_MERGED_TRACKS, this value holds the replacing events's probe roc_template::person_id.
Definition: roc.h:6322
roc_error roc_redact_image(roc_image image, roc_detection detection, bool blur)
Obfuscate a region in the image.
Set the characteristics of generated roc_template thumbnails. See ROC_THUMBNAIL for details.
Definition: roc.h:3597
roc_error roc_clear_feature_vector(roc_template *template_, roc_algorithm_id representations)
Clear template feature vector.
uint64_t roc_time
Time in milliseconds.
Definition: roc-embedded.h:716
A license that allows ROC_ALL_OBJECT_DETECTION.
Definition: roc.h:2185
roc_gallery watchlist
Watchlist corresponding to candidate.
Definition: roc.h:6332
roc_error roc_stream_set_warmup(roc_stream stream, roc_time warmup)
Drop frames from the start of the video for the specified amount of time.
roc_error roc_get_metadata(const roc_template template_, const char *key, roc_string *value)
Retrieve the value for a metadata key.
roc_hash roc_hash_calc_sha1(const uint8_t *input_byte_array, size_t length)
Compute the SHA-1 hash of a data buffer.
roc_similarity min_tracking_similarity
Minimum tracking similarity for specified algorithm. See Minimum Similarity.
Definition: roc.h:6458
roc_error roc_tracker_store_next_clip(const roc_tracker tracker, roc_media_id media_id, roc_camera_id camera_id, roc_time *start, roc_time *stop)
Transmit a persistently recorded video clip.
roc_time duration
Length of the opened video in milliseconds. Defaults to 0 for videos of unknown duration such as webc...
Definition: roc.h:3136
bool roc_tracker_has_events(roc_tracker tracker, roc_time wait)
Query if the tracker has events.
A license that allows ROC_TEXT_DETECTION and ROC_TEXT_REPRESENTATION.
Definition: roc.h:2180
roc_error roc_stream_set_video(roc_stream stream, roc_video video)
Assign an input video to a stream.
roc_error roc_compare_galleries(roc_const_gallery target, roc_const_gallery query, roc_similarity *similarity_matrix)
Measure the pairwise similarity between all templates in two galleries.
struct roc_foreground_type * roc_foreground
Handle to a private foreground modeling type.
Definition: roc.h:6180
roc_template_index index
Index of the candidate template in the gallery.
Definition: roc.h:5602
roc_error roc_render_detection(roc_image image, const roc_detection detection, uint8_t r, uint8_t g, uint8_t b)
Render a detection bounding box on an image.
roc_video_log_level
Video decoder log levels.
Definition: roc.h:3157
int64_t roc_algorithm_id
A combination of roc_algorithm_options.
Definition: roc-embedded.h:1599
roc_error roc_database_add_data(roc_database database, const uint8_t *input_byte_array, size_t length, roc_hash key)
Add arbitrary data to the database.
roc_error roc_stream_get_true_frame_rate(roc_stream stream, float *frames_per_second)
Obtain the real-time processing speed.
roc_thumbnail_parameters thumbnail_parameters
Parameters to use for generating template thumbnails. See ROC_THUMBNAIL.
Definition: roc.h:6461
roc_error roc_close_template_pipe(roc_template_pipe *template_pipe)
Deallocate a roc_template_pipe.
roc_error roc_tracker_get_current_frame(roc_tracker tracker, roc_image *frame, roc_event *events, int *num_events)
Obtain the most recently processed frame.
roc_error roc_seek_frame(roc_video video, roc_time timestamp)
Seek to the nearest frame for the given roc_time timestamp.
roc_error roc_free_alerter(roc_alerter *alerter)
Free a roc_alerter object.
roc_error roc_convert_nv21(const uint8_t *input_byte_array, size_t width, size_t height, roc_image *image)
Convert an NV21-formatted buffer to a roc_image.
roc_detection latest_detection
Detection of the earliest template associated with the event.
Definition: roc.h:6340
float min_detection_overlap
Minimum detection overlap for specified algorithm. See Minimum Detection Overlap.
Definition: roc.h:6457
roc_error roc_represent_fingerprint(roc_image image, roc_finger_id finger_id, const int resolution, const int k, float false_detection_rate, float min_quality, roc_template *templates)
Encode a fingerprint image into a ROC fingerprint template suitable for comparison and matching.
roc_error roc_set_metadata_double(roc_template *template_, const char *key, double value)
Add, update, or remove a single key/value pair in the metadata of a template of type double.
roc_camera_id camera_id
See roc_camera_id.
Definition: roc.h:3149
roc_error roc_free_tracker(roc_tracker tracker)
Free a tracker.
bool is_live
Indicates whether the video is live or pre-recorded.
Definition: roc.h:3150
roc_error roc_tracker_set_tracking_parameters(roc_tracker tracker, roc_event_type reasons, roc_time max_time_separation, float min_detection_overlap, roc_similarity min_tracking_similarity, int min_count)
Set tracker tracking parameters.
Redact faces that do match a watchlist.
Definition: roc.h:6684
#define ROC_SUGGESTED_MIN_DETECTION_OVERLAP
Suggested minimum detection overlap.
Definition: roc.h:6401
roc_algorithm_id algorithm_id
Algorithm to use these parameters for.
Definition: roc.h:6450
int bit_rate
Number of bits per second. Equal to.
Definition: roc.h:3145
void(* roc_stream_encoded_image_callback)(roc_stream stream, void *, roc_error, size_t, const uint8_t *, roc_time)
Pointer to a callback function used to report encoded video frames.
Definition: roc.h:4521
roc_error roc_database_add_link(roc_database database, const char *file_path, roc_hash key)
Add a symlink of a file to the database.
roc_error roc_release_search_thread()
Return the calling thread's access to roc_compare_templates to normal speed.
roc_error roc_video_service_remove_stream(roc_video_service video_service, const char *removed_stream_id)
Remove a video-stream from a roc_video_service configuration.
roc_error roc_database_add_file(roc_database database, const char *file_path, roc_hash key)
Add a file to the database.
roc_error roc_stream_sync(roc_stream stream, roc_time timestamp)
Pauses the calling thread until there are no remaining roc_stream worker threads processing earlier f...
roc_error roc_finalize()
Call once at the end of the application after making all other calls to the API.
int k
K value for specified algorithm. See roc_represent.
Definition: roc.h:6452
roc_error roc_get_license_term(roc_license_term license_term, bool *enabled)
Check if a license term is enabled.
A license that allows ROC_SPOOF.
Definition: roc.h:2169
void(* roc_progress)(float)
Pointer to a callback function used to report progress on a long running task.
Definition: roc-embedded.h:3411
roc_error roc_stop_server(roc_server *server)
Stop a running roc_server.
roc_error roc_stream_set_frame_rate(roc_stream stream, float frames_per_second)
Change the processing frame rate.
roc_uuid_string roc_uuid_to_string(roc_uuid uuid)
Convert a UUID to a string.
roc_error roc_represent_roi(roc_image image, roc_algorithm_id algorithm_id, float relative_min_size, size_t absolute_min_size, size_t min_representation_size, int k, float false_detection_rate, float min_quality, const roc_roi *include, size_t num_include, const roc_roi *exclude, size_t num_exclude, float min_roi_overlap, const roc_string text_filter, const roc_thumbnail_parameters thumbnail_parameters, bool rotate_on_failure, roc_template *templates)
A generalization of roc_represent that supports additional fields specifying where in an image to pro...
roc_error roc_tracker_update_time(roc_tracker tracker, roc_time timestamp)
Update a tracker's current time.
roc_error roc_database_first_key(roc_database database, roc_hash *first_key)
Obtain the first key in the database.
roc_error roc_knn(roc_const_gallery gallery, roc_const_gallery probes, size_t k, roc_similarity min_similarity, roc_candidate *neighbors, roc_progress progress)
Construct the k-nearest neighbors graph of a gallery.
roc_template_index a
First template index.
Definition: roc.h:7920
roc_error roc_template_pipe_transmit_log(roc_template_pipe template_pipe, const char *message)
Send logging information.
roc_hash roc_hash_calc_sha1_file(const char *file_path)
Compute a SHA-1 hash of a file.
roc_error roc_preinitialize_android(void *JNIEnv, void *jobject)
Inform the ROC SDK about the Java calling environment.
roc_error roc_read_template(FILE *file, roc_template *template_)
Read a template from a file pointer.
A license that disables feature vector construction.
Definition: roc.h:2154
roc_error roc_set_ssl_ciphers(const char *cipher_string)
Set SSL/TLS supported protocols.
size_t height
Height of the video's picture.
Definition: roc.h:3135
roc_error roc_preload(roc_algorithm_id algorithm_id)
Pre-load the model files to be used by roc_represent.
roc_error roc_tracker_load_configuration(const char *tracker_info, roc_gallery *galleries, size_t gallery_count, const char *process_id, roc_tracker tracker)
Configure roc_tracker.
roc_error roc_acquire_search_thread()
Unlock the full speed of roc_compare_templates.
roc_error roc_comparison_limit(size_t *comparison_limit)
Query the remaining comparison limit.
roc_error roc_read_image(const char *file_name, roc_color_space color_space, roc_image *image)
Read an image from a file.
roc_error roc_open_template_pipe(const char *template_pipe_file, bool append, bool keep_alive, bool replay_on_failure, const char *sender_id, roc_template_pipe *template_pipe)
Open a connection to a server to send templates.
True if roc_initialize has been called successfully.
Definition: roc.h:2149
struct roc_uuid roc_uuid
128-bit universally unique identifier.
roc_time previous_event
Holds probe roc_template::timestamp for the most recent emitted event for use by ROC_ELAPSED_INTERVAL...
Definition: roc.h:6326
roc_error roc_tracker_set_output_pipe(roc_tracker tracker, const char *template_pipe_file, bool append, bool keep_alive, bool replay_on_failure, int frame_rate, int quality, size_t height)
Assign an output image pipe to a tracker.
roc_error roc_set_metadata(roc_template *template_, const char *key, const char *value)
Add, update, or remove a single key/value pair in the metadata of a template.
roc_stream_tracker_status * roc_stream_tracker_status_array
Definition: roc.h:7499
roc_error roc_is_live(roc_video video, bool *is_live)
Determine if a video is live or recorded.
roc_error roc_new_video_service(roc_video_service *video_service)
Create a roc_video_service object.
bool enabled
True if the stream is still processing frames. If false, camera is no longer part of the running roc_...
Definition: roc.h:7483
roc_error roc_tracker_add_template(roc_tracker tracker, const roc_template template_)
Add a template to a tracker.
roc_error roc_stop_amqp_server(roc_amqp_server *server)
Stop a running roc_amqp_server.
roc_hash roc_hash_get_random()
Initialize a roc_hash from a random value.
A license that enables the Watch VMS system.
Definition: roc.h:2190
roc_person_id person_id
roc_template::person_id of the candidate template in the gallery.
Definition: roc.h:5597
float fps
Average frames per second this stream is processing.
Definition: roc.h:7487
roc_error roc_template_pipe_transmit_image(roc_template_pipe template_pipe, const uint8_t *data, size_t length, roc_media_id media_id, roc_camera_id camera_id, roc_time timestamp)
Transmit an image.
roc_error roc_read_exif(const char *jpeg_file_name, roc_string *exif)
Returns Exif information of a JPEG file as a JSON object.
virtual roc_error transmit_event(const roc_event &event)
Send (caller) / recieve (callee) a roc_event.
Definition: roc.h:8665
struct roc_hash roc_hash
160-bit data hash.
roc_error roc_send_whatsapp_message(const roc_alerter alerter, const char *phone_number, const char *alerts_sender_name, const char *person_name, const char *camera_name, const char *date_time, roc_buffer image_data, size_t image_data_length)
Send a WhatsApp message alert.
A set of parameters specific to an individual roc_algorithm_id.
Definition: roc.h:6449
roc_error roc_read_ebts(const char *file_path, int num_face_images, roc_string *ebts, roc_image *images)
Read in an EBTS transaction file.
roc_color_space
Supported image formats.
Definition: roc-embedded.h:747
roc_error roc_indicies_for_media_id(roc_const_gallery gallery, roc_media_id media_id, roc_template_index_array *template_indicies, size_t *num_template_indicies)
Retrieve the set of roc_template_index for a roc_media_id.
roc_error roc_database_retrieve_data(roc_database database, roc_hash key, roc_buffer *data, size_t *length)
Retrieve file data from the database.
roc_error roc_clear_thumbnail(roc_template *template_)
Clear template thumbnail.
int height
Image height in pixels. The default is 384, and the range is -1 to 4096.
Definition: roc.h:3605
void(* roc_stream_template_callback)(roc_stream stream, void *, roc_error, roc_template)
Pointer to a callback function used to report templates.
Definition: roc.h:4540
size_t frames_queued
Number of frames the stream has decoded, buffered, and not yet processed.
Definition: roc.h:7488
roc_error roc_set_thumbnail_parameters(roc_thumbnail_parameters thumbnail_parameters)
Set the parameters used by ROC_THUMBNAIL in roc_represent.
roc_error roc_foreground_quality(const roc_image mask, float *foreground_quality)
Calculate a quality value based on the number of foreground pixels in the image.
roc_time keyframe_interval
Approximate milliseconds between keyframes. Defaults to 0 for webcam and IP camera video streams.
Definition: roc.h:3140
roc_time max_time_separation
Maximum time separation for specified algorithm. See Maximum Time Separation.
Definition: roc.h:6456
roc_error roc_adjudicate_knn(size_t gallery_size, size_t k, roc_candidate *neighbors, const roc_adjudication *adjudications, size_t num_adjudications)
Update a KNN graph with ground truth identity information.
roc_error roc_tracker_add_watchlist(roc_tracker tracker, roc_gallery watchlist)
Add a watchlist to a tracker.
roc_error roc_open_gst_video(const char *video_url, roc_color_space color_space, bool gpu_decoding, roc_video *video)
Open a live video stream via GStreamer.
struct roc_candidate roc_candidate
Reference to a gallery template associated with a similarity to a probe.
Data structure for a face detection.
Definition: roc-embedded.h:1370
roc_error roc_set_server_protocol(bool use_http)
Define the protocol the server should use.
void roc_free_stream_tracker_status_array(roc_stream_tracker_status_array *stream_tracker_status_array, size_t status_count)
Deallocate a roc_stream_tracker_status.
float false_detection_rate
False detection rate for specified algorithm. See False Detection Rate.
Definition: roc.h:6453
roc_error roc_set_model_path(const char *path)
Set path to the object and/or text detection configuration files.
roc_tracker_privacy
When to redact faces in a video stream.
Definition: roc.h:6669
roc_error roc_alerter_has_email_credentials(const roc_alerter alerter, bool *has_email_credentials)
Determine whether or not a roc_alerter can send email alerts.
roc_error roc_tracker_take_event(roc_tracker tracker, roc_event *event)
Obtain the next event from a tracker.
A cross-language cross-computer mechanism for streaming templates and media.
Definition: roc.h:8652
virtual roc_error transmit_status(roc_stream_tracker_status_array status, size_t status_count, bool done, size_t pending_transmissions, float gpu_utilization_percent, float gpu_memory_used_percent)
Send (caller) / recieve (callee) stream statuses.
Definition: roc.h:8725
roc_error roc_foreground_add_frame(roc_foreground foreground, const roc_image frame, roc_image *mask)
Classify image pixels into foreground and background.
roc_hash_string roc_hash_to_string(roc_hash hash)
Convert a hash to a string.
roc_error roc_consolidate_persons(roc_gallery gallery, roc_similarity max_similarity)
Downsample a gallery by removing redundant persons.
roc_error roc_rank_persons(roc_const_gallery gallery, const roc_template probe, size_t k, roc_person_id *person_ids, roc_similarity *similarities)
Order persons by similarity to probe.
roc_error roc_clear_metadata(roc_template *template_)
Clear template metadata.
roc_error roc_set_keylok_keys(int validateCode1, int validateCode2, int validateCode3, int clientIDCode1, int clientIDCode2, int readCode3)
Set Keylok device specific keys.
roc_error roc_cuda_device_count(unsigned int *device_count)
Wraps nvmlDeviceGetCount.
roc_error roc_set_thread_limit(int limit)
Set the thread count limit.
struct roc_database_type * roc_database
Path to an existing folder to store the files.
Definition: roc.h:5967
roc_error roc_tracker_set_enhance_contrast_parameters(roc_tracker tracker, float clip_limit, int num_tiles)
Enhance the contrast of each frame using roc_enhance_contrast.
Redact faces that don't match a watchlist.
Definition: roc.h:6679
roc_error roc_cluster(roc_gallery gallery, size_t k, const roc_candidate *neighbors, roc_similarity similarity, bool incremental, roc_progress progress)
Construct clusters from a k-nearest neighbors graph.
roc_error roc_tracker_set_algorithm_parameters(roc_tracker tracker, const roc_tracker_algorithm_parameters *algorithm_params_list, size_t list_size)
Set multiple configurations of tracker algorithm parameters.
roc_error roc_tracker_set_watchlisting_parameters(roc_tracker tracker, roc_similarity min_watchlist_similarity)
Set tracker watchlisting parameters.
Common representation for still images and video frames.
Definition: roc-embedded.h:811
roc_error roc_database_remove(roc_database database, roc_hash key)
Remove a file from the database.
A license that allows ROC_STANDARD_DETECTION, ROC_FRONTAL_DETECTION, ROC_FAST_REPRESENTATION,...
Definition: roc.h:2212
struct roc_server_type * roc_server
Abstract server handle.
Definition: roc.h:8429
virtual roc_error transmit_video(const uint8_t *data, size_t length, roc_media_id media_id, roc_camera_id camera, roc_time start, roc_time stop)
Send (caller) / recieve (callee) video data.
Definition: roc.h:8700
roc_error roc_server_connections(roc_server server, int *connections)
Obtain the number of clients connected to a server.
roc_error roc_represent(roc_image image, roc_algorithm_id algorithm_id, size_t min_size, int k, float false_detection_rate, float min_quality, roc_template *templates)
Detect faces and objects in an image. Process faces into templates for comparison.
roc_error roc_get_thumbnail_parameters(roc_thumbnail_parameters *thumbnail_parameters)
Get the parameters used by ROC_THUMBNAIL in roc_represent.
roc_error roc_video_service_status(roc_video_service video_service, roc_stream_tracker_status_array *stream_tracker_statuses, size_t *num_stream_tracker_statuses, bool *done, size_t *pending_transmissions)
Check status for a roc_video_service object.
Holds camera feed processing information for a roc_stream.
Definition: roc.h:7482
char * text_filter
Regular expressions describing text to check for in detection areas.
Definition: roc.h:6460
roc_error roc_initialize(const char *license_file, const char *log_file)
Call once at the start of the application before making any other calls to the API.
struct roc_video_type * roc_video
Handle to a private video decoding type.
Definition: roc.h:3127
Data structure for a landmark detection.
Definition: roc-embedded.h:1350
roc_error roc_set_metadata_object(roc_template *template_, const char *json_object)
Extend the metadata of a template with additional key/value pairs.