ESP32CAM物聯網教學11

ESP32CAM物聯網教學11

霍霍webserver

在第八課的時候,小智把樂鑫公司提供的官方示例程序CameraWebServer改成了明碼,這樣說明這個官方程序也是可以更改的嘛。這個官方程序有四個文件,一共3500行代碼,看著都頭暈,小智決定對這個官方程序下手,砍一砍,看看能看到多少行代碼!

  • 整合、刪減

首先把四個文件整合成一個文件。

Camera_pins.h這個是定義攝像頭引腳接口的,我們僅僅保留AI_THINKER這種攝像頭的接口;camera_index.h是服務網頁的源代碼,我們只保留改編后的明碼;接來著是更改最多的app_httpd.cpp,這個是定義了網頁服務的后臺程序。

這個官方程序在設計的時候,主要是面向更多款式的ESP32Cam開發板,為用戶提供更多的使用操作,提供了非常豐富、非常完整的服務,是一個主打“通用型程序”。但是,我們在這里的目的是刪減,只要保留著針對手中的這塊ESP32Cam,程序只要能跑就好,不需要更多的花里胡哨,刪減程序主打“專用型程序”。

因此,如圖所示,我們在這個程序中,僅僅保留了兩個網頁服務:一個是主頁index.html,一個是視頻服務Stream。然后把其他的相關內容全部刪除,經過刪減,代碼打印剩下300行了。

330行代碼:

#include "esp_camera.h"
#include <WiFi.h>
#include "esp_http_server.h"const char* ssid = "ChinaNet-xxVP";
const char* password = "123456789";void startCameraServer();//  這個是index.html網頁的源代碼
static const char mainPage[] = u8R"(
<!doctype html>
<html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>ESP32 OV2460</title></head><body><section class="main"><div id="content"><div id="sidebar"><nav id="menu"><section id="buttons"><button id="toggle-stream">Start Stream</button><button id="stggle-stream">Stop Stream</button></section></nav></div><figure><div id="stream-container" class="image-container hidden"><img id="stream" src="" crossorigin></div></figure></div></section><script>
document.addEventListener('DOMContentLoaded', function (event) {var baseHost = document.location.originvar streamUrl = baseHost + ':81'function setWindow(start_x, start_y, end_x, end_y, offset_x, offset_y, total_x, total_y, output_x, output_y, scaling, binning, cb){fetchUrl(`${baseHost}/resolution?sx=${start_x}&sy=${start_y}&ex=${end_x}&ey=${end_y}&offx=${offset_x}&offy=${offset_y}&tx=${total_x}&ty=${total_y}&ox=${output_x}&oy=${output_y}&scale=${scaling}&binning=${binning}`, cb);}document.querySelectorAll('.close').forEach(el => {el.onclick = () => {hide(el.parentNode)}})const view = document.getElementById('stream')const streamButton = document.getElementById('toggle-stream')const streamButton2 = document.getElementById('stggle-stream')streamButton.onclick = () => {view.src = `${streamUrl}/stream`show(viewContainer)}streamButton2.onclick = () => {window.stop();}})</script></body>
</html>
)";///
// 攝像頭引腳 AI_Thinker
#define PWDN_GPIO_NUM     32
#define RESET_GPIO_NUM    -1
#define XCLK_GPIO_NUM      0
#define SIOD_GPIO_NUM     26
#define SIOC_GPIO_NUM     27
#define Y9_GPIO_NUM       35
#define Y8_GPIO_NUM       34
#define Y7_GPIO_NUM       39
#define Y6_GPIO_NUM       36
#define Y5_GPIO_NUM       21
#define Y4_GPIO_NUM       19
#define Y3_GPIO_NUM       18
#define Y2_GPIO_NUM        5
#define VSYNC_GPIO_NUM    25
#define HREF_GPIO_NUM     23
#define PCLK_GPIO_NUM     22
//#define LED_GPIO_NUM       4///
// 開啟調試信息
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
#include "esp32-hal-log.h"
#endif
// 開啟模塊的存儲 PSRAM
#ifdef BOARD_HAS_PSRAM
#define CONFIG_ESP_FACE_DETECT_ENABLED 1
#define CONFIG_ESP_FACE_RECOGNITION_ENABLED 0
#endif#define PART_BOUNDARY "123456789000000000000987654321"
static const char *_STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary=" PART_BOUNDARY;
static const char *_STREAM_BOUNDARY = "\r\n--" PART_BOUNDARY "\r\n";
static const char *_STREAM_PART = "Content-Type: image/jpeg\r\nContent-Length: %u\r\nX-Timestamp: %d.%06d\r\n\r\n";httpd_handle_t stream_httpd = NULL;
httpd_handle_t camera_httpd = NULL;static esp_err_t stream_handler(httpd_req_t *req)
{camera_fb_t *fb = NULL;struct timeval _timestamp;esp_err_t res = ESP_OK;size_t _jpg_buf_len = 0;uint8_t *_jpg_buf = NULL;char *part_buf[128];res = httpd_resp_set_type(req, _STREAM_CONTENT_TYPE);if (res != ESP_OK){return res;}httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");httpd_resp_set_hdr(req, "X-Framerate", "60");while (true){fb = esp_camera_fb_get();if (!fb){log_e("Camera capture failed");res = ESP_FAIL;}else{  // 從攝像頭獲取圖片的數據_jpg_buf_len = fb->len;_jpg_buf = fb->buf;}if (res == ESP_OK){res = httpd_resp_send_chunk(req, _STREAM_BOUNDARY, strlen(_STREAM_BOUNDARY));}if (res == ESP_OK){size_t hlen = snprintf((char *)part_buf, 128, _STREAM_PART, _jpg_buf_len, _timestamp.tv_sec, _timestamp.tv_usec);res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen);}if (res == ESP_OK){res = httpd_resp_send_chunk(req, (const char *)_jpg_buf, _jpg_buf_len);}// 清除相關的內存if (fb){esp_camera_fb_return(fb);fb = NULL;_jpg_buf = NULL;}else if (_jpg_buf){free(_jpg_buf);_jpg_buf = NULL;}if (res != ESP_OK){log_e("Send frame failed");break;}}return res;
}static esp_err_t index_handler(httpd_req_t *req)
{httpd_resp_set_type(req, "text/html");//httpd_resp_set_hdr(req, "Content-Encoding", "gzip");httpd_resp_set_hdr(req, "Content-Encoding", "html");sensor_t *s = esp_camera_sensor_get();if (s != NULL) {//return httpd_resp_send(req, (const char *)index_ov2640_html_gz, index_ov2640_html_gz_len);const char* charHtml = mainPage;return  httpd_resp_send(req, (const char *)charHtml, strlen(charHtml));} else {log_e("Camera sensor not found");return httpd_resp_send_500(req);}
}void startCameraServer()
{httpd_config_t config = HTTPD_DEFAULT_CONFIG();config.max_uri_handlers = 16;httpd_uri_t index_uri = {.uri = "/",.method = HTTP_GET,.handler = index_handler,.user_ctx = NULL};httpd_uri_t stream_uri = {.uri = "/stream",.method = HTTP_GET,.handler = stream_handler,.user_ctx = NULL};log_i("Starting web server on port: '%d'", config.server_port);if (httpd_start(&camera_httpd, &config) == ESP_OK){httpd_register_uri_handler(camera_httpd, &index_uri);//httpd_register_uri_handler(camera_httpd, &cmd_uri);//httpd_register_uri_handler(camera_httpd, &status_uri);//httpd_register_uri_handler(camera_httpd, &capture_uri);//httpd_register_uri_handler(camera_httpd, &bmp_uri);//httpd_register_uri_handler(camera_httpd, &xclk_uri);//httpd_register_uri_handler(camera_httpd, &reg_uri);//httpd_register_uri_handler(camera_httpd, &greg_uri);//httpd_register_uri_handler(camera_httpd, &pll_uri);//httpd_register_uri_handler(camera_httpd, &win_uri);}config.server_port += 1;config.ctrl_port += 1;log_i("Starting stream server on port: '%d'", config.server_port);if (httpd_start(&stream_httpd, &config) == ESP_OK){httpd_register_uri_handler(stream_httpd, &stream_uri);}
}///void setup() {Serial.begin(115200);Serial.setDebugOutput(true);Serial.println();camera_config_t config;config.ledc_channel = LEDC_CHANNEL_0;config.ledc_timer = LEDC_TIMER_0;config.pin_d0 = Y2_GPIO_NUM;config.pin_d1 = Y3_GPIO_NUM;config.pin_d2 = Y4_GPIO_NUM;config.pin_d3 = Y5_GPIO_NUM;config.pin_d4 = Y6_GPIO_NUM;config.pin_d5 = Y7_GPIO_NUM;config.pin_d6 = Y8_GPIO_NUM;config.pin_d7 = Y9_GPIO_NUM;config.pin_xclk = XCLK_GPIO_NUM;config.pin_pclk = PCLK_GPIO_NUM;config.pin_vsync = VSYNC_GPIO_NUM;config.pin_href = HREF_GPIO_NUM;config.pin_sccb_sda = SIOD_GPIO_NUM;config.pin_sccb_scl = SIOC_GPIO_NUM;config.pin_pwdn = PWDN_GPIO_NUM;config.pin_reset = RESET_GPIO_NUM;config.xclk_freq_hz = 20000000;config.frame_size = FRAMESIZE_UXGA;config.pixel_format = PIXFORMAT_JPEG; // for streaming//config.pixel_format = PIXFORMAT_RGB565; // for face detection/recognitionconfig.grab_mode = CAMERA_GRAB_WHEN_EMPTY;config.fb_location = CAMERA_FB_IN_PSRAM;config.jpeg_quality = 12;config.fb_count = 1;// if PSRAM IC present, init with UXGA resolution and higher JPEG quality//                      for larger pre-allocated frame buffer.if(config.pixel_format == PIXFORMAT_JPEG){if(psramFound()){config.jpeg_quality = 10;config.fb_count = 2;config.grab_mode = CAMERA_GRAB_LATEST;} else {// Limit the frame size when PSRAM is not availableconfig.frame_size = FRAMESIZE_SVGA;config.fb_location = CAMERA_FB_IN_DRAM;}}// camera initesp_err_t err = esp_camera_init(&config);if (err != ESP_OK) {Serial.printf("Camera init failed with error 0x%x", err);return;}sensor_t * s = esp_camera_sensor_get();// drop down frame size for higher initial frame rateif(config.pixel_format == PIXFORMAT_JPEG){s->set_framesize(s, FRAMESIZE_QVGA);}WiFi.begin(ssid, password);WiFi.setSleep(false);while (WiFi.status() != WL_CONNECTED) {delay(500);Serial.print(".");}Serial.println("");Serial.println("WiFi connected");startCameraServer();Serial.print("Camera Ready! Use 'http://");Serial.print(WiFi.localIP());Serial.println("' to connect");
}void loop() {// Do nothing. Everything is done in another task by the web serverdelay(10000);
}

  • 再次刪減

我們通過查閱index.html的源碼,發現這個視頻顯示的代碼,其實是指向另外的一個網頁,結合后臺的處理程序,我們知道了這個視頻的網址是http://192.168.1.184:81/stream,我們只要在瀏覽器中直接訪問這個網址,也能查看到攝像頭的視頻。也就是說,我們可以繞開主頁index.html,然后直接去訪問這個顯示視頻的網頁。

view.src = `${streamUrl}/stream`

show(viewContainer)

這樣就給了我們再次刪減程序的方法了,我們之間李代桃僵,用這個視頻顯示的網頁,直接代替主頁index.html。這樣,我們在開發板的后臺程序中,可以刪減掉原來的index.html的源代碼以及頁面服務了。

程序經過再次刪減,僅剩下200行了。這樣,我們新建一個Arduino IDE程序,要把這200行的代碼,寫入ESP32Cam開發板,就能用瀏覽器看到這個攝像頭的視頻了。

為什么刪減程序呢?我們在研究這個官方程序的時候,如果是5000行代碼,誰看都暈,現在變成200行,一眼就能看得明明白白清清楚楚了。

200行代碼:

#include "esp_camera.h"
#include <WiFi.h>
#include "esp_http_server.h"const char* ssid = "ChinaNet-xxVP";
const char* password = "123456789";void startCameraServer();///
// 開啟調試信息
#if defined(ARDUINO_ARCH_ESP32) && defined(CONFIG_ARDUHAL_ESP_LOG)
#include "esp32-hal-log.h"
#endif
// 開啟模塊的存儲 PSRAM
#ifdef BOARD_HAS_PSRAM
#define CONFIG_ESP_FACE_DETECT_ENABLED 1
#define CONFIG_ESP_FACE_RECOGNITION_ENABLED 0
#endif#define PART_BOUNDARY "123456789000000000000987654321"
static const char *_STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary=" PART_BOUNDARY;
static const char *_STREAM_BOUNDARY = "\r\n--" PART_BOUNDARY "\r\n";
static const char *_STREAM_PART = "Content-Type: image/jpeg\r\nContent-Length: %u\r\nX-Timestamp: %d.%06d\r\n\r\n";httpd_handle_t camera_httpd = NULL;static esp_err_t index_handler(httpd_req_t *req)
{camera_fb_t *fb = NULL;struct timeval _timestamp;esp_err_t res = ESP_OK;size_t _jpg_buf_len = 0;uint8_t *_jpg_buf = NULL;char *part_buf[128];res = httpd_resp_set_type(req, _STREAM_CONTENT_TYPE);if (res != ESP_OK){return res;}httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");httpd_resp_set_hdr(req, "X-Framerate", "60");while (true){fb = esp_camera_fb_get();if (!fb){log_e("Camera capture failed");res = ESP_FAIL;}else{  // 從攝像頭獲取圖片的數據_jpg_buf_len = fb->len;_jpg_buf = fb->buf;}if (res == ESP_OK){res = httpd_resp_send_chunk(req, _STREAM_BOUNDARY, strlen(_STREAM_BOUNDARY));}if (res == ESP_OK){size_t hlen = snprintf((char *)part_buf, 128, _STREAM_PART, _jpg_buf_len, _timestamp.tv_sec, _timestamp.tv_usec);res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen);}if (res == ESP_OK){res = httpd_resp_send_chunk(req, (const char *)_jpg_buf, _jpg_buf_len);}// 清除相關的內存if (fb){esp_camera_fb_return(fb);fb = NULL;_jpg_buf = NULL;}else if (_jpg_buf){free(_jpg_buf);_jpg_buf = NULL;}if (res != ESP_OK){log_e("Send frame failed");break;}}return res;
}void startCameraServer()
{httpd_config_t config = HTTPD_DEFAULT_CONFIG();config.max_uri_handlers = 16;httpd_uri_t index_uri = {.uri = "/",.method = HTTP_GET,.handler = index_handler,.user_ctx = NULL};log_i("Starting web server on port: '%d'", config.server_port);if (httpd_start(&camera_httpd, &config) == ESP_OK){httpd_register_uri_handler(camera_httpd, &index_uri);}
}///void setup() {Serial.begin(115200);Serial.setDebugOutput(true);Serial.println();camera_config_t config;config.ledc_channel = LEDC_CHANNEL_0;config.ledc_timer = LEDC_TIMER_0;config.pin_d0 = 5;config.pin_d1 = 18;config.pin_d2 = 19;config.pin_d3 = 21;config.pin_d4 = 36;config.pin_d5 = 39;config.pin_d6 = 34;config.pin_d7 = 35;config.pin_xclk = 0;config.pin_pclk = 22;config.pin_vsync = 25;config.pin_href = 23;config.pin_sccb_sda = 26;config.pin_sccb_scl = 27;config.pin_pwdn = 32;config.pin_reset = -1;config.xclk_freq_hz = 20000000;config.frame_size = FRAMESIZE_UXGA;config.pixel_format = PIXFORMAT_JPEG; // for streaming//config.pixel_format = PIXFORMAT_RGB565; // for face detection/recognitionconfig.grab_mode = CAMERA_GRAB_WHEN_EMPTY;config.fb_location = CAMERA_FB_IN_PSRAM;config.jpeg_quality = 12;config.fb_count = 1;// if PSRAM IC present, init with UXGA resolution and higher JPEG quality//                      for larger pre-allocated frame buffer.if(config.pixel_format == PIXFORMAT_JPEG){if(psramFound()){config.jpeg_quality = 10;config.fb_count = 2;config.grab_mode = CAMERA_GRAB_LATEST;} else {// Limit the frame size when PSRAM is not availableconfig.frame_size = FRAMESIZE_SVGA;config.fb_location = CAMERA_FB_IN_DRAM;}}// camera initesp_err_t err = esp_camera_init(&config);if (err != ESP_OK) {Serial.printf("Camera init failed with error 0x%x", err);return;}sensor_t * s = esp_camera_sensor_get();// drop down frame size for higher initial frame rateif(config.pixel_format == PIXFORMAT_JPEG){s->set_framesize(s, FRAMESIZE_QVGA);}WiFi.begin(ssid, password);WiFi.setSleep(false);while (WiFi.status() != WL_CONNECTED) {delay(500);Serial.print(".");}Serial.println("");Serial.println("WiFi connected");startCameraServer();Serial.print("Camera Ready! Use 'http://");Serial.print(WiFi.localIP());Serial.println("' to connect");
}void loop() {// Do nothing. Everything is done in another task by the web serverdelay(10000);
}

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/45242.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/45242.shtml
英文地址,請注明出處:http://en.pswp.cn/web/45242.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

S7-200smart與C#通信

https://www.cnblogs.com/heizao/p/15797382.html C#與PLC通信開發之西門子s7-200 smart_c# s7-200smart通訊庫-CSDN博客https://blog.csdn.net/weixin_44455060/article/details/109713121 C#上位機讀寫西門子S7-200SMART PLC變量 教程_嗶哩嗶哩_bilibilihttps://www.bilibili…

清朝嘉慶二十五年(1820年)地圖數據

我們在《中國歷史行政區劃連續變化數據》一文中&#xff0c;為你分享了中國歷史行政區劃連續變化地圖數據。 現在再為你分享清朝嘉慶二十五年&#xff08;1820年&#xff09;的地圖數據&#xff0c;該數據對于研究歷史的朋友應該比較有用&#xff0c;請在文末查看領取方式。 …

【Rust練習】2.數值類型

練習題來自https://practice-zh.course.rs/basic-types/numbers.html 1 // 移除某個部分讓代碼工作 fn main() {let x: i32 5;let mut y: u32 5;y x;let z 10; // 這里 z 的類型是? }y的類型不對&#xff0c;另外&#xff0c;數字的默認類型是i32 fn main() {let x: i…

Jupyter Lab 使用

Jupyter Lab 使用詳解 Jupyter Lab 是一個基于 Web 的交互式開發環境&#xff0c;提供了比 Jupyter Notebook 更加靈活和強大的用戶界面和功能。以下是使用 Jupyter Lab 的詳細指南&#xff0c;包括安裝、基本使用、設置根目錄和擴展功能等內容。 一、Jupyter Lab 安裝與啟動…

HTTP背后的故事:理解現代網絡如何工作的關鍵(一)

一.HTTP是什么 概念 &#xff1a; 1.HTTP ( 全稱為 " 超文本傳輸協議 ") 是一種應用非常廣泛的 應用層協議。 2.HTTP 誕生與1991年. 目前已經發展為最主流使用的一種應用層協議. 3.HTTP 往往是基于傳輸層的 TCP 協議實現的 . (HTTP1.0, HTTP1.1, HTTP2.0 均為 T…

DelphiXE內存泄漏問題,已經發生了很多次

內存泄漏的地方一定要注意: 不斷分配的Tbytes會導致內存泄漏,發生以下錯誤: Access violation at address CA5ED400. Execution of address CA5ED400 {=====內存泄漏最大的地方、居然沒有釋放=====} //SetLength(tbuff,length(Adata)); //Move(Adata,Tbuff,length(…

2024世界人工智能大會(WAIC)學習總結

1 前言 在2024年的世界人工智能大會&#xff08;WAIC&#xff09;上&#xff0c;我們見證了從農業社會到工業社會再到數字化社會的深刻轉變。這一進程不僅體現在技術的單點爆發&#xff0c;更引發了整個產業鏈的全面突破&#xff0c;未來將是技術以指數級速度發展的嶄新時代。…

等保測評別犯難,黑龍江等保測評服務流程來啦!

引言 在當今數字化時代&#xff0c;網絡安全已經成為企業發展的基石。為了響應國家網絡安全等級保護&#xff08;簡稱“等保”&#xff09;政策&#xff0c;黑龍江地區的企業紛紛啟動了等保測評工作。然而&#xff0c;對于很多企業而言&#xff0c;等保測評似乎是一項既復雜又…

【從0到1進階Redis】主從復制 — 主從機宕機測試

上一篇&#xff1a;【從0到1進階Redis】主從復制 測試&#xff1a;主機斷開連接&#xff0c;從機依舊連接到主機的&#xff0c;但是沒有寫操作&#xff0c;這個時候&#xff0c;主機如果回來了&#xff0c;從機依舊可以直接獲取到主機寫的信息。 如果是使用命令行&#xff0c;來…

PyTorch深度學習實戰(46)——深度Q學習

PyTorch深度學習實戰&#xff08;46&#xff09;——深度Q學習 0. 前言1. 深度 Q 學習2. 網絡架構3. 實現深度 Q 學習模型進行 CartPole 游戲小結系列鏈接 0. 前言 我們已經學習了如何構建一個 Q 表&#xff0c;通過在多個 episode 中重復進行游戲獲取與給定狀態-動作組合相對…

Hypertable install of rhel6.0

1.rpm 安裝:(如果已存在,會提示沖突,使用--replacefiles) 1.1 編譯環境 安裝gcc gcc-c++ make cmake(在admin machine上,放置rpm包的文件里依次執行下面的語句): sudo rpm -ivh cpp-4.4.6-4.el6.x86_64.rpm --replacefiles sudo rpm -ivh libgcc-4.4.6-4.el6.x86_64.rp…

【學習筆記】無人機(UAV)在3GPP系統中的增強支持(十四)-無人機操控關鍵績效指標(KPI)框架

引言 本文是3GPP TR 22.829 V17.1.0技術報告&#xff0c;專注于無人機&#xff08;UAV&#xff09;在3GPP系統中的增強支持。文章提出了多個無人機應用場景&#xff0c;分析了相應的能力要求&#xff0c;并建議了新的服務級別要求和關鍵性能指標&#xff08;KPIs&#xff09;。…

第二證券:轉融通是什么意思?什么是轉融通?

轉融通&#xff0c;包含轉融資和轉融券&#xff0c;實質是借錢和借券。轉融通是指證券金融公司借入證券、籌得資金后&#xff0c;再轉借給證券公司&#xff0c;是一假貸聯絡&#xff0c;具體是指證券公司從符合要求的基金處理公司、保險公司、社保基金等組織出資者融券&#xf…

Python應用開發——30天學習Streamlit Python包進行APP的構建(15):優化性能并為應用程序添加狀態

Caching and state 優化性能并為應用程序添加狀態! Caching 緩存 Streamlit 為數據和全局資源提供了強大的緩存原語。即使從網絡加載數據、處理大型數據集或執行昂貴的計算,它們也能讓您的應用程序保持高性能。 本頁僅包含有關 st.cache_data API 的信息。如需深入了解緩…

技術成神之路:設計模式(六)策略模式

1.介紹 策略模式&#xff08;Strategy Pattern&#xff09;是一種行為型設計模式&#xff0c;它定義了一系列算法&#xff0c;封裝每一個算法&#xff0c;并使它們可以相互替換。策略模式使得算法的變化獨立于使用算法的客戶端。 2.主要作用 策略模式的主要作用是將算法或行為…

面試問題梳理:項目中防止配置中的密碼泄露-Jasypt

背景 想起面試的時候&#xff0c;面試官問我現在大家用Spring框架&#xff0c;數據庫、ES之類的密碼都是配置在配置文件中的&#xff0c;有很大的安全隱患&#xff0c;你有考慮過怎么解決嘛&#xff1f; 當時我回答是可以在項目啟動的過程中的命令行追加的方式&#xff0c;感覺…

Hello,World!(C++)

題目描述 編寫一個能夠輸出 Hello,World! 的程序。 提示&#xff1a; - 使用英文標點符號&#xff1b; Hello,World! 逗號后面沒有空格。 H 和 W 為大寫字母。 樣例 #1 樣例輸入 #1 無 樣例輸出 #1 Hello,World! &#xff08;1&#xff09; #include<bits/stdc.…

力扣題解( 讓字符串成為回文串的最少插入次數)

1312. 讓字符串成為回文串的最少插入次數 給你一個字符串 s &#xff0c;每一次操作你都可以在字符串的任意位置插入任意字符。 請你返回讓 s 成為回文串的 最少操作次數 。 「回文串」是正讀和反讀都相同的字符串。 思路&#xff1a; 本題要求的是最少插入次數&#xff0c;…

什么叫圖像的雙邊濾波,并附利用OpenCV和MATLB實現雙邊濾波的代碼

雙邊濾波&#xff08;Bilateral Filtering&#xff09;是一種在圖像處理中常用的非線性濾波技術&#xff0c;主要用于去噪和保邊。它在空間域和像素值域上同時進行加權&#xff0c;既考慮了像素之間的空間距離&#xff0c;也考慮了像素值之間的相似度&#xff0c;從而能夠有效地…

手機怎么看WiFi的IP地址

在如今數字化快速發展的時代&#xff0c;無線網絡已成為我們日常生活中不可或缺的一部分。無論是工作、學習還是娛樂&#xff0c;我們可能都離不開WiFi的陪伴。然而&#xff0c;在使用WiFi的過程中&#xff0c;有時我們可能需要查看其IP地址&#xff0c;以便更好地管理我們的網…