@TOC

1. ESP32-Camera简介

最近因为接触了ESP32摄像头相关的资料和信息,稍微简单整理下,希望对该方案有兴趣的朋友可以有所帮助。

1.1 资料&信息

1.2 ESP-EYE摄像头

ESP32-EYE

1.3 其他摄像头方案

  • AITHINKER Camera
  • M5Stack Camera
  • 其他方案很多,这里找几个相对比较容易买到,且性价比高的(当然这个肯定会有一些缩水,比如PSRAM)

AITHINKER Camera

M5Stack Camera

2. ESP32-Camera验证需求

验证需求关键点:

  1. 基础功能验证
  2. 基础性能验证
  3. 性价比考虑(买得到的绝不自己做,速度优先原则)
  4. 考虑方案推荐摄像头和高清500w摄像头

3. ESP32-Camera验证选型

3.1 硬件选型

  1. 【高性价比】AITHINKER Camera模块
  2. 【高清500w】OV5640(5M)
  3. 【市场方案常用】OV2640(2M)

注:市面上买到的模块和安可信的模块的主要差异是在外部SRAM这块。

规格如下:

  • ESP-32S模组
  • 2MB 外部PSRAM
  • 4MB SPI Flash
  • SD Card
  • 摄像头:OV5640/OV2640
  • 配套底板(支持自动烧录,否则需要跳线支持)

安可信验证板子安可信引脚图

串口板烧录安可信板子

3.2 软件选型

  1. Github: ESP32-Camera
  2. Github: M5Stack-Camera

4. 对比测试

4.1 【M5Stack-Camera】视频验证

ESP32 Camera (OV5640 vs OV2640)

4.2 【M5Stack-Camera】测试数据

  • xclk_freq_hz: 10000000 Hz
  • pixel_format:PIXFORMAT_JPEG
  • jpeg_quality:15
  • frame_size: FRAMESIZE_SVGA(800x600)
  • fb_count:2
commit 7be1a13123ef8bb35143eb0b71542b64a3c6e4fb (HEAD -> master, origin/master, origin/HEAD)
Author: Tinyu <Tinyu.Zhao@gmail.com>
Date:   Tue Jan 25 16:10:57 2022 +0800

    Update main.c

4.2.1 OV5640 800x600

第一次:

  • 每行日志打印,对应50帧数据最后一帧的数据统计情况
  • 当WEB退出后,对所有帧数据进行统计给出小结
  • 早上8:00室内

测试结果:15 x 50 = 750帧数据统计情况:平均10帧/秒,最快26帧/秒

I (3695) camera: got ip:192.168.78.110
I (18078) camera: MJPG: 11KB get-send-total(045ms-050ms-096ms)  10.4 fps
I (22569) camera: MJPG: 11KB get-send-total(060ms-036ms-096ms)  10.4 fps
I (29032) camera: MJPG: 25KB get-send-total(000ms-274ms-275ms)  3.6 fps
I (37247) camera: MJPG: 24KB get-send-total(049ms-029ms-079ms)  12.7 fps
I (52834) camera: MJPG: 24KB get-send-total(000ms-4411ms-4411ms)  0.2 fps
I (53383) camera: MJPG: 22KB get-send-total(025ms-039ms-065ms)  15.4 fps
I (58067) camera: MJPG: 21KB get-send-total(001ms-038ms-040ms)  25.0 fps
I (62771) camera: MJPG: 17KB get-send-total(066ms-058ms-125ms)  8.0 fps
I (67243) camera: MJPG: 20KB get-send-total(069ms-025ms-094ms)  10.6 fps
I (71844) camera: MJPG: 21KB get-send-total(061ms-031ms-093ms)  10.8 fps
I (76639) camera: MJPG: 16KB get-send-total(031ms-052ms-083ms)  12.0 fps
I (77186) camera: MJPG: 14KB get-send-total(055ms-058ms-114ms)  8.8 fps
I (81679) camera: MJPG: 20KB get-send-total(056ms-047ms-103ms)  9.7 fps
I (86292) camera: MJPG: 23KB get-send-total(018ms-065ms-084ms)  11.9 fps
I (90787) camera: MJPG: 21KB get-send-total(033ms-055ms-089ms)  11.2 fps
I (92234) camera: ----------
I (92234) camera: MJPG: 11 - 28KB
I (92237) camera:  GET: 139 - 001ms avg 061ms
I (92242) camera: SEND: 368 - 011ms avg 034ms
I (92247) camera:  SUM: 401 - 038ms avg 096ms
I (92252) camera:  FPS: 2.5 - 26.3 avg 10.4

第二次:

  • 每行日志打印,对应20帧数据最后一帧的数据统计情况
  • 当WEB退出后,对所有帧数据进行统计给出小结
  • 中午14:20室内

测试结果:494帧有效数据;统计情况:平均5帧/秒,最快29帧/秒

I (3701) camera: got ip:192.168.78.110
I (9281) camera: MJPG: 14KB get-send-total(132ms-256ms-389ms)  2.6 fps
I (12666) camera: MJPG: 21KB get-send-total(136ms-037ms-174ms)  5.7 fps
I (16102) camera: MJPG: 21KB get-send-total(147ms-050ms-198ms)  5.1 fps
I (19494) camera: MJPG: 16KB get-send-total(139ms-019ms-158ms)  6.3 fps
I (22735) camera: MJPG: 15KB get-send-total(073ms-016ms-090ms)  11.1 fps
I (26252) camera: MJPG: 16KB get-send-total(024ms-020ms-044ms)  22.7 fps
I (29667) camera: MJPG: 13KB get-send-total(026ms-012ms-038ms)  26.3 fps
I (33275) camera: MJPG: 19KB get-send-total(145ms-106ms-251ms)  4.0 fps
I (36827) camera: MJPG: 19KB get-send-total(149ms-055ms-204ms)  4.9 fps
I (40235) camera: MJPG: 16KB get-send-total(056ms-039ms-095ms)  10.5 fps
I (43733) camera: MJPG: 19KB get-send-total(096ms-023ms-119ms)  8.4 fps
I (47341) camera: MJPG: 14KB get-send-total(153ms-028ms-182ms)  5.5 fps
I (51064) camera: MJPG: 18KB get-send-total(089ms-057ms-147ms)  6.8 fps
I (54732) camera: MJPG: 22KB get-send-total(101ms-031ms-132ms)  7.6 fps
I (58259) camera: MJPG: 20KB get-send-total(124ms-045ms-169ms)  5.9 fps
I (61742) camera: MJPG: 16KB get-send-total(147ms-014ms-161ms)  6.2 fps
I (65108) camera: MJPG: 23KB get-send-total(102ms-047ms-149ms)  6.7 fps
I (68322) camera: MJPG: 19KB get-send-total(115ms-018ms-134ms)  7.5 fps
I (71923) camera: MJPG: 16KB get-send-total(161ms-015ms-176ms)  5.7 fps
I (75463) camera: MJPG: 20KB get-send-total(102ms-041ms-144ms)  6.9 fps
I (78862) camera: MJPG: 14KB get-send-total(144ms-017ms-162ms)  6.2 fps
I (82313) camera: MJPG: 20KB get-send-total(149ms-045ms-194ms)  5.2 fps
I (85918) camera: MJPG: 22KB get-send-total(145ms-044ms-189ms)  5.3 fps
I (89058) camera: MJPG: 18KB get-send-total(138ms-033ms-171ms)  5.8 fps
W (92387) httpd_txrx: httpd_sock_err: error in send : 104
I (92388) camera: ----------GRANULARITY:20
I (92388) camera: total:500, normal tests:494, abnormal skiped:5
I (92394) camera: MJPG: 10 - 35KB
I (92398) camera:  GET: 343 - 002ms avg 139ms
I (92403) camera: SEND: 256 - 012ms avg 052ms
I (92408) camera:  SUM: 421 - 034ms avg 192ms
I (92413) camera:  FPS: 2.4 - 29.4 avg 5.2

4.2.2 OV2640 800x600

第一次:

  • 每行日志打印,对应50帧数据最后一帧的数据统计情况
  • 当WEB退出后,对所有帧数据进行统计给出小结
  • 早上8:00室内

测试结果:7 x 50 = 350帧数据统计情况:平均14帧/秒,最快34帧/秒

I (3152) camera: got ip:192.168.78.118
I (43752) camera: MJPG: 31KB get-send-total(000ms-059ms-059ms)  16.9 fps
I (47792) camera: MJPG: 21KB get-send-total(038ms-028ms-067ms)  14.9 fps
I (51780) camera: MJPG: 21KB get-send-total(032ms-018ms-050ms)  20.0 fps
I (55874) camera: MJPG: 22KB get-send-total(065ms-033ms-099ms)  10.1 fps
I (59991) camera: MJPG: 17KB get-send-total(037ms-072ms-110ms)  9.1 fps
I (60440) camera: MJPG: 18KB get-send-total(049ms-042ms-092ms)  10.9 fps
I (64447) camera: MJPG: 21KB get-send-total(053ms-048ms-102ms)  9.8 fps
I (65223) camera: ----------
I (65223) camera: MJPG: 11 - 32KB
I (65225) camera:  GET: 106 - 003ms avg 023ms
I (65230) camera: SEND: 247 - 013ms avg 046ms
I (65235) camera:  SUM: 257 - 029ms avg 070ms
I (65240) camera:  FPS: 3.9 - 34.5 avg 14.3

第二次:

  • 每行日志打印,对应20帧数据最后一帧的数据统计情况
  • 当WEB退出后,对所有帧数据进行统计给出小结
  • 中午14:20室内

测试结果:593帧有效数据;统计情况:平均13帧/秒,最快41帧/秒

I (3150) camera: got ip:192.168.78.118
I (15313) camera: MJPG: 12KB get-send-total(038ms-018ms-056ms)  17.9 fps
I (16931) camera: MJPG: 12KB get-send-total(022ms-036ms-058ms)  17.2 fps
I (18557) camera: MJPG: 28KB get-send-total(000ms-061ms-061ms)  16.4 fps
I (20320) camera: MJPG: 18KB get-send-total(034ms-066ms-101ms)  9.9 fps
I (21995) camera: MJPG: 23KB get-send-total(040ms-062ms-102ms)  9.8 fps
I (23738) camera: MJPG: 22KB get-send-total(045ms-045ms-091ms)  11.0 fps
I (25407) camera: MJPG: 22KB get-send-total(043ms-035ms-078ms)  12.8 fps
I (27056) camera: MJPG: 24KB get-send-total(008ms-085ms-093ms)  10.8 fps
I (28779) camera: MJPG: 19KB get-send-total(050ms-048ms-099ms)  10.1 fps
I (30525) camera: MJPG: 20KB get-send-total(056ms-035ms-092ms)  10.9 fps
I (32114) camera: MJPG: 21KB get-send-total(050ms-025ms-075ms)  13.3 fps
I (33840) camera: MJPG: 21KB get-send-total(032ms-072ms-104ms)  9.6 fps
I (35399) camera: MJPG: 21KB get-send-total(045ms-032ms-077ms)  13.0 fps
I (37123) camera: MJPG: 22KB get-send-total(000ms-075ms-075ms)  13.3 fps
I (38879) camera: MJPG: 23KB get-send-total(036ms-073ms-109ms)  9.2 fps
I (40450) camera: MJPG: 17KB get-send-total(039ms-045ms-084ms)  11.9 fps
I (42108) camera: MJPG: 15KB get-send-total(055ms-023ms-078ms)  12.8 fps
I (43715) camera: MJPG: 20KB get-send-total(009ms-031ms-041ms)  24.4 fps
I (45313) camera: MJPG: 20KB get-send-total(035ms-029ms-065ms)  15.4 fps
I (46921) camera: MJPG: 16KB get-send-total(039ms-038ms-077ms)  13.0 fps
I (48585) camera: MJPG: 17KB get-send-total(036ms-022ms-059ms)  16.9 fps
I (50324) camera: MJPG: 20KB get-send-total(043ms-082ms-126ms)  7.9 fps
I (51953) camera: MJPG: 17KB get-send-total(054ms-030ms-084ms)  11.9 fps
I (53574) camera: MJPG: 13KB get-send-total(047ms-054ms-101ms)  9.9 fps
I (55215) camera: MJPG: 11KB get-send-total(057ms-096ms-154ms)  6.5 fps
I (56939) camera: MJPG: 16KB get-send-total(025ms-060ms-086ms)  11.6 fps
I (58582) camera: MJPG: 16KB get-send-total(042ms-023ms-066ms)  15.2 fps
I (60196) camera: MJPG: 22KB get-send-total(041ms-038ms-080ms)  12.5 fps
I (61870) camera: MJPG: 13KB get-send-total(051ms-033ms-085ms)  11.8 fps
I (63468) camera: MJPG: 13KB get-send-total(046ms-032ms-079ms)  12.7 fps
W (64747) httpd_txrx: httpd_sock_err: error in send : 104
I (64748) camera: ----------GRANULARITY:20
I (64748) camera: total:616, normal tests:593, abnormal skiped:22
I (64754) camera: MJPG: 10 - 28KB
I (64758) camera:  GET: 123 - 001ms avg 043ms
I (64763) camera: SEND: 129 - 011ms avg 029ms
I (64768) camera:  SUM: 173 - 024ms avg 073ms
I (64773) camera:  FPS: 5.8 - 41.7 avg 13.7

4.3【ESP32-Camera】 测试数据

  • xclk_freq_hz: 10000000 Hz
  • pixel_format:PIXFORMAT_JPEG
  • jpeg_quality:15
  • frame_size: FRAMESIZE_SVGA(800x600)
  • fb_count:2
commit 402b811b835cd348343b567a97fdf984c9d16fb9 (HEAD -> master, origin/master, origin/HEAD)
Author: XDanielPaul <47739921+XDanielPaul@users.noreply.github.com>
Date:   Mon Dec 12 18:53:42 2022 +0100

    Added badge with version to README (#487)

    Co-authored-by: Daniel Paul <daniel.paul@espressif.com>

4.3.1 OV5640 800x600

100帧,31帧数据异常(严重超时),69帧统计数据显示,平均4帧/秒,最快5.8帧/秒。

I (1810) cam_hal: cam config ok
D (1813) camera: Setting frame size to 800x600
D (1831) ov5640: Set Image Options: Compression: 1, Binning: 1, V-Flip: 0, H-Mirror: 0, Reg-4514: 0xaa
I (1832) ov5640: Set PLL: bypass: 0, multiplier: 180, sys_div: 4, pre_div: 2, root_2x: 0, pclk_root_div: 2, pclk_manual: 1, pclk_div: 4
I (1841) ov5640: Calculated XVCLK: 10000000 Hz, REFIN: 5000000 Hz, VCO: 900000000 Hz, PLL_CLK: 90000000 Hz, SYSCLK: 22500000 Hz, PCLK: 5625000 Hz
D (1858) ov5640: Set framesize to: 800x600
D (1861) ov5640: Set pixformat to: 4
D (1862) ov5640: Set quality to: 15
W (2048) example:take_picture: Taking picture...1, abnormal, skiped
I (2049) example:take_picture: MJPG: 13KB get-total(168462ms-168468ms)  0.0 fps
W (7184) example:take_picture: Taking picture...4, abnormal, skiped
I (7184) example:take_picture: MJPG: 20KB get-total(133488ms-133489ms)  0.0 fps
W (12319) example:take_picture: Taking picture...7, abnormal, skiped
I (12319) example:take_picture: MJPG: 18KB get-total(132265ms-132265ms)  0.0 fps
W (17454) example:take_picture: Taking picture...10, abnormal, skiped
I (17454) example:take_picture: MJPG: 18KB get-total(132816ms-132816ms)  0.0 fps
W (22589) example:take_picture: Taking picture...13, abnormal, skiped
I (22589) example:take_picture: MJPG: 17KB get-total(131690ms-131691ms)  0.0 fps
W (27724) example:take_picture: Taking picture...16, abnormal, skiped
I (27725) example:take_picture: MJPG: 17KB get-total(132919ms-132919ms)  0.0 fps
W (32859) example:take_picture: Taking picture...19, abnormal, skiped
I (32860) example:take_picture: MJPG: 16KB get-total(131893ms-131894ms)  0.0 fps
I (37862) example:take_picture: Taking picture...20
I (37862) example:take_picture: MJPG: 16KB get-total(266ms-280ms)  3.6 fps
W (43039) example:take_picture: Taking picture...23, abnormal, skiped
I (43040) example:take_picture: MJPG: 16KB get-total(176504ms-176506ms)  0.0 fps
W (48175) example:take_picture: Taking picture...26, abnormal, skiped
I (48175) example:take_picture: MJPG: 16KB get-total(132652ms-132654ms)  0.0 fps
W (53310) example:take_picture: Taking picture...29, abnormal, skiped
I (53310) example:take_picture: MJPG: 16KB get-total(132803ms-132805ms)  0.0 fps
W (58445) example:take_picture: Taking picture...32, abnormal, skiped
I (58446) example:take_picture: MJPG: 16KB get-total(132952ms-132954ms)  0.0 fps
W (63580) example:take_picture: Taking picture...35, abnormal, skiped
I (63581) example:take_picture: MJPG: 16KB get-total(132127ms-132129ms)  0.0 fps
W (68715) example:take_picture: Taking picture...38, abnormal, skiped
I (68716) example:take_picture: MJPG: 16KB get-total(132290ms-132292ms)  0.0 fps
I (73718) example:take_picture: Taking picture...40
I (73719) example:take_picture: MJPG: 16KB get-total(210ms-212ms)  4.7 fps
W (78896) example:take_picture: Taking picture...43, abnormal, skiped
I (78896) example:take_picture: MJPG: 16KB get-total(176420ms-176421ms)  0.0 fps
W (84031) example:take_picture: Taking picture...46, abnormal, skiped
I (84031) example:take_picture: MJPG: 16KB get-total(132581ms-132582ms)  0.0 fps
W (89166) example:take_picture: Taking picture...49, abnormal, skiped
I (89166) example:take_picture: MJPG: 16KB get-total(132753ms-132754ms)  0.0 fps
W (94301) example:take_picture: Taking picture...52, abnormal, skiped
I (94302) example:take_picture: MJPG: 16KB get-total(132918ms-132919ms)  0.0 fps
W (99436) example:take_picture: Taking picture...55, abnormal, skiped
I (99437) example:take_picture: MJPG: 16KB get-total(132073ms-132074ms)  0.0 fps
W (104571) example:take_picture: Taking picture...58, abnormal, skiped
I (104572) example:take_picture: MJPG: 16KB get-total(132253ms-132254ms)  0.0 fps
I (109574) example:take_picture: Taking picture...60
I (109575) example:take_picture: MJPG: 16KB get-total(211ms-212ms)  4.7 fps
W (114752) example:take_picture: Taking picture...63, abnormal, skiped
I (114752) example:take_picture: MJPG: 16KB get-total(176614ms-176616ms)  0.0 fps
W (119887) example:take_picture: Taking picture...66, abnormal, skiped
I (119887) example:take_picture: MJPG: 16KB get-total(132799ms-132801ms)  0.0 fps
W (125022) example:take_picture: Taking picture...69, abnormal, skiped
I (125023) example:take_picture: MJPG: 16KB get-total(131949ms-131951ms)  0.0 fps
W (130157) example:take_picture: Taking picture...72, abnormal, skiped
I (130158) example:take_picture: MJPG: 16KB get-total(132112ms-132114ms)  0.0 fps
W (135292) example:take_picture: Taking picture...75, abnormal, skiped
I (135293) example:take_picture: MJPG: 16KB get-total(132286ms-132288ms)  0.0 fps
W (140428) example:take_picture: Taking picture...78, abnormal, skiped
I (140428) example:take_picture: MJPG: 16KB get-total(132458ms-132460ms)  0.0 fps
I (145430) example:take_picture: Taking picture...80
I (145431) example:take_picture: MJPG: 16KB get-total(214ms-216ms)  4.6 fps
W (150608) example:take_picture: Taking picture...83, abnormal, skiped
I (150608) example:take_picture: MJPG: 16KB get-total(176577ms-176577ms)  0.0 fps
W (155743) example:take_picture: Taking picture...86, abnormal, skiped
I (155743) example:take_picture: MJPG: 16KB get-total(132733ms-132734ms)  0.0 fps
W (160878) example:take_picture: Taking picture...89, abnormal, skiped
I (160879) example:take_picture: MJPG: 16KB get-total(131919ms-131920ms)  0.0 fps
W (166013) example:take_picture: Taking picture...92, abnormal, skiped
I (166014) example:take_picture: MJPG: 16KB get-total(132077ms-132077ms)  0.0 fps
W (171148) example:take_picture: Taking picture...95, abnormal, skiped
I (171149) example:take_picture: MJPG: 16KB get-total(132256ms-132257ms)  0.0 fps
W (176284) example:take_picture: Taking picture...98, abnormal, skiped
I (176284) example:take_picture: MJPG: 16KB get-total(132430ms-132431ms)  0.0 fps
I (181286) example:take_picture: Taking picture...100
I (181287) example:take_picture: MJPG: 16KB get-total(209ms-210ms)  4.8 fps
I (186287) example:take_picture: ----------69 tests, 31 abnormal skiped
I (186287) example:take_picture: MJPG: 13 - 20KB
I (186287) example:take_picture:  GET: 447 - 170ms avg 245ms
I (186292) example:take_picture:  SUM: 457 - 171ms avg 250ms
I (186297) example:take_picture:  FPS: 2.2 - 5.8 avg 4.0

4.3.2 OV2640 800x600

100帧,31帧数据异常(严重超时),69帧统计数据显示,平均14帧/秒,最快71帧/秒。

I (1191) cam_hal: cam config ok
D (1194) camera: Setting frame size to 800x600
I (1198) ov2640: Set PLL: clk_2x: 0, clk_div: 0, pclk_auto: 0, pclk_div: 8
W (1484) example:take_picture: Taking picture...1, abnormal, skiped
I (1484) example:take_picture: MJPG: 15KB get-total(201329ms-201335ms)  0.0 fps
W (6602) example:take_picture: Taking picture...4, abnormal, skiped
I (6602) example:take_picture: MJPG: 12KB get-total(116235ms-116236ms)  0.0 fps
W (11720) example:take_picture: Taking picture...7, abnormal, skiped
I (11720) example:take_picture: MJPG: 12KB get-total(116156ms-116157ms)  0.0 fps
W (16838) example:take_picture: Taking picture...10, abnormal, skiped
I (16838) example:take_picture: MJPG: 12KB get-total(116079ms-116080ms)  0.0 fps
W (21956) example:take_picture: Taking picture...13, abnormal, skiped
I (21956) example:take_picture: MJPG: 12KB get-total(116037ms-116038ms)  0.0 fps
W (27074) example:take_picture: Taking picture...16, abnormal, skiped
I (27074) example:take_picture: MJPG: 12KB get-total(115978ms-115979ms)  0.0 fps
W (32192) example:take_picture: Taking picture...19, abnormal, skiped
I (32192) example:take_picture: MJPG: 12KB get-total(115938ms-115939ms)  0.0 fps
I (37194) example:take_picture: Taking picture...20
I (37194) example:take_picture: MJPG: 12KB get-total(092ms-093ms)  10.8 fps
W (42348) example:take_picture: Taking picture...23, abnormal, skiped
I (42348) example:take_picture: MJPG: 12KB get-total(152926ms-152927ms)  0.0 fps
W (47466) example:take_picture: Taking picture...26, abnormal, skiped
I (47466) example:take_picture: MJPG: 12KB get-total(115844ms-115845ms)  0.0 fps
W (52584) example:take_picture: Taking picture...29, abnormal, skiped
I (52584) example:take_picture: MJPG: 12KB get-total(115793ms-115794ms)  0.0 fps
W (57701) example:take_picture: Taking picture...32, abnormal, skiped
I (57702) example:take_picture: MJPG: 12KB get-total(115743ms-115744ms)  0.0 fps
W (62819) example:take_picture: Taking picture...35, abnormal, skiped
I (62820) example:take_picture: MJPG: 12KB get-total(115699ms-115700ms)  0.0 fps
W (67937) example:take_picture: Taking picture...38, abnormal, skiped
I (67938) example:take_picture: MJPG: 12KB get-total(115645ms-115646ms)  0.0 fps
I (72940) example:take_picture: Taking picture...40
I (72940) example:take_picture: MJPG: 12KB get-total(060ms-061ms)  16.4 fps
W (78093) example:take_picture: Taking picture...43, abnormal, skiped
I (78094) example:take_picture: MJPG: 12KB get-total(152580ms-152581ms)  0.0 fps
W (83211) example:take_picture: Taking picture...46, abnormal, skiped
I (83212) example:take_picture: MJPG: 12KB get-total(115513ms-115514ms)  0.0 fps
W (88329) example:take_picture: Taking picture...49, abnormal, skiped
I (88330) example:take_picture: MJPG: 12KB get-total(115470ms-115471ms)  0.0 fps
W (93447) example:take_picture: Taking picture...52, abnormal, skiped
I (93448) example:take_picture: MJPG: 12KB get-total(115416ms-115417ms)  0.0 fps
W (98565) example:take_picture: Taking picture...55, abnormal, skiped
I (98566) example:take_picture: MJPG: 12KB get-total(115375ms-115376ms)  0.0 fps
W (103683) example:take_picture: Taking picture...58, abnormal, skiped
I (103683) example:take_picture: MJPG: 12KB get-total(115323ms-115323ms)  0.0 fps
I (108686) example:take_picture: Taking picture...60
I (108686) example:take_picture: MJPG: 12KB get-total(063ms-064ms)  15.6 fps
W (113839) example:take_picture: Taking picture...63, abnormal, skiped
I (113839) example:take_picture: MJPG: 12KB get-total(152286ms-152287ms)  0.0 fps
W (118957) example:take_picture: Taking picture...66, abnormal, skiped
I (118957) example:take_picture: MJPG: 12KB get-total(115232ms-115233ms)  0.0 fps
W (124075) example:take_picture: Taking picture...69, abnormal, skiped
I (124075) example:take_picture: MJPG: 12KB get-total(115185ms-115186ms)  0.0 fps
W (129193) example:take_picture: Taking picture...72, abnormal, skiped
I (129193) example:take_picture: MJPG: 12KB get-total(115137ms-115138ms)  0.0 fps
W (134311) example:take_picture: Taking picture...75, abnormal, skiped
I (134311) example:take_picture: MJPG: 12KB get-total(115089ms-115090ms)  0.0 fps
W (139429) example:take_picture: Taking picture...78, abnormal, skiped
I (139429) example:take_picture: MJPG: 12KB get-total(115035ms-115036ms)  0.0 fps
I (144431) example:take_picture: Taking picture...80
I (144431) example:take_picture: MJPG: 12KB get-total(064ms-065ms)  15.4 fps
W (149585) example:take_picture: Taking picture...83, abnormal, skiped
I (149585) example:take_picture: MJPG: 12KB get-total(152965ms-152966ms)  0.0 fps
W (154703) example:take_picture: Taking picture...86, abnormal, skiped
I (154703) example:take_picture: MJPG: 12KB get-total(115922ms-115922ms)  0.0 fps
W (159821) example:take_picture: Taking picture...89, abnormal, skiped
I (159821) example:take_picture: MJPG: 12KB get-total(115870ms-115870ms)  0.0 fps
W (164939) example:take_picture: Taking picture...92, abnormal, skiped
I (164939) example:take_picture: MJPG: 12KB get-total(115814ms-115815ms)  0.0 fps
W (170056) example:take_picture: Taking picture...95, abnormal, skiped
I (170057) example:take_picture: MJPG: 12KB get-total(115769ms-115770ms)  0.0 fps
W (175174) example:take_picture: Taking picture...98, abnormal, skiped
I (175175) example:take_picture: MJPG: 12KB get-total(115714ms-115715ms)  0.0 fps
I (180177) example:take_picture: Taking picture...100
I (180177) example:take_picture: MJPG: 12KB get-total(060ms-060ms)  16.7 fps
I (185178) example:take_picture: ----------69 tests, 31 abnormal skiped
I (185178) example:take_picture: MJPG: 12 - 14KB
I (185178) example:take_picture:  GET: 092 - 013ms avg 069ms
I (185183) example:take_picture:  SUM: 093 - 014ms avg 069ms
I (185188) example:take_picture:  FPS: 10.8 - 71.4 avg 14.5

5. 总结&展望

5.1 测试总结

  1. 同样配置(800x600的分辨率)情况下,OV2640会比OV5640流畅(帧速率更高);
  2. OV5640在暗场环境存在闪烁问题(怀疑驱动可能存在问题),而OV2640则无此问题;
  3. 基于AITHINKER Camera硬件条件下,摄像头帧速率不稳定(10倍率的范围波动);
  4. 基于AITHINKER Camera硬件条件下,摄像头帧速率平均速率都比较低(低于25FPS);
  5. Github: ESP32-CameraM5Stack-Camera库上代码均存在诸多问题;
  • a) 驱动稳定性和可用性
  • b) 代码适配性(库上代码均存在问题,无法直接使用,存在明显BUG)
  • c) 代码健壮性
  1. 场景不同(照度等)会影响到FPS速率,因此上述测试数据是一个整体趋势性数据,因测试场景不同存在一定差异性

注1:上述Github代码是截止2023年01月18日(发稿日)最新代码,文中已经给出相应branch和commit id。以上情况总结是基于测试视频和对比数据分析给出。

注2:鉴于这里FPS速率及稳定性问题较为突出,因此这里并没有进行视频延迟进行测试。

5.2 性能展望

  1. WiFi视频角度:可以做简单固定场景非专业类监控,且交易受到干扰影响(2.4G频段);
  2. 若能考虑使用WiFi broadcast方式可能可以较好的降低传输延迟(30 ~ 50ms);
  3. 优化驱动,降低每帧数据采集耗时,加强FPS帧速率(确保流畅度);
  4. 考虑SD卡录高清场景需求,提升录像的清晰度;

注:性价比始终是个双刃剑,有所得就有所失,产品需求和解决方案需要做权衡!

6. 补充测试

最近有人在问OV5640的ESP32摄像头,其书面表述如下所示:

冷启动,最快速度拍照,你需要帮我们完成简单的拍照功能,验证照片质量。

  1. 启动到出图的时间,快速启动抓拍,尽量做到500ms以内
  2. 抓拍出图的质量(提示:曝光时间要设置好)

我们要学会技术短句去描述问题,分析问题,解决问题:

技术短句的理解

  1. 冷启动,第一次拍照 //注意:最快速度拍照,相信应该是指第一次,这里有个非常严肃的问题是【冷启动定义】
  2. 第一次拍照质量 //注意:质量的问题取决很多因素
  3. 启动到出图时间 < 500ms

好! 我们可以看下他这里其实有非常多的不确定性,从技术角度要全面给他答案那就是长篇大论了。因此从现实角度,不要提这种发散的需求,一定要收敛。

如果真的要去给他解决问题,那么一定要深入以下问题(这里不展开)

  1. 这个规格的背后真实需求是什么?
  2. 这个真实需求同类产品的验证测试是如何进行的?

我们不去深究这个技术需求的问题,但是我们在讨论这件事情的时候,重新对之前的验证代码做了回顾和测试。

重点
之前关于ESP32-Camera的测试数据可能有点问题,请大家忽略4.3章节的内容。

6.1 OV2640 ESP32-Camera 1280 x 760

rst:ets Jul 29 2019SET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:6120
load:0x40078000,len:15456
load:0x40080400,len:3840
0x40080400: _init at ??:?

entry 0x4008064c
I (27) boot: ESP-IDF v5.0-rc1-2-g7f4bcc3695 2nd stage bootloader
I (27) boot: compile time 08:05:25
I (28) boot: chip revision: v3.0
I (29) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (35) boot.esp32: SPI Speed      : 80MHz
I (39) boot.esp32: SPI Mode       : DIO
I (42) boot.esp32: SPI Flash Size : 4MB
I (46) boot: Enabling RNG early entropy source...
I (50) boot: Partition Table:
I (53) boot: ## Label            Usage          Type ST Offset   Length
I (59) boot:  0 nvs              WiFi data        01 02 00011000 00006000
I (66) boot:  1 phy_init         RF data          01 01 00017000 00001000
I (72) boot:  2 factory          factory app      00 00 00020000 00100000
I (79) boot: End of partition table
I (82) boot_comm: chip revision: 3, min. application chip revision: 0
I (88) esp_image: segment 0: paddr=00020020 vaddr=3f400020 size=12aa4h ( 76452) map
I (119) esp_image: segment 1: paddr=00032acc vaddr=3ffb0000 size=03c74h ( 15476) load
I (124) esp_image: segment 2: paddr=00036748 vaddr=40080000 size=098d0h ( 39120) load
I (138) esp_image: segment 3: paddr=00040020 vaddr=400d0020 size=2beb4h (179892) map
I (193) esp_image: segment 4: paddr=0006bedc vaddr=400898d0 size=0922ch ( 37420) load
I (206) esp_image: segment 5: paddr=00075110 vaddr=50000000 size=00010h (    16) load
I (216) boot: Loaded app from partition at offset 0x20000
I (216) boot: Disabling RNG early entropy source...
D (226) efuse: In EFUSE_BLK0__DATA3_REG is used 3 bits starting with 9 bit
D (226) efuse: In EFUSE_BLK0__DATA3_REG is used 1 bits starting with 2 bit
I (230) quad_psram: This chip is ESP32-D0WD
I (235) esp_psram: Found 2MB PSRAM device
I (237) esp_psram: Speed: 80MHz
I (240) esp_psram: PSRAM initialized, cache is in low/high (2-core) mode.
I (247) cpu_start: Pro cpu up.
I (250) cpu_start: Starting app cpu, entry point is 0x400815bc
0x400815bc: call_start_cpu1 at /home/daniel/Work/esp-sdk/esp-idf-v5.0/components/esp_system/port/cpu_start.c:142

I (0) cpu_start: App cpu up.
I (522) esp_psram: SPI SRAM memory test OK
D (529) clk: RTC_SLOW_CLK calibration value: 3214336
I (535) cpu_start: Pro cpu start user code
I (535) cpu_start: cpu freq: 240000000 Hz
I (535) cpu_start: Application information:
I (537) cpu_start: Project name:     camera_example
I (541) cpu_start: App version:      v2.0.3-8-g1c91a37-dirty
I (547) cpu_start: Compile time:     Feb 10 2023 12:23:27
I (552) cpu_start: ELF file SHA256:  0334a2a5350c7b24...
I (557) cpu_start: ESP-IDF:          v5.0-rc1-2-g7f4bcc3695
D (562) memory_layout: Checking 8 reserved memory ranges:
D (567) memory_layout: Reserved memory range 0x3f800000 - 0x3fc00000
D (573) memory_layout: Reserved memory range 0x3ffae000 - 0x3ffae6e0
D (579) memory_layout: Reserved memory range 0x3ffb0000 - 0x3ffb46e8
D (585) memory_layout: Reserved memory range 0x3ffe0000 - 0x3ffe0440
D (592) memory_layout: Reserved memory range 0x3ffe3f20 - 0x3ffe4350
D (598) memory_layout: Reserved memory range 0x40070000 - 0x40078000
D (604) memory_layout: Reserved memory range 0x40078000 - 0x40080000
0x40080000: _WindowOverflow4 at /home/daniel/Work/esp-sdk/esp-idf-v5.0/components/freertos/FreeRTOS-Kernel/portable/xtensa/xtensa_vectors.S:1742

D (610) memory_layout: Reserved memory range 0x40080000 - 0x40092afc
0x40080000: _WindowOverflow4 at /home/daniel/Work/esp-sdk/esp-idf-v5.0/components/freertos/FreeRTOS-Kernel/portable/xtensa/xtensa_vectors.S:1742

D (616) memory_layout: Building list of available memory regions:
D (622) memory_layout: Available memory region 0x3ffae6e0 - 0x3ffb0000
D (628) memory_layout: Available memory region 0x3ffb46e8 - 0x3ffb8000
D (634) memory_layout: Available memory region 0x3ffb8000 - 0x3ffc0000
D (640) memory_layout: Available memory region 0x3ffc0000 - 0x3ffc2000
D (647) memory_layout: Available memory region 0x3ffc2000 - 0x3ffc4000
D (653) memory_layout: Available memory region 0x3ffc4000 - 0x3ffc6000
D (659) memory_layout: Available memory region 0x3ffc6000 - 0x3ffc8000
D (665) memory_layout: Available memory region 0x3ffc8000 - 0x3ffca000
D (672) memory_layout: Available memory region 0x3ffca000 - 0x3ffcc000
D (678) memory_layout: Available memory region 0x3ffcc000 - 0x3ffce000
D (684) memory_layout: Available memory region 0x3ffce000 - 0x3ffd0000
D (690) memory_layout: Available memory region 0x3ffd0000 - 0x3ffd2000
D (697) memory_layout: Available memory region 0x3ffd2000 - 0x3ffd4000
D (703) memory_layout: Available memory region 0x3ffd4000 - 0x3ffd6000
D (709) memory_layout: Available memory region 0x3ffd6000 - 0x3ffd8000
D (715) memory_layout: Available memory region 0x3ffd8000 - 0x3ffda000
D (722) memory_layout: Available memory region 0x3ffda000 - 0x3ffdc000
D (728) memory_layout: Available memory region 0x3ffdc000 - 0x3ffde000
D (734) memory_layout: Available memory region 0x3ffde000 - 0x3ffe0000
D (740) memory_layout: Available memory region 0x3ffe0440 - 0x3ffe3f20
D (747) memory_layout: Available memory region 0x3ffe4350 - 0x3ffe8000
D (753) memory_layout: Available memory region 0x3ffe8000 - 0x3fff0000
D (759) memory_layout: Available memory region 0x3fff0000 - 0x3fff8000
D (765) memory_layout: Available memory region 0x3fff8000 - 0x3fffc000
D (772) memory_layout: Available memory region 0x3fffc000 - 0x40000000
D (778) memory_layout: Available memory region 0x40092afc - 0x40094000
D (784) memory_layout: Available memory region 0x40094000 - 0x40096000
D (790) memory_layout: Available memory region 0x40096000 - 0x40098000
D (797) memory_layout: Available memory region 0x40098000 - 0x4009a000
D (803) memory_layout: Available memory region 0x4009a000 - 0x4009c000
D (809) memory_layout: Available memory region 0x4009c000 - 0x4009e000
D (815) memory_layout: Available memory region 0x4009e000 - 0x400a0000
I (822) heap_init: Initializing. RAM available for dynamic allocation:
D (828) heap_init: New heap initialised at 0x3ffae6e0
I (833) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
D (838) heap_init: New heap initialised at 0x3ffb46e8
I (843) heap_init: At 3FFB46E8 len 0002B918 (174 KiB): DRAM
I (848) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (853) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (859) heap_init: New heap initialised at 0x40092afc
I (863) heap_init: At 40092AFC len 0000D504 (53 KiB): IRAM
I (869) esp_psram: Adding pool of 2048K of PSRAM memory to heap allocator
D (875) intr_alloc: Connected src 46 to int 2 (cpu 0)
D (880) spi_flash: trying chip: issi
D (883) spi_flash: trying chip: gd
I (886) spi_flash: detected chip: gd
I (890) spi_flash: flash io: dio
D (893) cpu_start: calling init function: 0x400ec040
0x400ec040: _GLOBAL__sub_I__ZN9__gnu_cxx9__freeresEv at eh_alloc.cc:?

D (897) cpu_start: calling init function: 0x400ebff8
0x400ebff8: _GLOBAL__sub_I___cxa_get_globals_fast at eh_globals.cc:?

D (902) cpu_start: calling init function: 0x400eaa00
0x400eaa00: esp_ipc_init at /home/daniel/Work/esp-sdk/esp-idf-v5.0/components/esp_system/esp_ipc.c:115

D (907) cpu_start: calling init function: 0x400d2c10
0x400d2c10: esp_reset_reason_init at /home/daniel/Work/esp-sdk/esp-idf-v5.0/components/esp_system/port/soc/esp32/reset_reason.c:68

D (911) cpu_start: calling init function: 0x400d1eb8
0x400d1eb8: esp_init_app_elf_sha256 at /home/daniel/Work/esp-sdk/esp-idf-v5.0/components/esp_app_format/esp_app_desc.c:69

D (916) cpu_start: calling init function: 0x400d55f0 on core: 0
0x400d55f0: __esp_system_init_fn_esp_timer_startup_init at /home/daniel/Work/esp-sdk/esp-idf-v5.0/components/esp_timer/src/esp_timer.c:464

D (922) intr_alloc: Connected src 17 to int 3 (cpu 0)
D (927) cpu_start: calling init function: 0x400fab20 on core: 0
0x400fab20: __esp_system_init_fn_init_components0 at /home/daniel/Work/esp-sdk/esp-idf-v5.0/components/esp_system/startup.c:477

D (932) intr_alloc: Connected src 24 to int 9 (cpu 0)
I (937) cpu_start: Starting scheduler on PRO CPU.
D (0) intr_alloc: Connected src 25 to int 2 (cpu 1)
I (4) cpu_start: Starting scheduler on APP CPU.
D (958) heap_init: New heap initialised at 0x3ffe0440
D (963) heap_init: New heap initialised at 0x3ffe4350
I (968) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations
D (976) esp_psram: Allocating block of size 32768 bytes
D (981) intr_alloc: Connected src 16 to int 12 (cpu 0)
I (986) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
D (994) intr_alloc: Connected src 22 to int 13 (cpu 0)
I (999) cam_hal: cam init ok
D (1001) camera: Enabling XCLK output
D (1005) ledc: Using clock source 1 (in slow mode), divisor: 0x400
D (1011) ledc: In slow speed mode, global clk set: 1
D (1015) ledc: LEDC_PWM CHANNEL 0|GPIO 00|Duty 0001|Time 0
D (1020) camera: Initializing SCCB
I (1024) sccb: pin_sda 26 pin_scl 27
I (1027) sccb: sccb_i2c_port=1

D (1030) intr_alloc: Connected src 50 to int 17 (cpu 0)
D (1035) camera: Resetting camera by power down line
I (1039) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
D (1068) camera: Searching for camera address
D (1078) sccb: Searching for OV7725 camera address 0x21
D (1078) sccb: Searching for OV2640 camera address 0x30
I (1078) camera: Detected camera at address=0x30
I (1083) camera: `Detected OV2640 camera`
D (1084) ov2640: OV2640 Attached
I (1087) camera: Camera PID=0x26 VER=0x42 MIDL=0x7f MIDH=0xa2
D (1093) camera: Doing SW reset of sensor
I (1176) cam_hal: buffer_size: 32768, half_buffer_size: 4096, node_buffer_size: 2048, node_cnt: 16, total_cnt: 45
I (1176) cam_hal: Allocating 184320 Byte frame buffer in PSRAM
I (1180) cam_hal: Allocating 184320 Byte frame buffer in PSRAM
D (1186) intr_alloc: Connected src 32 to int 18 (cpu 0)
I (1191) cam_hal: cam config ok
D (1194) camera: Setting frame size to 1280x720
I (1198) ov2640: Set PLL: clk_2x: 0, clk_div: 0, pclk_auto: 0, pclk_div: 12
I (1283) example:take_picture: Camera initialization need `297ms`
I (1283) example:take_picture: Boot time for esp32-camera `405ms`
I (1588) example:take_picture: Taking picture...1
I (1589) example:take_picture: MJPG: 39KB get-total(305113us-305120us)  3.3 fps
I (1589) example:take_picture: +++
W (2592) example:take_picture: Taking picture...2, abnormal, skiped 0x3f8008a4
I (2592) example:take_picture: MJPG: 39KB get-total(222us-230us)  4347.8 fps
I (2595) example:take_picture: +++
W (3598) example:take_picture: Taking picture...3, abnormal, skiped 0x3f80086c
I (3598) example:take_picture: MJPG: 45KB get-total(131us-138us)  7246.4 fps
I (3601) example:take_picture: +++
W (4604) example:take_picture: Taking picture...4, abnormal, skiped 0x3f8008a4
I (4604) example:take_picture: MJPG: 46KB get-total(235us-243us)  4115.2 fps
I (4607) example:take_picture: +++
W (5610) example:take_picture: Taking picture...5, abnormal, skiped 0x3f80086c
I (5610) example:take_picture: MJPG: 47KB get-total(228us-235us)  4255.3 fps
I (5613) example:take_picture: +++
W (6616) example:take_picture: Taking picture...6, abnormal, skiped 0x3f8008a4
I (6616) example:take_picture: MJPG: 48KB get-total(089us-098us)  10204.1 fps
I (6619) example:take_picture: +++
W (7622) example:take_picture: Taking picture...7, abnormal, skiped 0x3f80086c
I (7622) example:take_picture: MJPG: 50KB get-total(323us-330us)  3030.3 fps
I (7625) example:take_picture: +++
W (8628) example:take_picture: Taking picture...8, abnormal, skiped 0x3f8008a4
I (8628) example:take_picture: MJPG: 50KB get-total(269us-277us)  3610.1 fps
I (8631) example:take_picture: +++
W (9634) example:take_picture: Taking picture...9, abnormal, skiped 0x3f80086c
I (9634) example:take_picture: MJPG: 49KB get-total(123us-130us)  7692.3 fps
I (9637) example:take_picture: +++
W (10640) example:take_picture: Taking picture...10, abnormal, skiped 0x3f8008a4
I (10640) example:take_picture: MJPG: 49KB get-total(188us-196us)  5102.0 fps
I (10643) example:take_picture: +++
W (11646) example:take_picture: Taking picture...11, abnormal, skiped 0x3f80086c
I (11646) example:take_picture: MJPG: 49KB get-total(235us-242us)  4132.2 fps
I (11649) example:take_picture: +++
W (12652) example:take_picture: Taking picture...12, abnormal, skiped 0x3f8008a4
I (12652) example:take_picture: MJPG: 49KB get-total(302us-310us)  3225.8 fps
I (12655) example:take_picture: +++
W (13658) example:take_picture: Taking picture...13, abnormal, skiped 0x3f80086c
I (13658) example:take_picture: MJPG: 48KB get-total(131us-138us)  7246.4 fps
I (13661) example:take_picture: +++
W (14664) example:take_picture: Taking picture...14, abnormal, skiped 0x3f8008a4
I (14664) example:take_picture: MJPG: 47KB get-total(058us-066us)  15151.5 fps
I (14667) example:take_picture: +++
W (15670) example:take_picture: Taking picture...15, abnormal, skiped 0x3f80086c
I (15670) example:take_picture: MJPG: 47KB get-total(211us-217us)  4608.3 fps
I (15673) example:take_picture: +++
W (16676) example:take_picture: Taking picture...16, abnormal, skiped 0x3f8008a4
I (16676) example:take_picture: MJPG: 46KB get-total(121us-130us)  7692.3 fps
I (16679) example:take_picture: +++
W (17682) example:take_picture: Taking picture...17, abnormal, skiped 0x3f80086c
I (17682) example:take_picture: MJPG: 45KB get-total(232us-239us)  4184.1 fps
I (17685) example:take_picture: +++
W (18688) example:take_picture: Taking picture...18, abnormal, skiped 0x3f8008a4
I (18688) example:take_picture: MJPG: 45KB get-total(254us-262us)  3816.8 fps
I (18691) example:take_picture: +++
W (19694) example:take_picture: Taking picture...19, abnormal, skiped 0x3f80086c
I (19694) example:take_picture: MJPG: 45KB get-total(303us-313us)  3194.9 fps
I (19697) example:take_picture: +++
W (20700) example:take_picture: Taking picture...20, abnormal, skiped 0x3f8008a4
I (20700) example:take_picture: MJPG: 45KB get-total(245us-253us)  3952.6 fps
I (20703) example:take_picture: +++
I (21706) example:take_picture: ----------GRANULARITY:20
I (21706) example:take_picture: total:20, normal tests:1, abnormal skiped:19
I (21707) example:take_picture: MJPG: 39 - 39KB
I (21711) example:take_picture:  GET: 305 - 305ms avg 305ms
I (21716) example:take_picture:  SUM: 305 - 305ms avg 305ms
I (21722) example:take_picture:  FPS: 3.3 - 3.3 avg 3278.7

6.2 OV5640 ESP32-Camera 1280 x 760

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:6120
load:0x40078000,len:15456
load:0x40080400,len:3840
0x40080400: _init at ??:?

entry 0x4008064c
I (27) boot: ESP-IDF v5.0-rc1-2-g7f4bcc3695 2nd stage bootloader
I (27) boot: compile time 08:05:25
I (28) boot: chip revision: v3.0
I (29) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (35) boot.esp32: SPI Speed      : 80MHz
I (39) boot.esp32: SPI Mode       : DIO
I (42) boot.esp32: SPI Flash Size : 4MB
I (46) boot: Enabling RNG early entropy source...
I (50) boot: Partition Table:
I (53) boot: ## Label            Usage          Type ST Offset   Length
I (59) boot:  0 nvs              WiFi data        01 02 00011000 00006000
I (66) boot:  1 phy_init         RF data          01 01 00017000 00001000
I (72) boot:  2 factory          factory app      00 00 00020000 00100000
I (79) boot: End of partition table
I (82) boot_comm: chip revision: 3, min. application chip revision: 0
I (88) esp_image: segment 0: paddr=00020020 vaddr=3f400020 size=12aa4h ( 76452) map
I (119) esp_image: segment 1: paddr=00032acc vaddr=3ffb0000 size=03c74h ( 15476) load
I (124) esp_image: segment 2: paddr=00036748 vaddr=40080000 size=098d0h ( 39120) load
I (138) esp_image: segment 3: paddr=00040020 vaddr=400d0020 size=2beb4h (179892) map
I (193) esp_image: segment 4: paddr=0006bedc vaddr=400898d0 size=0922ch ( 37420) load
I (206) esp_image: segment 5: paddr=00075110 vaddr=50000000 size=00010h (    16) load
I (216) boot: Loaded app from partition at offset 0x20000
I (216) boot: Disabling RNG early entropy source...
D (226) efuse: In EFUSE_BLK0__DATA3_REG is used 3 bits starting with 9 bit
D (226) efuse: In EFUSE_BLK0__DATA3_REG is used 1 bits starting with 2 bit
I (230) quad_psram: This chip is ESP32-D0WD
I (235) esp_psram: Found 2MB PSRAM device
I (237) esp_psram: Speed: 80MHz
I (240) esp_psram: PSRAM initialized, cache is in low/high (2-core) mode.
I (247) cpu_start: Pro cpu up.
I (250) cpu_start: Starting app cpu, entry point is 0x400815bc
0x400815bc: call_start_cpu1 at /home/daniel/Work/esp-sdk/esp-idf-v5.0/components/esp_system/port/cpu_start.c:142

I (0) cpu_start: App cpu up.
I (522) esp_psram: SPI SRAM memory test OK
D (529) clk: RTC_SLOW_CLK calibration value: 3448282
I (535) cpu_start: Pro cpu start user code
I (535) cpu_start: cpu freq: 240000000 Hz
I (535) cpu_start: Application information:
I (537) cpu_start: Project name:     camera_example
I (541) cpu_start: App version:      v2.0.3-8-g1c91a37-dirty
I (547) cpu_start: Compile time:     Feb 10 2023 12:23:27
I (552) cpu_start: ELF file SHA256:  0334a2a5350c7b24...
I (557) cpu_start: ESP-IDF:          v5.0-rc1-2-g7f4bcc3695
D (562) memory_layout: Checking 8 reserved memory ranges:
D (567) memory_layout: Reserved memory range 0x3f800000 - 0x3fc00000
D (573) memory_layout: Reserved memory range 0x3ffae000 - 0x3ffae6e0
D (579) memory_layout: Reserved memory range 0x3ffb0000 - 0x3ffb46e8
D (585) memory_layout: Reserved memory range 0x3ffe0000 - 0x3ffe0440
D (592) memory_layout: Reserved memory range 0x3ffe3f20 - 0x3ffe4350
D (598) memory_layout: Reserved memory range 0x40070000 - 0x40078000
D (604) memory_layout: Reserved memory range 0x40078000 - 0x40080000
0x40080000: _WindowOverflow4 at /home/daniel/Work/esp-sdk/esp-idf-v5.0/components/freertos/FreeRTOS-Kernel/portable/xtensa/xtensa_vectors.S:1742

D (610) memory_layout: Reserved memory range 0x40080000 - 0x40092afc
0x40080000: _WindowOverflow4 at /home/daniel/Work/esp-sdk/esp-idf-v5.0/components/freertos/FreeRTOS-Kernel/portable/xtensa/xtensa_vectors.S:1742

D (616) memory_layout: Building list of available memory regions:
D (622) memory_layout: Available memory region 0x3ffae6e0 - 0x3ffb0000
D (628) memory_layout: Available memory region 0x3ffb46e8 - 0x3ffb8000
D (634) memory_layout: Available memory region 0x3ffb8000 - 0x3ffc0000
D (640) memory_layout: Available memory region 0x3ffc0000 - 0x3ffc2000
D (647) memory_layout: Available memory region 0x3ffc2000 - 0x3ffc4000
D (653) memory_layout: Available memory region 0x3ffc4000 - 0x3ffc6000
D (659) memory_layout: Available memory region 0x3ffc6000 - 0x3ffc8000
D (665) memory_layout: Available memory region 0x3ffc8000 - 0x3ffca000
D (672) memory_layout: Available memory region 0x3ffca000 - 0x3ffcc000
D (678) memory_layout: Available memory region 0x3ffcc000 - 0x3ffce000
D (684) memory_layout: Available memory region 0x3ffce000 - 0x3ffd0000
D (690) memory_layout: Available memory region 0x3ffd0000 - 0x3ffd2000
D (697) memory_layout: Available memory region 0x3ffd2000 - 0x3ffd4000
D (703) memory_layout: Available memory region 0x3ffd4000 - 0x3ffd6000
D (709) memory_layout: Available memory region 0x3ffd6000 - 0x3ffd8000
D (715) memory_layout: Available memory region 0x3ffd8000 - 0x3ffda000
D (722) memory_layout: Available memory region 0x3ffda000 - 0x3ffdc000
D (728) memory_layout: Available memory region 0x3ffdc000 - 0x3ffde000
D (734) memory_layout: Available memory region 0x3ffde000 - 0x3ffe0000
D (740) memory_layout: Available memory region 0x3ffe0440 - 0x3ffe3f20
D (747) memory_layout: Available memory region 0x3ffe4350 - 0x3ffe8000
D (753) memory_layout: Available memory region 0x3ffe8000 - 0x3fff0000
D (759) memory_layout: Available memory region 0x3fff0000 - 0x3fff8000
D (765) memory_layout: Available memory region 0x3fff8000 - 0x3fffc000
D (772) memory_layout: Available memory region 0x3fffc000 - 0x40000000
D (778) memory_layout: Available memory region 0x40092afc - 0x40094000
D (784) memory_layout: Available memory region 0x40094000 - 0x40096000
D (790) memory_layout: Available memory region 0x40096000 - 0x40098000
D (797) memory_layout: Available memory region 0x40098000 - 0x4009a000
D (803) memory_layout: Available memory region 0x4009a000 - 0x4009c000
D (809) memory_layout: Available memory region 0x4009c000 - 0x4009e000
D (815) memory_layout: Available memory region 0x4009e000 - 0x400a0000
I (822) heap_init: Initializing. RAM available for dynamic allocation:
D (828) heap_init: New heap initialised at 0x3ffae6e0
I (833) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
D (838) heap_init: New heap initialised at 0x3ffb46e8
I (843) heap_init: At 3FFB46E8 len 0002B918 (174 KiB): DRAM
I (848) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (853) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (859) heap_init: New heap initialised at 0x40092afc
I (863) heap_init: At 40092AFC len 0000D504 (53 KiB): IRAM
I (869) esp_psram: Adding pool of 2048K of PSRAM memory to heap allocator
D (875) intr_alloc: Connected src 46 to int 2 (cpu 0)
D (880) spi_flash: trying chip: issi
D (883) spi_flash: trying chip: gd
I (886) spi_flash: detected chip: gd
I (890) spi_flash: flash io: dio
D (893) cpu_start: calling init function: 0x400ec040
0x400ec040: _GLOBAL__sub_I__ZN9__gnu_cxx9__freeresEv at eh_alloc.cc:?

D (897) cpu_start: calling init function: 0x400ebff8
0x400ebff8: _GLOBAL__sub_I___cxa_get_globals_fast at eh_globals.cc:?

D (902) cpu_start: calling init function: 0x400eaa00
0x400eaa00: esp_ipc_init at /home/daniel/Work/esp-sdk/esp-idf-v5.0/components/esp_system/esp_ipc.c:115

D (907) cpu_start: calling init function: 0x400d2c10
0x400d2c10: esp_reset_reason_init at /home/daniel/Work/esp-sdk/esp-idf-v5.0/components/esp_system/port/soc/esp32/reset_reason.c:68

D (911) cpu_start: calling init function: 0x400d1eb8
0x400d1eb8: esp_init_app_elf_sha256 at /home/daniel/Work/esp-sdk/esp-idf-v5.0/components/esp_app_format/esp_app_desc.c:69

D (916) cpu_start: calling init function: 0x400d55f0 on core: 0
0x400d55f0: __esp_system_init_fn_esp_timer_startup_init at /home/daniel/Work/esp-sdk/esp-idf-v5.0/components/esp_timer/src/esp_timer.c:464

D (922) intr_alloc: Connected src 17 to int 3 (cpu 0)
D (927) cpu_start: calling init function: 0x400fab20 on core: 0
0x400fab20: __esp_system_init_fn_init_components0 at /home/daniel/Work/esp-sdk/esp-idf-v5.0/components/esp_system/startup.c:477

D (932) intr_alloc: Connected src 24 to int 9 (cpu 0)
I (937) cpu_start: Starting scheduler on PRO CPU.
D (0) intr_alloc: Connected src 25 to int 2 (cpu 1)
I (4) cpu_start: Starting scheduler on APP CPU.
D (958) heap_init: New heap initialised at 0x3ffe0440
D (963) heap_init: New heap initialised at 0x3ffe4350
I (968) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations
D (976) esp_psram: Allocating block of size 32768 bytes
D (981) intr_alloc: Connected src 16 to int 12 (cpu 0)
I (986) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
D (994) intr_alloc: Connected src 22 to int 13 (cpu 0)
I (999) cam_hal: cam init ok
D (1001) camera: Enabling XCLK output
D (1005) ledc: Using clock source 1 (in slow mode), divisor: 0x400
D (1011) ledc: In slow speed mode, global clk set: 1
D (1015) ledc: LEDC_PWM CHANNEL 0|GPIO 00|Duty 0001|Time 0
D (1020) camera: Initializing SCCB
I (1024) sccb: pin_sda 26 pin_scl 27
I (1027) sccb: sccb_i2c_port=1

D (1030) intr_alloc: Connected src 50 to int 17 (cpu 0)
D (1035) camera: Resetting camera by power down line
I (1039) gpio: GPIO[32]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
D (1068) camera: Searching for camera address
D (1078) sccb: Searching for OV7725 camera address 0x21
D (1078) sccb: Searching for OV2640 camera address 0x30
D (1078) sccb: Searching for OV3660 camera address 0x3c
I (1082) camera: Detected camera at address=0x3c
I (1087) ov3660: Mismatch PID=0x5640
I (1090) camera: `Detected OV5640 camera`
I (1093) camera: Camera PID=0x5640 VER=0x00 MIDL=0x00 MIDH=0x00
D (1098) camera: Doing SW reset of sensor
D (1696) ov5640: Camera defaults loaded
I (1796) cam_hal: buffer_size: 32768, half_buffer_size: 4096, node_buffer_size: 2048, node_cnt: 16, total_cnt: 45
I (1796) cam_hal: Allocating 184320 Byte frame buffer in PSRAM
I (1800) cam_hal: Allocating 184320 Byte frame buffer in PSRAM
D (1806) intr_alloc: Connected src 32 to int 18 (cpu 0)
I (1811) cam_hal: cam config ok
D (1813) camera: Setting frame size to 1280x720
D (1832) ov5640: Set Image Options: Compression: 1, Binning: 1, V-Flip: 0, H-Mirror: 0, Reg-4514: 0xaa
I (1832) ov5640: Set PLL: bypass: 0, multiplier: 200, sys_div: 4, pre_div: 2, root_2x: 0, pclk_root_div: 2, pclk_manual: 1, pclk_div: 4
I (1842) ov5640: Calculated XVCLK: 10000000 Hz, REFIN: 5000000 Hz, VCO: 1000000000 Hz, PLL_CLK: 100000000 Hz, SYSCLK: 25000000 Hz, PCLK: 6250000 Hz
D (1859) ov5640: Set framesize to: 1280x720
D (1861) ov5640: Set pixformat to: 4
D (1862) ov5640: Set quality to: 15
I (1880) example:take_picture: Camera initialization need `894ms`
I (1880) example:take_picture: Boot time for esp32-camera `1003ms`
I (2040) example:take_picture: Taking picture...1
I (2041) example:take_picture: MJPG: 39KB get-total(159410us-159417us)  6.3 fps
I (2041) example:take_picture: +++
W (3044) example:take_picture: Taking picture...2, abnormal, skiped 0x3f8008a4
I (3045) example:take_picture: MJPG: 36KB get-total(757us-765us)  1307.2 fps
I (3047) example:take_picture: +++
W (4051) example:take_picture: Taking picture...3, abnormal, skiped 0x3f80086c
I (4052) example:take_picture: MJPG: 40KB get-total(736us-743us)  1345.9 fps
I (4054) example:take_picture: +++
W (5058) example:take_picture: Taking picture...4, abnormal, skiped 0x3f8008a4
I (5059) example:take_picture: MJPG: 42KB get-total(839us-847us)  1180.6 fps
I (5062) example:take_picture: +++
W (6065) example:take_picture: Taking picture...5, abnormal, skiped 0x3f80086c
I (6066) example:take_picture: MJPG: 42KB get-total(846us-852us)  1173.7 fps
I (6069) example:take_picture: +++
W (7072) example:take_picture: Taking picture...6, abnormal, skiped 0x3f8008a4
I (7073) example:take_picture: MJPG: 42KB get-total(841us-849us)  1177.9 fps
I (7076) example:take_picture: +++
W (8079) example:take_picture: Taking picture...7, abnormal, skiped 0x3f80086c
I (8080) example:take_picture: MJPG: 42KB get-total(810us-816us)  1225.5 fps
I (8082) example:take_picture: +++
W (9086) example:take_picture: Taking picture...8, abnormal, skiped 0x3f8008a4
I (9087) example:take_picture: MJPG: 42KB get-total(795us-803us)  1245.3 fps
I (9089) example:take_picture: +++
W (10093) example:take_picture: Taking picture...9, abnormal, skiped 0x3f80086c
I (10094) example:take_picture: MJPG: 42KB get-total(781us-788us)  1269.0 fps
I (10097) example:take_picture: +++
W (11100) example:take_picture: Taking picture...10, abnormal, skiped 0x3f8008a4
I (11101) example:take_picture: MJPG: 42KB get-total(769us-777us)  1287.0 fps
I (11104) example:take_picture: +++
W (12107) example:take_picture: Taking picture...11, abnormal, skiped 0x3f80086c
I (12108) example:take_picture: MJPG: 42KB get-total(776us-783us)  1277.1 fps
I (12111) example:take_picture: +++
W (13114) example:take_picture: Taking picture...12, abnormal, skiped 0x3f8008a4
I (13115) example:take_picture: MJPG: 42KB get-total(776us-784us)  1275.5 fps
I (13118) example:take_picture: +++
W (14121) example:take_picture: Taking picture...13, abnormal, skiped 0x3f80086c
I (14122) example:take_picture: MJPG: 42KB get-total(785us-792us)  1262.6 fps
I (14125) example:take_picture: +++
W (15128) example:take_picture: Taking picture...14, abnormal, skiped 0x3f8008a4
I (15129) example:take_picture: MJPG: 42KB get-total(771us-779us)  1283.7 fps
I (15132) example:take_picture: +++
W (16135) example:take_picture: Taking picture...15, abnormal, skiped 0x3f80086c
I (16136) example:take_picture: MJPG: 42KB get-total(773us-780us)  1282.1 fps
I (16139) example:take_picture: +++
W (17142) example:take_picture: Taking picture...16, abnormal, skiped 0x3f8008a4
I (17143) example:take_picture: MJPG: 42KB get-total(744us-752us)  1329.8 fps
I (17146) example:take_picture: +++
W (18149) example:take_picture: Taking picture...17, abnormal, skiped 0x3f80086c
I (18150) example:take_picture: MJPG: 42KB get-total(753us-760us)  1315.8 fps
I (18153) example:take_picture: +++
W (19156) example:take_picture: Taking picture...18, abnormal, skiped 0x3f8008a4
I (19157) example:take_picture: MJPG: 42KB get-total(761us-769us)  1300.4 fps
I (19160) example:take_picture: +++
W (20163) example:take_picture: Taking picture...19, abnormal, skiped 0x3f80086c
I (20164) example:take_picture: MJPG: 42KB get-total(753us-760us)  1315.8 fps
I (20167) example:take_picture: +++
W (21170) example:take_picture: Taking picture...20, abnormal, skiped 0x3f8008a4
I (21171) example:take_picture: MJPG: 42KB get-total(770us-778us)  1285.3 fps
I (21174) example:take_picture: +++
I (22177) example:take_picture: ----------GRANULARITY:20
I (22177) example:take_picture: total:20, normal tests:1, abnormal skiped:19
I (22178) example:take_picture: MJPG: 39 - 39KB
I (22182) example:take_picture:  GET: 159 - 159ms avg 159ms
I (22187) example:take_picture:  SUM: 159 - 159ms avg 159ms
I (22193) example:take_picture:  FPS: 6.3 - 6.3 avg 6289.3

6.3 对比分析 OV2640 vs. OV5640

OV2640 以下方式总耗时:405 + 305 = 710ms

  1. 摄像头初始化:297ms
  2. ESP32启动到摄像头初始化:405ms
  3. 第一帧JPG数据到内存:305ms

OV5640 以下方式总耗时:1003 + 159 = 1162ms

  1. 摄像头初始化:894ms
  2. ESP32启动到摄像头初始化:1003ms
  3. 第一帧JPG数据到内存:159ms

6.4 进一步分析

这里数据看,在第一帧数据获取后,OV2640和OV5640在JPG数据获取在1ms以内,OV2640更好,约在300us以下。

RF传输通常在10ms左右,如果考虑软解情况下,做到20~30还是非常不错的FPV HD摄像头(高性价比) :)

当然也存在较多问题(带宽,帧速率,丢包,解码等):

比如:OV2640获取一帧jpeg数据,300us, 数据量50K
推算:3ms 500K --> 3s 500M --> 1s应该在160MB,这里是大B(不考虑FPS)
如果FPS是100,那么50 x 100 = 5MB = 40Mbit/s,每一帧处理时间10ms。
如果FPS是50, 那么50 x 50 = 2.5MB = 20Mbit/s,每一帧处理时间20ms。
如果FPS是20, 那么50 x 20 = 1.25MB = 10Mbit/s,每一帧处理时间50ms。

响应时延取决于:摄像头数据采集 + RF传输 + +纠错 + 解码 + 显示

7. 附录一:OV5640 for ESP32 Camera (Compared to OV2640)

OV5640 for ESP32 Camera (Compared to OV2640)

8. 附录二:ESP32-FPV-Camera (OV5640/OV2640)

SVGA(800 x 600), FPS 30+, 40 ~ 80 ms Delay

详细可参考:ESP32-FPV-Camera介绍和使用

ESP32-FPV-Camera FPS Test

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐