Tech-dat/sensor-camera-dat/camera-SDK-dat/camera-SDK-dat.md
... ...
@@ -13,9 +13,10 @@ Arduino IDE
13 13
If you are using the arduino-esp32 core in Arduino IDE, no installation is needed! You can use esp32-camera right away.
14 14
15 15
16
+
16 17
## repro
17 18
18
-- [[openMV-dat]]
19
+- [[opencv-dat]] - [[openMV-dat]]
19 20
20 21
- [[circuitpython-dat]] - better support for [[ESP32-S3-dat]] not well support for ESP32-CAM == [[SCM1030-dat]] == https://github.com/adafruit/Adafruit_CircuitPython_OV2640/issues/22
21 22
... ...
@@ -94,6 +95,8 @@ This will copy the newly created image locally for viewing.
94 95
95 96
96 97
98
+
99
+
97 100
## repo
98 101
99 102
- https://github.com/Edragon/Camera
... ...
@@ -101,8 +104,91 @@ This will copy the newly created image locally for viewing.
101 104
- https://github.com/Edragon/esp32-camera-screen
102 105
103 106
107
+
108
+
109
+
110
+
111
+
104 112
## ref
105 113
106 114
- [[camera-dat]]
107 115
108
-- [[camera-SDK]] - [[SDK]]
... ...
\ No newline at end of file
0
+- [[camera-SDK]] - [[SDK]]
1
+
2
+
3
+## setup
4
+
5
+AI-Thinker esp32-cam board
6
+
7
+ ai_thinker = {PIN_PWDN:32,
8
+ PIN_RESET:-1,
9
+ PIN_XCLK:0,
10
+ PIN_SIOD:26,
11
+ PIN_SIOC:27,
12
+ PIN_D7:35,
13
+ PIN_D6:34,
14
+ PIN_D5:39,
15
+ PIN_D4:36,
16
+ PIN_D3:21,
17
+ PIN_D2:19,
18
+ PIN_D1:18,
19
+ PIN_D0:5,
20
+ PIN_VSYNC:25,
21
+ PIN_HREF:23,
22
+ PIN_PCLK:22,
23
+ XCLK_MHZ:16,
24
+ PIXFORMAT:5,
25
+ FRAMESIZE:10,
26
+ JPEG_QUALITY:10,
27
+ FB_COUNT:1,
28
+ }
29
+
30
+Electrodragon esp32s3-cam board (default in firmware)
31
+
32
+ Electrodragon = {PIN_PWDN:-1,
33
+ PIN_RESET:-1,
34
+ PIN_XCLK:15,
35
+ PIN_SIOD:4,
36
+ PIN_SIOC:5,
37
+ PIN_D7:16,
38
+ PIN_D6:17,
39
+ PIN_D5:18,
40
+ PIN_D4:12,
41
+ PIN_D3:10,
42
+ PIN_D2:8,
43
+ PIN_D1:9,
44
+ PIN_D0:11,
45
+ PIN_VSYNC:6,
46
+ PIN_HREF:7,
47
+ PIN_PCLK:13,
48
+ XCLK_MHZ:14,
49
+ PIXFORMAT:5,
50
+ FRAMESIZE:10,
51
+ JPEG_QUALITY:12,
52
+ FB_COUNT:2,
53
+ }
54
+
55
+Lilygo T-camera V1.6 esp32s3-cam board (default in firmware)
56
+
57
+ lilygo = {PIN_PWDN:-1,
58
+ PIN_RESET:39,
59
+ PIN_XCLK:38,
60
+ PIN_SIOD:5,
61
+ PIN_SIOC:4,
62
+ PIN_D7:9,
63
+ PIN_D6:10,
64
+ PIN_D5:11,
65
+ PIN_D4:13,
66
+ PIN_D3:21,
67
+ PIN_D2:48,
68
+ PIN_D1:47,
69
+ PIN_D0:14,
70
+ PIN_VSYNC:8,
71
+ PIN_HREF:18,
72
+ PIN_PCLK:12,
73
+ XCLK_MHZ:14,
74
+ PIXFORMAT:5,
75
+ FRAMESIZE:10,
76
+ JPEG_QUALITY:12,
77
+ FB_COUNT:2,
78
+ }
... ...
\ No newline at end of file
Tech-dat/sensor-camera-dat/camera-SDK-dat/opencv-dat.md
... ...
@@ -0,0 +1,158 @@
1
+
2
+# opencv-dat
3
+
4
+- [[camera-sdk-dat]]
5
+
6
+
7
+## demo code
8
+
9
+ # run this on Linux PC with opencv-python module
10
+
11
+ import cv2
12
+
13
+ dropped = 0 # drop frames count
14
+
15
+ # 192.168.4.44 - AIT esp32s
16
+ # Change this to your board IP
17
+ # http-based streaming not RTSP
18
+ vid = cv2.VideoCapture('http://192.168.4.97/ait/Hi-AIT-123') # open webcam capture
19
+
20
+ while True:
21
+ ret, frame = vid.read() # get frame-by-frame
22
+ #print(vid.isOpened(), ret)
23
+ if frame is not None:
24
+ if dropped > 0: dropped = 0 # reset
25
+ cv2.imshow('Video-44',frame) # display frame
26
+ if cv2.waitKey(22) & 0xFF == ord('q'): # press q to quit
27
+ break
28
+ else:
29
+ dropped += 1
30
+ if dropped > 100:
31
+ print("Server is down")
32
+ break
33
+
34
+ # Done, clear all resources
35
+ vid.release()
36
+ cv2.destroyAllWindows()
37
+ print("Video stop")
38
+
39
+## face detection
40
+
41
+ import cv2
42
+
43
+ dropped = 0 # drop frames count
44
+ from cvzone import FaceDetectionModule
45
+
46
+ face = FaceDetectionModule.FaceDetector()
47
+
48
+ # Change this to your board IP
49
+ # url = 'http://192.168.4.74/free/Hi-Nove-La'a # freenove
50
+ # url = 'http://192.168.4.70/xiao/Hi-Xiao-Ling' # xio
51
+ # url = 'http://192.168.4.71/lily/Hi-Lily-Goen' # lilygo
52
+ url = 'http://192.168.4.97/ait/Hi-AIT-123' # esp32 AiThinker
53
+
54
+ vid = cv2.VideoCapture(url) # open webcam capture, http-based streaming. Not RTSP
55
+
56
+ while True:
57
+ ret, frame = vid.read() # get frame-by-frame
58
+ #print(vid.isOpened(), ret)
59
+ if frame is not None:
60
+ if dropped > 0: dropped = 0 # reset
61
+ frame, faces = face.findFaces(frame)
62
+ # if faces:
63
+ # do other face processing
64
+ cv2.imshow('Faces',frame) # display frame
65
+ if cv2.waitKey(22) & 0xFF == ord('q'): # press q to quit
66
+ break
67
+ else:
68
+ dropped += 1
69
+ if dropped > 100:
70
+ print("Server is down")
71
+ break
72
+
73
+ # Done, clear all resources
74
+ vid.release()
75
+ cv2.destroyAllWindows()
76
+ print("Video stop")
77
+
78
+## hands detection
79
+
80
+ # run this on Linux PC with opencv-python module
81
+
82
+ import cv2
83
+ from cvzone.HandTrackingModule import HandDetector
84
+
85
+
86
+ # Hands = HandDetector(staticMode=False, maxHands=2, modelComplexity=1, detectionCon=0.5, minTrackCon=0.5)
87
+ Hands = HandDetector(detectionCon=0.5)
88
+ # if not detected try move your hands away from the camera
89
+
90
+ # Change this to your board IP
91
+ # Try first with web-browser, you will see image stream if OK
92
+ # http-based image streaming server
93
+
94
+ # url = 'http://192.168.4.74/free/Hi-Nove-La' # freenove
95
+ # url = 'http://192.168.4.70/xiao/Hi-Xiao-Ling' # xio
96
+ # url = 'http://192.168.4.71/lily/Hi-Lily-Goen' # lilygo
97
+ url = 'http://192.168.4.97/ait/Hi-AIT-123' # esp32 AiThinker
98
+
99
+ vid = cv2.VideoCapture(url) # open webcam capture
100
+
101
+ dropped = 0 # drop frames count
102
+ while True:
103
+ ret, frame = vid.read() # get frame-by-frame
104
+ if frame is not None:
105
+ if dropped > 0: dropped = 0 # reset
106
+ hands, frame = Hands.findHands(frame, draw=True, flipType=True)
107
+ # Check if any hands are detected
108
+ if hands:
109
+ # Information for the first hand detected
110
+ hand1 = hands[0] # Get the first hand detected
111
+ # lmList1 = hand1["lmList"] # List of 21 landmarks for the first hand
112
+ bbox1 = hand1["bbox"] # Bounding box around the first hand
113
+ # (x,y,w,h coordinates)
114
+ center1 = hand1['center'] # Center coordinates of the first hand
115
+ handType1 = hand1["type"] # Type of the first hand ("Left" or "Right")
116
+
117
+ # Count the number of fingers up for the first hand
118
+ # fingers1 = Hands.fingersUp(hand1)
119
+ # print(f'H1 = {fingers1.count(1)}', end=" ")
120
+
121
+ # Calculate distance between specific landmarks on the first hand
122
+ # and draw it on the image
123
+ # length, info, frame = Hands.findDistance(lmList1[8][0:2], lmList1[12][0:2], frame, color=(255, 0, 255), scale=10)
124
+
125
+ # Check if a second hand is detected
126
+ if len(hands) == 2:
127
+ # Information for the second hand
128
+ hand2 = hands[1]
129
+ # lmList2 = hand2["lmList"]
130
+ bbox2 = hand2["bbox"]
131
+ center2 = hand2['center']
132
+ handType2 = hand2["type"]
133
+
134
+ # Count the number of fingers up for the second hand
135
+ # fingers2 = Hands.fingersUp(hand2)
136
+ # print(f'H2 = {fingers2.count(1)}', end=" ")
137
+
138
+ # Calculate distance between the index fingers of both hands
139
+ # and draw it on the image
140
+ # length, info, frame = Hands.findDistance(lmList1[8][0:2], lmList2[8][0:2], frame, color=(255, 0, 0), scale=10)
141
+
142
+ # print(" ") # New line for better readability of the printed output
143
+ # show image
144
+ cv2.imshow('Hands',frame) # display frame
145
+ # define abort key
146
+ if cv2.waitKey(22) & 0xFF == ord('q'): # press q to quit
147
+ break
148
+ else:
149
+ dropped += 1
150
+ if dropped > 100:
151
+ print("Server is down")
152
+ break
153
+
154
+ # Done, clear all resources
155
+ vid.release()
156
+ cv2.destroyAllWindows()
157
+ print("Video stop")
158
+