test_camera.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include "freertos/FreeRTOS.h"
  4. #include "freertos/task.h"
  5. #include "unity.h"
  6. #include <mbedtls/base64.h>
  7. #include "esp_log.h"
  8. #include "driver/i2c.h"
  9. #include "esp_camera.h"
  10. #ifdef CONFIG_IDF_TARGET_ESP32
  11. #define BOARD_WROVER_KIT 1
  12. #elif defined CONFIG_IDF_TARGET_ESP32S2
  13. #define BOARD_CAMERA_MODEL_ESP32S2 1
  14. #elif defined CONFIG_IDF_TARGET_ESP32S3
  15. #define BOARD_CAMERA_MODEL_ESP32_S3_EYE 1
  16. #endif
  17. // WROVER-KIT PIN Map
  18. #if BOARD_WROVER_KIT
  19. #define PWDN_GPIO_NUM -1 //power down is not used
  20. #define RESET_GPIO_NUM -1 //software reset will be performed
  21. #define XCLK_GPIO_NUM 21
  22. #define SIOD_GPIO_NUM 26
  23. #define SIOC_GPIO_NUM 27
  24. #define Y9_GPIO_NUM 35
  25. #define Y8_GPIO_NUM 34
  26. #define Y7_GPIO_NUM 39
  27. #define Y6_GPIO_NUM 36
  28. #define Y5_GPIO_NUM 19
  29. #define Y4_GPIO_NUM 18
  30. #define Y3_GPIO_NUM 5
  31. #define Y2_GPIO_NUM 4
  32. #define VSYNC_GPIO_NUM 25
  33. #define HREF_GPIO_NUM 23
  34. #define PCLK_GPIO_NUM 22
  35. // ESP32Cam (AiThinker) PIN Map
  36. #elif BOARD_ESP32CAM_AITHINKER
  37. #define PWDN_GPIO_NUM 32
  38. #define RESET_GPIO_NUM -1 //software reset will be performed
  39. #define XCLK_GPIO_NUM 0
  40. #define SIOD_GPIO_NUM 26
  41. #define SIOC_GPIO_NUM 27
  42. #define Y9_GPIO_NUM 35
  43. #define Y8_GPIO_NUM 34
  44. #define Y7_GPIO_NUM 39
  45. #define Y6_GPIO_NUM 36
  46. #define Y5_GPIO_NUM 21
  47. #define Y4_GPIO_NUM 19
  48. #define Y3_GPIO_NUM 18
  49. #define Y2_GPIO_NUM 5
  50. #define VSYNC_GPIO_NUM 25
  51. #define HREF_GPIO_NUM 23
  52. #define PCLK_GPIO_NUM 22
  53. #elif BOARD_CAMERA_MODEL_ESP32S2
  54. #define PWDN_GPIO_NUM -1
  55. #define RESET_GPIO_NUM -1
  56. #define VSYNC_GPIO_NUM 21
  57. #define HREF_GPIO_NUM 38
  58. #define PCLK_GPIO_NUM 11
  59. #define XCLK_GPIO_NUM 40
  60. #define SIOD_GPIO_NUM 17
  61. #define SIOC_GPIO_NUM 18
  62. #define Y9_GPIO_NUM 39
  63. #define Y8_GPIO_NUM 41
  64. #define Y7_GPIO_NUM 42
  65. #define Y6_GPIO_NUM 12
  66. #define Y5_GPIO_NUM 3
  67. #define Y4_GPIO_NUM 14
  68. #define Y3_GPIO_NUM 37
  69. #define Y2_GPIO_NUM 13
  70. #elif BOARD_CAMERA_MODEL_ESP32_S3_EYE
  71. #define PWDN_GPIO_NUM 43
  72. #define RESET_GPIO_NUM 44
  73. #define VSYNC_GPIO_NUM 6
  74. #define HREF_GPIO_NUM 7
  75. #define PCLK_GPIO_NUM 13
  76. #define XCLK_GPIO_NUM 15
  77. #define SIOD_GPIO_NUM 4
  78. #define SIOC_GPIO_NUM 5
  79. #define Y9_GPIO_NUM 16
  80. #define Y8_GPIO_NUM 17
  81. #define Y7_GPIO_NUM 18
  82. #define Y6_GPIO_NUM 12
  83. #define Y5_GPIO_NUM 11
  84. #define Y4_GPIO_NUM 10
  85. #define Y3_GPIO_NUM 9
  86. #define Y2_GPIO_NUM 8
  87. #endif
  88. #define I2C_MASTER_SCL_IO 4 /*!< GPIO number used for I2C master clock */
  89. #define I2C_MASTER_SDA_IO 5 /*!< GPIO number used for I2C master data */
  90. #define I2C_MASTER_NUM 0 /*!< I2C master i2c port number, the number of i2c peripheral interfaces available will depend on the chip */
  91. #define I2C_MASTER_FREQ_HZ 100000 /*!< I2C master clock frequency */
  92. static const char *TAG = "test camera";
  93. typedef void (*decode_func_t)(uint8_t *jpegbuffer, uint32_t size, uint8_t *outbuffer);
  94. static esp_err_t init_camera(uint32_t xclk_freq_hz, pixformat_t pixel_format, framesize_t frame_size, uint8_t fb_count, int sccb_sda_gpio_num, int sccb_port)
  95. {
  96. framesize_t size_bak = frame_size;
  97. if (PIXFORMAT_JPEG == pixel_format && FRAMESIZE_SVGA > frame_size) {
  98. frame_size = FRAMESIZE_HD;
  99. }
  100. camera_config_t camera_config = {
  101. .pin_pwdn = PWDN_GPIO_NUM,
  102. .pin_reset = RESET_GPIO_NUM,
  103. .pin_xclk = XCLK_GPIO_NUM,
  104. .pin_sccb_sda = sccb_sda_gpio_num, // If pin_sccb_sda is -1, sccb will use the already initialized i2c port specified by `sccb_i2c_port`.
  105. .pin_sccb_scl = SIOC_GPIO_NUM,
  106. .sccb_i2c_port = sccb_port,
  107. .pin_d7 = Y9_GPIO_NUM,
  108. .pin_d6 = Y8_GPIO_NUM,
  109. .pin_d5 = Y7_GPIO_NUM,
  110. .pin_d4 = Y6_GPIO_NUM,
  111. .pin_d3 = Y5_GPIO_NUM,
  112. .pin_d2 = Y4_GPIO_NUM,
  113. .pin_d1 = Y3_GPIO_NUM,
  114. .pin_d0 = Y2_GPIO_NUM,
  115. .pin_vsync = VSYNC_GPIO_NUM,
  116. .pin_href = HREF_GPIO_NUM,
  117. .pin_pclk = PCLK_GPIO_NUM,
  118. //EXPERIMENTAL: Set to 16MHz on ESP32-S2 or ESP32-S3 to enable EDMA mode
  119. .xclk_freq_hz = xclk_freq_hz,
  120. .ledc_timer = LEDC_TIMER_0,
  121. .ledc_channel = LEDC_CHANNEL_0,
  122. .pixel_format = pixel_format, //YUV422,GRAYSCALE,RGB565,JPEG
  123. .frame_size = frame_size, //QQVGA-UXGAQQVGA-UXGA, For ESP32, do not use sizes above QVGA when not JPEG. The performance of the ESP32-S series has improved a lot, but JPEG mode always gives better frame rates.
  124. .jpeg_quality = 12, //0-63, for OV series camera sensors, lower number means higher quality
  125. .fb_count = fb_count, //When jpeg mode is used, if fb_count more than one, the driver will work in continuous mode.
  126. .grab_mode = CAMERA_GRAB_WHEN_EMPTY
  127. };
  128. //initialize the camera
  129. esp_err_t ret = esp_camera_init(&camera_config);
  130. if (ESP_OK == ret && PIXFORMAT_JPEG == pixel_format && FRAMESIZE_SVGA > size_bak) {
  131. sensor_t *s = esp_camera_sensor_get();
  132. s->set_framesize(s, size_bak);
  133. }
  134. return ret;
  135. }
  136. static bool camera_test_fps(uint16_t times, float *fps, uint32_t *size)
  137. {
  138. *fps = 0.0f;
  139. *size = 0;
  140. uint32_t s = 0;
  141. uint32_t num = 0;
  142. uint64_t total_time = esp_timer_get_time();
  143. for (size_t i = 0; i < times; i++) {
  144. camera_fb_t *pic = esp_camera_fb_get();
  145. if (NULL == pic) {
  146. ESP_LOGW(TAG, "fb get failed");
  147. return 0;
  148. } else {
  149. s += pic->len;
  150. num++;
  151. }
  152. esp_camera_fb_return(pic);
  153. }
  154. total_time = esp_timer_get_time() - total_time;
  155. if (num) {
  156. *fps = num * 1000000.0f / total_time ;
  157. *size = s / num;
  158. }
  159. return 1;
  160. }
  161. static const char *get_cam_format_name(pixformat_t pixel_format)
  162. {
  163. switch (pixel_format) {
  164. case PIXFORMAT_JPEG: return "JPEG";
  165. case PIXFORMAT_RGB565: return "RGB565";
  166. case PIXFORMAT_RGB888: return "RGB888";
  167. case PIXFORMAT_YUV422: return "YUV422";
  168. default:
  169. break;
  170. }
  171. return "UNKNOW";
  172. }
  173. static void printf_img_base64(const camera_fb_t *pic)
  174. {
  175. uint8_t *outbuffer = NULL;
  176. size_t outsize = 0;
  177. if (PIXFORMAT_JPEG != pic->format) {
  178. fmt2jpg(pic->buf, pic->width * pic->height * 2, pic->width, pic->height, pic->format, 50, &outbuffer, &outsize);
  179. } else {
  180. outbuffer = pic->buf;
  181. outsize = pic->len;
  182. }
  183. uint8_t *base64_buf = calloc(1, outsize * 4);
  184. if (NULL != base64_buf) {
  185. size_t out_len = 0;
  186. mbedtls_base64_encode(base64_buf, outsize * 4, &out_len, outbuffer, outsize);
  187. printf("%s\n", base64_buf);
  188. free(base64_buf);
  189. if (PIXFORMAT_JPEG != pic->format) {
  190. free(outbuffer);
  191. }
  192. } else {
  193. ESP_LOGE(TAG, "malloc for base64 buffer failed");
  194. }
  195. }
  196. static void camera_performance_test(uint32_t xclk_freq, uint32_t pic_num)
  197. {
  198. esp_err_t ret = ESP_OK;
  199. //detect sensor information
  200. TEST_ESP_OK(init_camera(20000000, PIXFORMAT_RGB565, FRAMESIZE_QVGA, 2, SIOD_GPIO_NUM, -1));
  201. sensor_t *s = esp_camera_sensor_get();
  202. camera_sensor_info_t *info = esp_camera_sensor_get_info(&s->id);
  203. TEST_ASSERT_NOT_NULL(info);
  204. TEST_ESP_OK(esp_camera_deinit());
  205. vTaskDelay(500 / portTICK_RATE_MS);
  206. framesize_t max_size = info->max_size;
  207. pixformat_t all_format[] = {PIXFORMAT_JPEG, PIXFORMAT_RGB565, PIXFORMAT_YUV422, };
  208. pixformat_t *format_s = &all_format[0];
  209. pixformat_t *format_e = &all_format[2];
  210. if (false == info->support_jpeg) {
  211. format_s++; // skip jpeg
  212. }
  213. struct fps_result {
  214. float fps[FRAMESIZE_INVALID];
  215. uint32_t size[FRAMESIZE_INVALID];
  216. };
  217. struct fps_result results[3] = {0};
  218. for (; format_s <= format_e; format_s++) {
  219. for (size_t i = 0; i <= max_size; i++) {
  220. ESP_LOGI(TAG, "\n\n===> Testing format:%s resolution: %d x %d <===", get_cam_format_name(*format_s), resolution[i].width, resolution[i].height);
  221. ret = init_camera(xclk_freq, *format_s, i, 2, SIOD_GPIO_NUM, -1);
  222. vTaskDelay(100 / portTICK_RATE_MS);
  223. if (ESP_OK != ret) {
  224. ESP_LOGW(TAG, "Testing init failed :-(, skip this item");
  225. vTaskDelay(500 / portTICK_RATE_MS);
  226. continue;
  227. }
  228. camera_test_fps(pic_num, &results[format_s - all_format].fps[i], &results[format_s - all_format].size[i]);
  229. TEST_ESP_OK(esp_camera_deinit());
  230. }
  231. }
  232. printf("FPS Result\n");
  233. printf("resolution , JPEG fps, JPEG size, RGB565 fps, RGB565 size, YUV422 fps, YUV422 size \n");
  234. for (size_t i = 0; i <= max_size; i++) {
  235. printf("%4d x %4d , %5.2f, %6d, %5.2f, %7d, %5.2f, %7d \n",
  236. resolution[i].width, resolution[i].height,
  237. results[0].fps[i], results[0].size[i],
  238. results[1].fps[i], results[1].size[i],
  239. results[2].fps[i], results[2].size[i]);
  240. }
  241. printf("----------------------------------------------------------------------------------------\n");
  242. }
  243. TEST_CASE("Camera driver init, deinit test", "[camera]")
  244. {
  245. uint64_t t1 = esp_timer_get_time();
  246. TEST_ESP_OK(init_camera(20000000, PIXFORMAT_RGB565, FRAMESIZE_QVGA, 2, SIOD_GPIO_NUM, -1));
  247. uint64_t t2 = esp_timer_get_time();
  248. ESP_LOGI(TAG, "Camera init time %llu ms", (t2 - t1) / 1000);
  249. TEST_ESP_OK(esp_camera_deinit());
  250. }
  251. TEST_CASE("Camera driver take RGB565 picture test", "[camera]")
  252. {
  253. TEST_ESP_OK(init_camera(10000000, PIXFORMAT_RGB565, FRAMESIZE_QVGA, 2, SIOD_GPIO_NUM, -1));
  254. vTaskDelay(500 / portTICK_RATE_MS);
  255. ESP_LOGI(TAG, "Taking picture...");
  256. camera_fb_t *pic = esp_camera_fb_get();
  257. if (pic) {
  258. ESP_LOGI(TAG, "picture: %d x %d, size: %u", pic->width, pic->height, pic->len);
  259. printf_img_base64(pic);
  260. esp_camera_fb_return(pic);
  261. }
  262. TEST_ESP_OK(esp_camera_deinit());
  263. TEST_ASSERT_NOT_NULL(pic);
  264. }
  265. TEST_CASE("Camera driver take YUV422 picture test", "[camera]")
  266. {
  267. TEST_ESP_OK(init_camera(10000000, PIXFORMAT_YUV422, FRAMESIZE_QVGA, 2, SIOD_GPIO_NUM, -1));
  268. vTaskDelay(500 / portTICK_RATE_MS);
  269. ESP_LOGI(TAG, "Taking picture...");
  270. camera_fb_t *pic = esp_camera_fb_get();
  271. if (pic) {
  272. ESP_LOGI(TAG, "picture: %d x %d, size: %u", pic->width, pic->height, pic->len);
  273. printf_img_base64(pic);
  274. esp_camera_fb_return(pic);
  275. }
  276. TEST_ESP_OK(esp_camera_deinit());
  277. TEST_ASSERT_NOT_NULL(pic);
  278. }
  279. TEST_CASE("Camera driver take JPEG picture test", "[camera]")
  280. {
  281. TEST_ESP_OK(init_camera(20000000, PIXFORMAT_JPEG, FRAMESIZE_QVGA, 2, SIOD_GPIO_NUM, -1));
  282. vTaskDelay(500 / portTICK_RATE_MS);
  283. ESP_LOGI(TAG, "Taking picture...");
  284. camera_fb_t *pic = esp_camera_fb_get();
  285. if (pic) {
  286. ESP_LOGI(TAG, "picture: %d x %d, size: %u", pic->width, pic->height, pic->len);
  287. printf_img_base64(pic);
  288. esp_camera_fb_return(pic);
  289. }
  290. TEST_ESP_OK(esp_camera_deinit());
  291. TEST_ASSERT_NOT_NULL(pic);
  292. }
  293. TEST_CASE("Camera driver performance test", "[camera]")
  294. {
  295. camera_performance_test(20 * 1000000, 16);
  296. }
  297. static void print_rgb565_img(uint8_t *img, int width, int height)
  298. {
  299. uint16_t *p = (uint16_t *)img;
  300. const char temp2char[17] = "@MNHQ&#UJ*x7^i;.";
  301. for (size_t j = 0; j < height; j++) {
  302. for (size_t i = 0; i < width; i++) {
  303. uint32_t c = p[j * width + i];
  304. uint8_t r = c >> 11;
  305. uint8_t g = (c >> 6) & 0x1f;
  306. uint8_t b = c & 0x1f;
  307. c = (r + g + b) / 3;
  308. c >>= 1;
  309. printf("%c", temp2char[15 - c]);
  310. }
  311. printf("\n");
  312. }
  313. }
  314. static void print_rgb888_img(uint8_t *img, int width, int height)
  315. {
  316. uint8_t *p = (uint8_t *)img;
  317. const char temp2char[17] = "@MNHQ&#UJ*x7^i;.";
  318. for (size_t j = 0; j < height; j++) {
  319. for (size_t i = 0; i < width; i++) {
  320. uint8_t *c = p + 3 * (j * width + i);
  321. uint8_t r = *c++;
  322. uint8_t g = *c++;
  323. uint8_t b = *c;
  324. uint32_t v = (r + g + b) / 3;
  325. v >>= 4;
  326. printf("%c", temp2char[15 - v]);
  327. }
  328. printf("\n");
  329. }
  330. }
  331. static void tjpgd_decode_rgb565(uint8_t *mjpegbuffer, uint32_t size, uint8_t *outbuffer)
  332. {
  333. jpg2rgb565(mjpegbuffer, size, outbuffer, JPG_SCALE_NONE);
  334. }
  335. static void tjpgd_decode_rgb888(uint8_t *mjpegbuffer, uint32_t size, uint8_t *outbuffer)
  336. {
  337. fmt2rgb888(mjpegbuffer, size, PIXFORMAT_JPEG, outbuffer);
  338. }
  339. typedef enum {
  340. DECODE_RGB565,
  341. DECODE_RGB888,
  342. } decode_type_t;
  343. static const decode_func_t g_decode_func[2][2] = {
  344. {tjpgd_decode_rgb565,},
  345. {tjpgd_decode_rgb888,},
  346. };
  347. static float jpg_decode_test(uint8_t decoder_index, decode_type_t type, const uint8_t *jpg, uint32_t length, uint32_t img_w, uint32_t img_h, uint32_t times)
  348. {
  349. uint8_t *jpg_buf = malloc(length);
  350. if (NULL == jpg_buf) {
  351. ESP_LOGE(TAG, "malloc for jpg buffer failed");
  352. return 0;
  353. }
  354. memcpy(jpg_buf, jpg, length);
  355. uint8_t *rgb_buf = heap_caps_malloc(img_w * img_h * 3, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
  356. if (NULL == rgb_buf) {
  357. free(jpg_buf);
  358. ESP_LOGE(TAG, "malloc for rgb buffer failed");
  359. return 0;
  360. }
  361. decode_func_t decode = g_decode_func[type][decoder_index];
  362. decode(jpg_buf, length, rgb_buf);
  363. if (DECODE_RGB565 == type) {
  364. ESP_LOGI(TAG, "jpeg decode to rgb565");
  365. print_rgb565_img(rgb_buf, img_w, img_h);
  366. } else {
  367. ESP_LOGI(TAG, "jpeg decode to rgb888");
  368. print_rgb888_img(rgb_buf, img_w, img_h);
  369. }
  370. uint64_t t_decode[times];
  371. for (size_t i = 0; i < times; i++) {
  372. uint64_t t1 = esp_timer_get_time();
  373. decode(jpg_buf, length, rgb_buf);
  374. t_decode[i] = esp_timer_get_time() - t1;
  375. }
  376. printf("resolution , t \n");
  377. uint64_t t_total = 0;
  378. for (size_t i = 0; i < times; i++) {
  379. t_total += t_decode[i];
  380. float t = t_decode[i] / 1000.0f;
  381. printf("%4d x %4d , %5.2f ms \n", img_w, img_h, t);
  382. }
  383. float fps = times / (t_total / 1000000.0f);
  384. printf("Decode FPS Result\n");
  385. printf("resolution , fps \n");
  386. printf("%4d x %4d , %5.2f \n", img_w, img_h, fps);
  387. free(jpg_buf);
  388. heap_caps_free(rgb_buf);
  389. return fps;
  390. }
  391. static void img_jpeg_decode_test(uint16_t pic_index, uint16_t lib_index)
  392. {
  393. extern const uint8_t img1_start[] asm("_binary_testimg_jpeg_start");
  394. extern const uint8_t img1_end[] asm("_binary_testimg_jpeg_end");
  395. extern const uint8_t img2_start[] asm("_binary_test_inside_jpeg_start");
  396. extern const uint8_t img2_end[] asm("_binary_test_inside_jpeg_end");
  397. extern const uint8_t img3_start[] asm("_binary_test_outside_jpeg_start");
  398. extern const uint8_t img3_end[] asm("_binary_test_outside_jpeg_end");
  399. struct img_t {
  400. const uint8_t *buf;
  401. uint32_t length;
  402. uint16_t w, h;
  403. };
  404. struct img_t imgs[3] = {
  405. {
  406. .buf = img1_start,
  407. .length = img1_end - img1_start,
  408. .w = 227,
  409. .h = 149,
  410. },
  411. {
  412. .buf = img2_start,
  413. .length = img2_end - img2_start,
  414. .w = 320,
  415. .h = 240,
  416. },
  417. {
  418. .buf = img3_start,
  419. .length = img3_end - img3_start,
  420. .w = 480,
  421. .h = 320,
  422. },
  423. };
  424. ESP_LOGI(TAG, "pic_index:%d", pic_index);
  425. ESP_LOGI(TAG, "lib_index:%d", lib_index);
  426. jpg_decode_test(lib_index, DECODE_RGB565, imgs[pic_index].buf, imgs[pic_index].length, imgs[pic_index].w, imgs[pic_index].h, 16);
  427. }
  428. /**
  429. * @brief i2c master initialization
  430. */
  431. static esp_err_t i2c_master_init(int i2c_port)
  432. {
  433. i2c_config_t conf = {
  434. .mode = I2C_MODE_MASTER,
  435. .sda_io_num = I2C_MASTER_SDA_IO,
  436. .scl_io_num = I2C_MASTER_SCL_IO,
  437. .sda_pullup_en = GPIO_PULLUP_ENABLE,
  438. .scl_pullup_en = GPIO_PULLUP_ENABLE,
  439. .master.clk_speed = I2C_MASTER_FREQ_HZ,
  440. };
  441. i2c_param_config(i2c_port, &conf);
  442. return i2c_driver_install(i2c_port, conf.mode, 0, 0, 0);
  443. }
  444. TEST_CASE("Conversions image 227x149 jpeg decode test", "[camera]")
  445. {
  446. img_jpeg_decode_test(0, 0);
  447. }
  448. TEST_CASE("Conversions image 320x240 jpeg decode test", "[camera]")
  449. {
  450. img_jpeg_decode_test(1, 0);
  451. }
  452. TEST_CASE("Conversions image 480x320 jpeg decode test", "[camera]")
  453. {
  454. img_jpeg_decode_test(2, 0);
  455. }
  456. TEST_CASE("Camera driver uses an i2c port initialized by other devices test", "[camera]")
  457. {
  458. TEST_ESP_OK(i2c_master_init(I2C_MASTER_NUM));
  459. TEST_ESP_OK(init_camera(20000000, PIXFORMAT_JPEG, FRAMESIZE_QVGA, 2, -1, I2C_MASTER_NUM));
  460. vTaskDelay(500 / portTICK_RATE_MS);
  461. TEST_ESP_OK(esp_camera_deinit());
  462. TEST_ESP_OK(i2c_driver_delete(I2C_MASTER_NUM));
  463. }