#include <opencv2/opencv.hpp>
#include <WiFi.h>
// Replace with your network credentials
const char* ssid = "Shuvra";
const char* password = "Rupabose";
// Analog input pin for video signal
const int videoPin = 36;
// Initialize analog video input
analog_video_input_t videoInput = {
.pin = videoPin,
.mode = ANALOG_VIDEO_MODE_NTSC,
.sync_level = 10,
.burst_level = 150,
.white_level = 900,
.black_level = 300,
};
// Video capture device
cv::VideoCapture capture;
void setup() {
// Connect to Wi-Fi network
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
// Initialize analog video input
analog_video_init(&videoInput);
// Initialize video capture device
capture.open(0, cv::CAP_V4L2);
capture.set(cv::CAP_PROP_FRAME_WIDTH, 720);
capture.set(cv::CAP_PROP_FRAME_HEIGHT, 480);
capture.set(cv::CAP_PROP_FOURCC, cv::VideoWriter::fourcc('M', 'J', 'P', 'G'));
}
void loop() {
// Read and process one frame of video
analog_video_frame_t frame;
if (analog_video_read_frame(&videoInput, &frame) == ESP_OK) {
// Display frame information on the serial monitor
Serial.print("Frame ");
Serial.print(frame.count);
Serial.print(", Lines ");
Serial.print(frame.lines);
Serial.print(", Pixels ");
Serial.println(frame.pixels);
// Write frame data to the video capture device
capture.write(cv::Mat(frame.lines, frame.pixels, CV_8UC1, frame.data));
}
// Display the captured video stream on the screen
cv::Mat frame;
capture.read(frame);
cv::imshow("FPV Camera", frame);
cv::waitKey(1);
}
helo there, you have no idea, what you’re doing, right ?
(code wont even compile like this…)
try to describe in words, what the mess above is supposed to do, please.
also, add more info about the hw / sw used.
OpenCV cannot run on ESP32, nor on Arduino.
ESP32 and Arduino also do not have a standard way to make GUIs.