Coder Social home page Coder Social logo

ianmuchyri / n3-camera Goto Github PK

View Code? Open in Web Editor NEW

This project forked from theparadox20/n3-camera

0.0 0.0 0.0 16 KB

streaming live video from an ESP32-CAM module using a WebSocket connection. It captures images from the camera and sends them as JPEG binary data over the WebSocket to a remote server

JavaScript 12.82% C++ 66.49% C 20.69%

n3-camera's Introduction

N3-Camera

This code is designed to stream video from an AI-Thinker ESP32-CAM module to a WebSocket server using the Arduino framework.

Dependencies

  1. Arduino.h
  2. esp_camera.h
  3. WiFi.h
  4. ArduinoWebsockets.h

Code Structure

setup()

The setup() function initializes the serial communication with the ESP32-CAM module and the camera's configuration. It sets up the camera configuration to use JPEG format and configure the pins that the camera module uses.

startStream()

The startStream() function initializes the running average filter and calls the handleStream() function to start the video streaming process.

handleStream()

The handleStream() function captures frames from the camera and sends them to the WebSocket server in binary format. If the frame format is not JPEG, it converts the frame to JPEG format before sending. It also calculates the frame rate and sends it to the Serial Monitor.

ra_filter_init()

This function initializes the running average filter by creating an array with the specified number of samples and setting the size parameter of the filter.

ra_filter_run()

This function runs the running average filter on the specified value and returns the filtered value.

Variables

ssid: The name of the Wi-Fi network that the ESP32-CAM module should connect to. password: The password for the Wi-Fi network. websockets_server_host: The IP address of the WebSocket server that the video stream should be sent to. websockets_server_port: The port number of the WebSocket server. ra_filter: A struct that holds the parameters for the running average filter. _jpg_buf_len: The length of the JPEG buffer. _jpg_buf: A pointer to the JPEG buffer.

Libraries

esp_camera.h

The esp_camera.h library provides the functions necessary for initializing the camera and capturing frames.

WiFi.h

The WiFi.h library provides the functions necessary for connecting to a Wi-Fi network.

ArduinoWebsockets.h

The ArduinoWebsockets.h library provides the functions necessary for creating a WebSocket client and sending data over the WebSocket connection.

n3-camera's People

Contributors

cyator avatar ianmuchyri avatar theparadox20 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.