Compare commits

..

2 Commits

4 changed files with 144 additions and 182 deletions

246
package-lock.json generated
View File

@@ -8,11 +8,11 @@
"name": "hexo-site",
"version": "0.0.0",
"dependencies": {
"axios": "^1.13.5",
"axios": "^1.13.6",
"cheerio": "^1.2.0",
"hexo": "^8.1.1",
"hexo-abbrlink": "^2.2.1",
"hexo-ai-summary-liushen": "^1.3.1",
"hexo-ai-summary-liushen": "^1.4.0",
"hexo-butterfly-swiper-lyx": "^1.0.2",
"hexo-deployer-git": "^4.0.0",
"hexo-douban": "^2.3.6",
@@ -30,14 +30,14 @@
"hexo-renderer-marked": "^7.0.1",
"hexo-renderer-pug": "^3.0.0",
"hexo-renderer-stylus": "^3.0.1",
"hexo-safego": "^2.2.2",
"hexo-safego": "^2.3.0",
"hexo-server": "^3.0.0",
"hexo-spoiler": "^1.7.4",
"hexo-wordcount": "^6.0.1",
"moment": "^2.30.1",
"node-fetch": "^3.3.2",
"p-limit": "^7.3.0",
"typesense": "^3.0.1",
"typesense": "^3.0.3",
"vite-plugin-require-transform": "^1.0.21",
"xml2js": "^0.6.2"
}
@@ -119,9 +119,9 @@
}
},
"node_modules/@babel/parser": {
"version": "7.29.0",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.0.tgz",
"integrity": "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww==",
"version": "7.29.2",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.2.tgz",
"integrity": "sha512-4GgRzy/+fsBa72/RZVJmGKPmZu9Byn8o4MoLpmNe1m8ZfYnz5emHLQz3U4gLud6Zwl0RZIcgiLD7Uq7ySFuDLA==",
"license": "MIT",
"dependencies": {
"@babel/types": "^7.29.0"
@@ -134,9 +134,9 @@
}
},
"node_modules/@babel/runtime": {
"version": "7.28.6",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.6.tgz",
"integrity": "sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA==",
"version": "7.29.2",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.2.tgz",
"integrity": "sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g==",
"license": "MIT",
"engines": {
"node": ">=6.9.0"
@@ -654,18 +654,27 @@
}
},
"node_modules/chokidar": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
"integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
"license": "MIT",
"dependencies": {
"readdirp": "^4.0.1"
"anymatch": "~3.1.2",
"braces": "~3.0.2",
"glob-parent": "~5.1.2",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.6.0"
},
"engines": {
"node": ">= 14.16.0"
"node": ">= 8.10.0"
},
"funding": {
"url": "https://paulmillr.com/funding/"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/combined-stream": {
@@ -1149,9 +1158,9 @@
"license": "MIT"
},
"node_modules/fast-xml-builder": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.1.3.tgz",
"integrity": "sha512-1o60KoFw2+LWKQu3IdcfcFlGTW4dpqEWmjhYec6H82AYZU2TVBXep6tMl8Z1Y+wM+ZrzCwe3BZ9Vyd9N2rIvmg==",
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.1.4.tgz",
"integrity": "sha512-f2jhpN4Eccy0/Uz9csxh3Nu6q4ErKxf0XIsasomfOihuSUa3/xw6w8dnOtCDgEItQFJG8KyXPzQXzcODDrrbOg==",
"funding": [
{
"type": "github",
@@ -1164,9 +1173,9 @@
}
},
"node_modules/fast-xml-parser": {
"version": "5.5.5",
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.5.5.tgz",
"integrity": "sha512-NLY+V5NNbdmiEszx9n14mZBseJTC50bRq1VHsaxOmR72JDuZt+5J1Co+dC/4JPnyq+WrIHNM69r0sqf7BMb3Mg==",
"version": "5.5.6",
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.5.6.tgz",
"integrity": "sha512-3+fdZyBRVg29n4rXP0joHthhcHdPUHaIC16cuyyd1iLsuaO6Vea36MPrxgAzbZna8lhvZeRL8Bc9GP56/J9xEw==",
"funding": [
{
"type": "github",
@@ -1175,7 +1184,7 @@
],
"license": "MIT",
"dependencies": {
"fast-xml-builder": "^1.1.3",
"fast-xml-builder": "^1.1.4",
"path-expression-matcher": "^1.1.3",
"strnum": "^2.1.2"
},
@@ -1562,30 +1571,6 @@
"sprintf-js": "~1.0.2"
}
},
"node_modules/hexo-abbrlink/node_modules/chokidar": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
"license": "MIT",
"dependencies": {
"anymatch": "~3.1.2",
"braces": "~3.0.2",
"glob-parent": "~5.1.2",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.6.0"
},
"engines": {
"node": ">= 8.10.0"
},
"funding": {
"url": "https://paulmillr.com/funding/"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/hexo-abbrlink/node_modules/dom-serializer": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz",
@@ -1728,18 +1713,6 @@
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/hexo-abbrlink/node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"license": "MIT",
"dependencies": {
"picomatch": "^2.2.1"
},
"engines": {
"node": ">=8.10.0"
}
},
"node_modules/hexo-abbrlink/node_modules/sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
@@ -1853,30 +1826,6 @@
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
}
},
"node_modules/hexo-cli/node_modules/chokidar": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
"license": "MIT",
"dependencies": {
"anymatch": "~3.1.2",
"braces": "~3.0.2",
"glob-parent": "~5.1.2",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.6.0"
},
"engines": {
"node": ">= 8.10.0"
},
"funding": {
"url": "https://paulmillr.com/funding/"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/hexo-cli/node_modules/hexo-fs": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/hexo-fs/-/hexo-fs-4.1.3.tgz",
@@ -1930,18 +1879,6 @@
"entities": "^4.5.0"
}
},
"node_modules/hexo-cli/node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"license": "MIT",
"dependencies": {
"picomatch": "^2.2.1"
},
"engines": {
"node": ">=8.10.0"
}
},
"node_modules/hexo-deployer-git": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/hexo-deployer-git/-/hexo-deployer-git-4.0.0.tgz",
@@ -1959,30 +1896,6 @@
"node": ">=14"
}
},
"node_modules/hexo-deployer-git/node_modules/chokidar": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
"license": "MIT",
"dependencies": {
"anymatch": "~3.1.2",
"braces": "~3.0.2",
"glob-parent": "~5.1.2",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.6.0"
},
"engines": {
"node": ">= 8.10.0"
},
"funding": {
"url": "https://paulmillr.com/funding/"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/hexo-deployer-git/node_modules/dom-serializer": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz",
@@ -2193,18 +2106,6 @@
"entities": "^3.0.1"
}
},
"node_modules/hexo-deployer-git/node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"license": "MIT",
"dependencies": {
"picomatch": "^2.2.1"
},
"engines": {
"node": ">=8.10.0"
}
},
"node_modules/hexo-douban": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/hexo-douban/-/hexo-douban-2.3.6.tgz",
@@ -2219,30 +2120,6 @@
"node": ">= 18"
}
},
"node_modules/hexo-douban/node_modules/chokidar": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
"integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
"license": "MIT",
"dependencies": {
"anymatch": "~3.1.2",
"braces": "~3.0.2",
"glob-parent": "~5.1.2",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.6.0"
},
"engines": {
"node": ">= 8.10.0"
},
"funding": {
"url": "https://paulmillr.com/funding/"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/hexo-douban/node_modules/dom-serializer": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz",
@@ -2372,18 +2249,6 @@
"entities": "^3.0.1"
}
},
"node_modules/hexo-douban/node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"license": "MIT",
"dependencies": {
"picomatch": "^2.2.1"
},
"engines": {
"node": ">=8.10.0"
}
},
"node_modules/hexo-filter-mathjax": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/hexo-filter-mathjax/-/hexo-filter-mathjax-0.9.1.tgz",
@@ -2420,6 +2285,21 @@
"node": ">=18"
}
},
"node_modules/hexo-fs/node_modules/chokidar": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
"integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
"license": "MIT",
"dependencies": {
"readdirp": "^4.0.1"
},
"engines": {
"node": ">= 14.16.0"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/hexo-fs/node_modules/hexo-util": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/hexo-util/-/hexo-util-3.3.0.tgz",
@@ -2458,6 +2338,19 @@
"entities": "^4.5.0"
}
},
"node_modules/hexo-fs/node_modules/readdirp": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
"integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
"license": "MIT",
"engines": {
"node": ">= 14.18.0"
},
"funding": {
"type": "individual",
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/hexo-generator-archive": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/hexo-generator-archive/-/hexo-generator-archive-2.0.0.tgz",
@@ -4138,16 +4031,15 @@
}
},
"node_modules/readdirp": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
"integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"license": "MIT",
"engines": {
"node": ">= 14.18.0"
"dependencies": {
"picomatch": "^2.2.1"
},
"funding": {
"type": "individual",
"url": "https://paulmillr.com/funding/"
"engines": {
"node": ">=8.10.0"
}
},
"node_modules/resolve": {
@@ -4636,9 +4528,9 @@
}
},
"node_modules/undici": {
"version": "7.24.3",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.24.3.tgz",
"integrity": "sha512-eJdUmK/Wrx2d+mnWWmwwLRyA7OQCkLap60sk3dOK4ViZR7DKwwptwuIvFBg2HaiP9ESaEdhtpSymQPvytpmkCA==",
"version": "7.24.4",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.24.4.tgz",
"integrity": "sha512-BM/JzwwaRXxrLdElV2Uo6cTLEjhSb3WXboncJamZ15NgUURmvlXvxa6xkwIOILIjPNo9i8ku136ZvWV0Uly8+w==",
"license": "MIT",
"engines": {
"node": ">=20.18.1"

View File

@@ -12,11 +12,11 @@
"version": "8.1.1"
},
"dependencies": {
"axios": "^1.13.5",
"axios": "^1.13.6",
"cheerio": "^1.2.0",
"hexo": "^8.1.1",
"hexo-abbrlink": "^2.2.1",
"hexo-ai-summary-liushen": "^1.3.1",
"hexo-ai-summary-liushen": "^1.4.0",
"hexo-butterfly-swiper-lyx": "^1.0.2",
"hexo-deployer-git": "^4.0.0",
"hexo-douban": "^2.3.6",
@@ -34,14 +34,14 @@
"hexo-renderer-marked": "^7.0.1",
"hexo-renderer-pug": "^3.0.0",
"hexo-renderer-stylus": "^3.0.1",
"hexo-safego": "^2.2.2",
"hexo-safego": "^2.3.0",
"hexo-server": "^3.0.0",
"hexo-spoiler": "^1.7.4",
"hexo-wordcount": "^6.0.1",
"moment": "^2.30.1",
"node-fetch": "^3.3.2",
"p-limit": "^7.3.0",
"typesense": "^3.0.1",
"typesense": "^3.0.3",
"vite-plugin-require-transform": "^1.0.21",
"xml2js": "^0.6.2"
}

View File

@@ -1,5 +1,5 @@
---
title: opencv基础操作
title: opencv应用-基础操作
categories:
- 技术
series: opencv

View File

@@ -0,0 +1,70 @@
---
title: opencv应用-算术运算
categories:
- 技术
series: opencv
tags:
- opencv
abbrlink: b559997d
summary: >-
这篇文章介绍了如何使用OpenCV进行图像的加法运算。首先通过包含OpenCV和iostream头文件并使用std命名空间开始编写代码。主函数中读取两张图片检查是否成功加载并确保它们的尺寸相同。如果尺寸不同将第二张图片调整为与第一张相同的大小。然后调用add函数对两幅图片进行加法运算并将结果存储在result矩阵中。最后显示原始图片和加法运算的结果并等待按键关闭窗口。代码已上传至自建的git仓库。
date: 2026-03-17 13:13:08
---
opencv对图像的算数运算感觉都大同小异分为以下几种加减乘除和位运算。
| 函数 | 功能 | 应用场景 |
|-------------------|--------|------------|
| cv2.bitwise_and() | 按位与操作 | 掩码操作、图像分割 |
| cv2.bitwise_or() | 按位或操作 | 图像叠加 |
| cv2.bitwise_not() | 按位取反操作 | 图像反色 |
| cv2.bitwise_xor() | 按位异或操作 | 图像差异检测 |
因为感觉都差不多,所以只把加法运算代码搬过来
```cpp
// 加法
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace std;
using namespace cv;
int main()
{
string path1 = "../img/2.jpg";
string path2 = "../img/3.jpg";
Mat img1 = imread(path1);
Mat img2 = imread(path2);
if (img1.empty() || img2.empty())
{
cout << "无法读取图片,请检查路径!" << endl;
return -1;
}
if (img1.size() != img2.size())
{
cout << "尺寸不一致,正在自动调整 img2 的尺寸..." << endl;
// 将 img2 缩放到与 img1 相同的尺寸
resize(img2, img2, img1.size());
}
Mat result;
add(img1, img2, result);
imshow("Original Image 1", img1);
imshow("Original Image 2", img2);
imshow("Add Result", result);
// 等待按键后关闭窗口
waitKey(0);
destroyAllWindows();
return 0;
}
```
另外把代码上传到了自建的git中
{% link opencv-learning,opencv-learning,https://git.biss.click/biss/opencv-learning/src/branch/master/Arithmetic%20operations %}