nopnop2002 / esp-idf-video-streaming

Capture video from a USB camera using ESP-IDF
MIT License
42 stars 4 forks source link

Purethermal 3 with Flir Lepton 3.5 #22

Open metanav opened 4 months ago

metanav commented 4 months ago

I am trying to interface a Flir Lepton thermal camera using a Purethermal 3 board that makes it a UVC webcam. I have made some changes in the main.cpp to use the UncompressedFormat (UYVY):

+++ b/main/main.c
@@ -415,7 +415,8 @@ int app_main(int argc, char **argv)
                                height = frame_desc->wHeight;
                                fps = 10000000 / frame_desc->dwDefaultFrameInterval;
                                //format = UVC_FRAME_FORMAT_UNCOMPRESSED;
-                               format = UVC_FRAME_FORMAT_YUYV;
+                               //format = UVC_FRAME_FORMAT_YUYV;
+                               format = UVC_FRAME_FORMAT_UYVY;
                        } else if (format_desc->bDescriptorSubtype == UVC_VS_FORMAT_MJPEG) { // 
                                ESP_LOGI(TAG, "format_desc->bDescriptorSubtype == UVC_VS_FORMAT_MJPEG");
                                width = frame_desc->wWidth;
@@ -460,8 +461,10 @@ int app_main(int argc, char **argv)
 #endif

 #if CONFIG_FORMAT_YUY2
-               ESP_LOGW(TAG, "FRAME FORMAT=YUYV");
-               format = UVC_FRAME_FORMAT_YUYV;
+               //ESP_LOGW(TAG, "FRAME FORMAT=YUYV");
+               //format = UVC_FRAME_FORMAT_YUYV;
+               ESP_LOGW(TAG, "FRAME FORMAT=UYVY");
+               format = UVC_FRAME_FORMAT_UYVY;

But it is not working. Below is the log:

Waiting for device
Device found
DEVICE CONFIGURATION (1e4e:0100/J.0) ---
Status: idle
VideoControl:
.bcdUVC: 0x0100
VideoStreaming(1):
.bEndpointAddress: 129
.Formats:
.UncompressedFormat(1)
..  bits per pixel: 16
..  GUID: 5559565900001000800000aa00389b71 (UYVY)
..  default frame: 1
..  aspect ratio: 0x0
..  interlace flags: 00
..  copy protect: 00
...FrameDescriptor(1)
...  capabilities: 02
...  size: 160x120
...  bit rate: 2764800-2764800
...  max frame size: 38400
...  default interval: 1/9
...  interval[0]: 1/9
.UncompressedFormat(2)
..  bits per pixel: 16
..  GUID: 5931362000001000800000aa00389b71 (Y16 )
..  default frame: 1
..  aspect ratio: 0x0
..  interlace flags: 00
..  copy protect: 00
...FrameDescriptor(1)
...  capabilities: 02
...  size: 160x120
...  bit rate: 2764800-2764800
...  max frame size: 38400
...  default interval: 1/9
...  interval[0]: 1/9
...FrameDescriptor(2)
...  capabilities: 02
...  size: 160x122
...  bit rate: 2810880-2810880
...  max frame size: 39040
...  default interval: 1/9
...  interval[0]: 1/9
.UncompressedFormat(3)
..  bits per pixel: 8
..  GUID: 5938202000001000800000aa00389b71 (Y8  )
..  default frame: 1
..  aspect ratio: 0x0
..  interlace flags: 00
..  copy protect: 00
...FrameDescriptor(1)
...  capabilities: 02
...  size: 160x120
...  bit rate: 1382400-1382400
...  max frame size: 19200
...  default interval: 1/9
...  interval[0]: 1/9
.UncompressedFormat(4)
..  bits per pixel: 16
..  GUID: 5247425000001000800000aa00389b71 (RGBP)
..  default frame: 1
..  aspect ratio: 0x0
..  interlace flags: 00
..  copy protect: 00
...FrameDescriptor(1)
...  capabilities: 02
...  size: 160x120
...  bit rate: 2764800-2764800
...  max frame size: 38400
...  default interval: 1/9
...  interval[0]: 1/9
.UncompressedFormat(5)
..  bits per pixel: 24
..  GUID: 7deb36e44f52ce119f530020af0ba770 (}Î6‰ORŒ.üS)
..  default frame: 1
..  aspect ratio: 0x0
..  interlace flags: 00
..  copy protect: 00
...FrameDescriptor(1)
...  capabilities: 02
...  size: 160x120
...  bit rate: 4147200-4147200
...  max frame size: 57600
...  default interval: 1/9
...  interval[0]: 1/9
END DEVICE CONFIGURATION
(17484) example: format_desc->fourccFormat=(UYVY).[0m
(17494) example: frame_desc->wWidth=160.[0m
 (17494) example: frame_desc->wHeight=120.[0m
 (17504) example: format_desc->bDescriptorSubtype=4.[0m
 (17504) example: frame_desc->dwDefaultFrameInterval=1111111.[0m
 (17514) example: format_desc->bDescriptorSubtype == UVC_VS_FORMAT_UNCOMPRESSED.[0m
 (17524) example: FRAME SIZE=160x120 FRAME RATE=9.[0m
 (17524) example: FRAME FORMAT=UYVY.[0m
 (17534) example: format=4 width=160 height=120 fps=9.[0m
bmHint: 0000
bFormatIndex: 1
bFrameIndex: 1
dwFrameInterval: 1111111
wKeyFrameRate: 0
wPFrameRate: 0
wCompQuality: 0
wCompWindowSize: 0
wDelay: 0
dwMaxVideoFrameSize: 38400
dwMaxPayloadTransferSize: 512
bInterfaceNumber: 1
 (17554) HCD DWC: EP MPS (642) exceeds supported limit (600).[0m
(17564) example: uvc_start_streaming=-99.[0m
 (17564) example: uvc_start_streaming fail.[0m
 (17574) example: Change other camera and re-start.[0m
nopnop2002 commented 4 months ago

It is very hard to find a camera that works with ESP-IDF.

When usb support provided by ESP-IDF is updated, this issue may eliminate the problem.

metanav commented 4 months ago

I think this error causes the issue:

HCD DWC: EP MPS (642) exceeds supported limit (600)

How can we increase the limit?

nopnop2002 commented 4 months ago
HCD DWC: EP MPS (642) exceeds supported limit (600)

This is the message inside the ESP-IDF component. Ask EspressIF.