<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linux &#8211; Antonio</title>
	<atom:link href="/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>https://nstar.ltd</link>
	<description></description>
	<lastBuildDate>Fri, 04 Jul 2025 16:58:58 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>WEB服务器、图床、FRP内穿——大成！</title>
		<link>/web%e6%9c%8d%e5%8a%a1%e5%99%a8%e3%80%81%e5%9b%be%e5%ba%8a%e3%80%81frp%e5%86%85%e7%a9%bf-%e5%a4%a7%e6%88%90%ef%bc%81/</link>
					<comments>/web%e6%9c%8d%e5%8a%a1%e5%99%a8%e3%80%81%e5%9b%be%e5%ba%8a%e3%80%81frp%e5%86%85%e7%a9%bf-%e5%a4%a7%e6%88%90%ef%bc%81/#respond</comments>
		
		<dc:creator><![CDATA[Antonio]]></dc:creator>
		<pubDate>Wed, 12 Mar 2025 20:02:29 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[博客]]></category>
		<guid isPermaLink="false">http://antonioz.asia/?p=173</guid>

					<description><![CDATA[历经两天，终于完成了WEB服务器应用，它终究成为了我满意的样子👍👍👍。 时间线 小插曲： 插曲虽小，耗时不少。 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>历经两天，终于完成了WEB服务器应用，它终究成为了我满意的样子<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f44d.png" alt="👍" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f44d.png" alt="👍" class="wp-smiley" style="height: 1em; max-height: 1em;" /><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f44d.png" alt="👍" class="wp-smiley" style="height: 1em; max-height: 1em;" />。</p>



<h3 class="wp-block-heading">时间线</h3>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<ul class="wp-block-list">
<li>Orangepi zero2W wordpress部署，感慨加载速度极慢——弃用</li>



<li>原内网穿透方案不适用，花生壳不让白嫖了，开始在<mark data-darkreader-inline-bgcolor="" style="background-color: rgba(0, 0, 0, 0); --darkreader-inline-bgcolor: var(--darkreader-background-00000000, rgba(0, 0, 0, 0));" class="has-inline-color has-luminous-vivid-amber-color">免费方案</mark>的域名访问界面加入<strong><em><mark data-darkreader-inline-bgcolor="" style="background-color: rgba(0, 0, 0, 0); --darkreader-inline-bgcolor: var(--darkreader-background-00000000, rgba(0, 0, 0, 0));" class="has-inline-color has-luminous-vivid-orange-color">跳转广告</mark></em></strong>了，等待10s极慢——弃用</li>



<li>从香橙派迁移Wordpress至NAS中
<ul class="wp-block-list">
<li>部分备份、迁移插件真不好用哈，还收费<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f926-200d-2642-fe0f.png" alt="🤦‍♂️" class="wp-smiley" style="height: 1em; max-height: 1em;" />，推荐——<strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-pale-cyan-blue-color">WPvivid备份插件</mark></strong></li>
</ul>
</li>



<li>寻找内网穿透替代方案
<ul class="wp-block-list">
<li>购买阿里云轻量级服务器（68一年！）</li>



<li>选择宝塔实例，安装FRP服务（FRPS服务端）——内网穿透方案</li>



<li>NAS安装mysql（Docker）</li>



<li>NAS部署FRPC客户端（Docker）</li>



<li>实现NAS IP内网穿透</li>
</ul>
</li>



<li>思考良久，还是直接在云服务器部署Wordpress更方便，宝塔一键部署Wordpress！</li>



<li>将已经购买一直未使用的域名进行ICP备案（不到12小时就完成了，工信部好评！）</li>



<li>WordPress媒体库一般，图片不好管理，于是——开干！
<ul class="wp-block-list">
<li>NAS上装了一个chevereto图床，上传壁纸、图片</li>



<li>NAS内穿后的访问效率还是有点低，给的公网服务器带宽不太够<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f605.png" alt="😅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></li>



<li>算了，云服务也装一个吧</li>



<li>提示：chevereto图床上传最大2M——更改php.ini可以设置上传文件最大内存</li>
</ul>
</li>



<li>主题不好看？推荐Argon，美化一下效果旧很OK了，没那么多花里胡哨的东西。</li>
</ul>



<ul class="wp-block-list">
<li>准备进行网站公安局备案&#8230;（待进行） 2025/3/13</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">小插曲：</h3>



<p>插曲虽小，耗时不少。（差不多一半时间花这儿了）</p>



<p>偶然看到Hexo方案的开源主题精美<a href="https://github.com/theme-shoka-x/hexo-theme-shokaX" data-type="link" data-id="https://github.com/theme-shoka-x/hexo-theme-shokaX">（<em>shokax二次元</em>）</a>，遂考虑替换Wordpress方案，结果就是一系列bug，修bug。（吐槽一句，npm真难用，比apt、pnmp、yarn等包管理器难用多了）</p>



<p>终于完成的时候，发现shokax不太适合我这类懒人，很多功能、CCS效果等都需要自己改代码    <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f62b.png" alt="😫" class="wp-smiley" style="height: 1em; max-height: 1em;" />！</p>



<p>于是——弃用！</p>
]]></content:encoded>
					
					<wfw:commentRss>/web%e6%9c%8d%e5%8a%a1%e5%99%a8%e3%80%81%e5%9b%be%e5%ba%8a%e3%80%81frp%e5%86%85%e7%a9%bf-%e5%a4%a7%e6%88%90%ef%bc%81/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Openmediavault-树莓派4B</title>
		<link>/openmediavault-%e6%a0%91%e8%8e%93%e6%b4%be4b/</link>
					<comments>/openmediavault-%e6%a0%91%e8%8e%93%e6%b4%be4b/#respond</comments>
		
		<dc:creator><![CDATA[Antonio]]></dc:creator>
		<pubDate>Fri, 06 Dec 2024 15:04:18 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[博客]]></category>
		<guid isPermaLink="false">http://192.168.31.64/?p=154</guid>

					<description><![CDATA[树莓派4B NAS Jellyfin SMB文件服务器：]]></description>
										<content:encoded><![CDATA[
<h1 class="wp-block-heading">树莓派4B NAS Jellyfin</h1>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>不要让你的树莓派吃灰啦，搭一个简易NAS、文件服务器，让你的文件处理更加丝滑吧！ </p>



<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>



<p>基于树莓派stable lite系统搭建的OMV系统：</p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1918" height="956" data-id="136" src="/wp-content/uploads/2024/12/屏幕截图-2024-12-06-223154.png" alt="" class="wp-image-136"/></figure>
</figure>



<p></p>



<p>家庭多媒体影院 Jellyfin：</p>
</blockquote>



<figure class="wp-block-image size-full"><img decoding="async" width="1916" height="953" src="/wp-content/uploads/2024/12/屏幕截图-2024-12-06-223505.png" alt="" class="wp-image-138"/></figure>



<p></p>



<p>SMB文件服务器：</p>



<ul class="wp-block-list">
<li>手机端可直接下载CX文件处理器 通过SMB协议访问</li>



<li>PC端可直接通过windows文件管理器 网络 访问</li>
</ul>



<pre class="wp-block-code"><code>\\主机名.域名\共享文件夹名\
\\IP地址\共享文件夹名\</code></pre>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img decoding="async" width="690" height="440" data-id="139" src="/wp-content/uploads/2024/12/屏幕截图-2024-12-06-223732.png" alt="" class="wp-image-139"/></figure>
</figure>
]]></content:encoded>
					
					<wfw:commentRss>/openmediavault-%e6%a0%91%e8%8e%93%e6%b4%be4b/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>树莓派平台-OpenCV</title>
		<link>/%e6%a0%91%e8%8e%93%e6%b4%be%e5%b9%b3%e5%8f%b0-opencv/</link>
					<comments>/%e6%a0%91%e8%8e%93%e6%b4%be%e5%b9%b3%e5%8f%b0-opencv/#respond</comments>
		
		<dc:creator><![CDATA[Antonio]]></dc:creator>
		<pubDate>Mon, 09 Sep 2024 20:23:10 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[电子设计]]></category>
		<guid isPermaLink="false">http://192.168.31.64/?p=105</guid>

					<description><![CDATA[人脸检测 由于树莓派系统更新后，官方不再提供camera驱动，而是使用Linux平台libcamera替代，且 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">人脸检测</h2>



<pre class="wp-block-code"><code>运行于Windows11平台：
    import cv2
    import time

    # 加载人脸检测的 Haar 特征分类器
    face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml')

    # 打开摄像头
    cap = cv2.VideoCapture(0)

    # 获取摄像头分辨率
    frame_width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
    frame_height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
    print(f"当前分辨率: {frame_width}x{frame_height}")

    # 初始化帧率计算
    fps = 0
    prev_time = time.time()

    while True:
        # 读取摄像头画面
        ret, frame = cap.read()
        if not ret:
            break

        # 将图像转换为灰度图
        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

        # 检测人脸
        faces = face_cascade.detectMultiScale(gray, scaleFactor=1.1, minNeighbors=5)

        # 在检测到的人脸周围绘制矩形框
        for (x, y, w, h) in faces:
            cv2.rectangle(frame, (x, y), (x + w, y + h), (255, 0, 0), 2)

        # 计算并显示帧率
        current_time = time.time()
        fps = 1 / (current_time - prev_time)
        prev_time = current_time
        cv2.putText(frame, f'FPS: {int(fps)}', (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)

        # 显示结果
        cv2.imshow('Face Detection', frame)

        # 按 'q' 键退出
        if cv2.waitKey(1) &amp; 0xFF == ord('q'):
            break

    # 释放摄像头并关闭窗口
    cap.release()
    cv2.destroyAllWindows()
</code></pre>



<p>由于树莓派系统更新后，官方不再提供camera驱动，而是使用Linux平台libcamera替代，且OpenCV部分还未能适配libcamera库，则不能使用常规的cv2.Capture(0)开启摄像头。</p>



<p>采用libcamera搭配cv2库替代：</p>



<pre class="wp-block-code"><code></code></pre>



<h2 class="wp-block-heading">目标跟踪&amp;距离估算</h2>



<p>单目摄像头需要根据已知实际物体大小来估算具体位置，如估算脸宽0.15m，camera视角范围62.2°（实际应该是160°，但经过裁剪，故估算62.2°左右）</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1285" height="964" src="/wp-content/uploads/2024/09/face_tracking.png" alt="" class="wp-image-107"/></figure>



<p>帧率属实堪忧<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f605.png" alt="😅" class="wp-smiley" style="height: 1em; max-height: 1em;" />。</p>



<pre class="wp-block-code"><code>import math
import cv2
import time
from picamera2 import Picamera2

# Set known parameters
W = 0.15  # Actual face width (in meters)
FOV_x = 62.2  # Horizontal field of view (in degrees)
image_width = 640  # Image width (in pixels)

# Initialize the camera
picam2 = Picamera2()
picam2.configure(picam2.create_preview_configuration(main={"size": (image_width, 480)}))
picam2.start()

# Load the Haar Cascade for face detection
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')

# Initialize variables for FPS calculation
prev_time = time.time()
fps = 0

while True:
    # Capture the frame
    frame = picam2.capture_array()
    
    # Fix BGR to RGB color inversion
    frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
    
    gray = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
    faces = face_cascade.detectMultiScale(gray, scaleFactor=1.1, minNeighbors=5, minSize=(30, 30))

    # Calculate the focal length
    FOV_x_rad = math.radians(FOV_x)
    focal_length = (image_width / 2) / math.tan(FOV_x_rad / 2)

    for (x, y, w, h) in faces:
        face_width = w
        # Estimate the distance
        distance = (focal_length * W) / face_width

        # Draw the detected face and display the distance
        cv2.rectangle(frame, (x, y), (x+w, y+h), (255, 0, 0), 2)
        cv2.putText(frame, f"Distance: {distance:.2f} m", (x, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2)

    # Calculate and display FPS
    current_time = time.time()
    fps = 1 / (current_time - prev_time)
    prev_time = current_time
    cv2.putText(frame, f"FPS: {fps:.2f}", (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2)

    # Display resolution
    resolution_text = f"Resolution: {frame.shape&#91;1]}x{frame.shape&#91;0]}"
    cv2.putText(frame, resolution_text, (10, 60), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2)

    # Show the camera feed
    cv2.imshow("Camera", frame)

    # Break the loop if 'q' is pressed
    if cv2.waitKey(1) &amp; 0xFF == ord('q'):
        break

# Cleanup
cv2.destroyAllWindows()
picam2.stop()
</code></pre>



<h2 class="wp-block-heading">帧率优化：</h2>



<p>使用树莓派官方提供的Linux raspberry OS使用OpenCV人脸检测仅仅达到3帧左右，帧率堪忧，还有很多需要优化的地方</p>
]]></content:encoded>
					
					<wfw:commentRss>/%e6%a0%91%e8%8e%93%e6%b4%be%e5%b9%b3%e5%8f%b0-opencv/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
