image_provider.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
  11. ==============================================================================*/
  12. #ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_IMAGE_PROVIDER_H_
  13. #define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_IMAGE_PROVIDER_H_
  14. #include "tensorflow/lite/c/common.h"
  15. #include "tensorflow/lite/micro/micro_error_reporter.h"
  16. // This is an abstraction around an image source like a camera, and is
  17. // expected to return 8-bit sample data. The assumption is that this will be
  18. // called in a low duty-cycle fashion in a low-power application. In these
  19. // cases, the imaging sensor need not be run in a streaming mode, but rather can
  20. // be idled in a relatively low-power mode between calls to GetImage(). The
  21. // assumption is that the overhead and time of bringing the low-power sensor out
  22. // of this standby mode is commensurate with the expected duty cycle of the
  23. // application. The underlying sensor may actually be put into a streaming
  24. // configuration, but the image buffer provided to GetImage should not be
  25. // overwritten by the driver code until the next call to GetImage();
  26. //
  27. // The reference implementation can have no platform-specific dependencies, so
  28. // it just returns a static image. For real applications, you should
  29. // ensure there's a specialized implementation that accesses hardware APIs.
  30. TfLiteStatus GetImage(tflite::ErrorReporter* error_reporter, int image_width,
  31. int image_height, int channels, int8_t* image_data);
  32. #endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_IMAGE_PROVIDER_H_