Deploying Edge Impulse as a C library

Hello, I’m wondering what should I look out for when deploying Edge Impulse as a C library.


Hi @benlim,

I recommend starting with these guides to deploy your model as a C++ library:

Please let us know if you run into any errors or need help navigating any particular confusing bits.

Hey @shawn_edgeimpulse - these docs refer to a C++ library. Is it possible to run this as a C library instead of C++?

Hello @JimBobBennett,

You can find here the base repository when using C: GitHub - edgeimpulse/example-standalone-inferencing-c: Builds and runs an exported impulse locally (C)



@louis The GitHub link you mentioned shows how to run an inference once one has features. My question is, say I capture an image into memory on my Arduino Portenta. How do I convert that image into features so that I can then implement the GitHub code aforementioned.


you could replace that part:

With that code:

int raw_feature_get_data(size_t offset, size_t out_len, float *signal_ptr)
  size_t pixel_ix = offset * 3;
  size_t bytes_left = out_len;
  size_t out_ptr_ix = 0;

  // read byte for byte
  while (bytes_left != 0) {
    // grab the values and convert to r/g/b
    uint8_t r, g, b;
    r = resized_matrix->item[pixel_ix];
    g = resized_matrix->item[pixel_ix + 1];
    b = resized_matrix->item[pixel_ix + 2];

    // then convert to out_ptr format
    float pixel_f = (r << 16) + (g << 8) + b;
    signal_ptr[out_ptr_ix] = pixel_f;

    // and go to the next pixel
    pixel_ix += 3;
  return 0;

If you want the full example, you can see how to grab the image from an ESP32-CAM after the board boots and then classifies it:



1 Like