《数字图像处理(MATLAB版)》相关算法代码及其分析(2)

目录

1 将8连通边界转换为4连通边界

1.1 移除对角线转折

1.2 插入额外像素

2 将边界信息转换为二进制图像

2.1 函数定义

2.2 参数处理和验证

2.3 默认大小参数设置

2.4 根据参数调整边界位置

2.5 生成二进制图像

2.6 错误处理

3 对二值图像边界的跟踪和提取

3.1 函数描述

3.2 参数处理

3.3 对象标记

3.4 图像填充

3.5 边界跟踪

3.6 边界坐标存储

3.7 结果修正

3.8 结果输出


1 将8连通边界转换为4连通边界

function rc_new = bound2four(rc)
%BOUND2FOUR Convert 8-connected boundary to 4-connected boundary.
%   RC_NEW = BOUND2FOUR(RC) converts an eight-connected boundary to a
%   four-connected boundary.  RC is a P-by-2 matrix, each row of
%   which contains the row and column coordinates of a boundary
%   pixel.  BOUND2FOUR inserts new boundary pixels wherever there is
%   a diagonal connection.

%   Copyright 2002-2004 R. C. Gonzalez, R. E. Woods, & S. L. Eddins
%   Digital Image Processing Using MATLAB, Prentice-Hall, 2004
%   $Revision: 1.4 $  $Date: 2003/11/21 14:20:21 $

if size(rc, 1) > 1
   % Phase 1: remove diagonal turns, one at a time until they are all gone.
   done = 0;
   rc1 = [rc(end - 1, :); rc];
   while ~done
      d = diff(rc1, 1);
      diagonal_locations = all(d, 2);
      double_diagonals = diagonal_locations(1:end - 1) & ...
          (diff(diagonal_locations, 1) == 0);
      double_diagonal_idx = find(double_diagonals);
      turns = any(d(double_diagonal_idx, :) ~= ...
                  d(double_diagonal_idx + 1, :), 2);
      turns_idx = double_diagonal_idx(turns);
      if isempty(turns_idx)
         done = 1;
      else
         first_turn = turns_idx(1);
         rc1(first_turn + 1, :) = (rc1(first_turn, :) + ...
                                   rc1(first_turn + 2, :)) / 2;
         if first_turn == 1
            rc1(end, :) = rc1(2, :);
         end
      end
   end
   rc1 = rc1(2:end, :);
end

% Phase 2: insert extra pixels where there are diagonal connections.

rowdiff = diff(rc1(:, 1));
coldiff = diff(rc1(:, 2));

diagonal_locations = rowdiff & coldiff;
num_old_pixels = size(rc1, 1);
num_new_pixels = num_old_pixels + sum(diagonal_locations);
rc_new = zeros(num_new_pixels, 2);

% Insert the original values into the proper locations in the new RC
% matrix.
idx = (1:num_old_pixels)' + [0; cumsum(diagonal_locations)];
rc_new(idx, :) = rc1;

% Compute the new pixels to be inserted.
new_pixel_offsets = [0 1; -1 0; 1 0; 0 -1];
offset_codes = 2 * (1 - (coldiff(diagonal_locations) + 1)/2) + ...
    (2 - (rowdiff(diagonal_locations) + 1)/2);
new_pixels = rc1(diagonal_locations, :) + ...
    new_pixel_offsets(offset_codes, :); 

% Where do the new pixels go?
insertion_locations = zeros(num_new_pixels, 1);
insertion_locations(idx) = 1;
insertion_locations = ~insertion_locations;

% Insert the new pixels.
rc_new(insertion_locations, :) = new_pixels;

这段代码的目的是将一个8连通边界转换为4连通边界。在数字图像处理中,连通性是衡量像素之间关系的一种方式。8连通边界意味着边界上的每个像素与其周围的8个像素(水平、垂直和对角线方向)都可能相连。而4连通边界则仅考虑水平和垂直方向的相邻像素。该转换过程涉及两个阶段:首先是移除所有对角线转折点,然后是在需要的位置插入额外的像素以确保4连通性。

以下是对代码的详细分析:

1.1 移除对角线转折

  1. 初始化:复制输入的边界坐标rcrc1并在rc1的开头添加rc的倒数第二行。这样做是为了处理循环边界条件。

  2. 循环处理:通过计算rc1的差分d,找出所有对角线连接的位置。这里,对角线连接是指在两个方向(行和列)上都有变化的连接。

  3. 双重对角线和转折点检测:接下来,识别连续的对角线连接(双重对角线)并找出其中的转折点。转折点是指相邻的对角线连接在方向上有所不同的地方。

  4. 处理转折点:对于每个找到的转折点,通过在转折点位置插入一个新的像素(这个像素的坐标是转折点前后两个像素坐标的平均值)来移除转折。如果处理的是第一个转折点,还需要更新rc1的最后一行,以保持边界的闭合性。

  5. 循环结束条件:当没有更多转折点可以处理时,结束循环。

1.2 插入额外像素

  1. 计算差分:计算rc1中行和列的差分,以找出对角线连接的位置。

  2. 确定新像素数量和位置:根据对角线连接的数量,计算新的边界坐标矩阵rc_new的大小,并初始化为零矩阵。然后,计算原始像素和新插入像素在rc_new中的正确位置。

  3. 计算新像素坐标:对于每个需要插入的新像素,根据其相对于原始对角线连接的位置,计算新像素的坐标。

  4. 插入操作:在rc_new中填充原始像素和新计算的像素,完成4连通边界的构建。

2 将边界信息转换为二进制图像

function B = bound2im(b, M, N, x0, y0)
%BOUND2IM Converts a boundary to an image.
%   B = BOUND2IM(b) converts b, an np-by-2 or 2-by-np array
%   representing the integer coordinates of a boundary, into a binary
%   image with 1s in the locations defined by the coordinates in b
%   and 0s elsewhere. 
%
%   B = BOUND2IM(b, M, N) places the boundary approximately centered
%   in an M-by-N image. If any part of the boundary is outside the
%   M-by-N rectangle, an error is issued.  
%
%   B = BOUND2IM(b, M, N, X0, Y0) places the boundary in an image of
%   size M-by-N, with the topmost boundary point located at X0 and
%   the leftmost point located at Y0. If the shifted boundary is
%   outside the M-by-N rectangle, an error is issued. XO and X0 must
%   be positive integers. 

%   Copyright 2002-2004 R. C. Gonzalez, R. E. Woods, & S. L. Eddins
%   Digital Image Processing Using MATLAB, Prentice-Hall, 2004
%   $Revision: 1.6 $  $Date: 2003/06/14 16:21:28 $

[np, nc] = size(b);
if np < nc
   b = b'; % To convert to size np-by-2.
   [np, nc] = size(b);
end

% Make sure the coordinates are integers.
x = round(b(:, 1)); 
y = round(b(:, 2));

% Set up the default size parameters. 
x = x - min(x) + 1;
y = y - min(y) + 1;
B = false(max(x), max(y));
C = max(x) - min(x) + 1;
D = max(y) - min(y) + 1;

if nargin == 1  
   % Use the preceding default values.
elseif nargin == 3
   if C > M | D > N
      error('The boundary is outside the M-by-N region.')
   end
   % The image size will be M-by-N. Set up the parameters for this.
   B = false(M, N);
   % Distribute extra rows approx. even between top and bottom.
   NR = round((M - C)/2); 
   NC = round((N - D)/2); % The same for columns.
   x = x + NR; % Offset the boundary to new position.
   y = y + NC;  
elseif nargin == 5
   if x0 < 0 | y0 < 0
      error('x0 and y0 must be positive integers.')
   end
   x = x + round(x0) - 1;
   y = y + round(y0) - 1;
   C = C + x0 - 1;
   D = D + y0 - 1;
   if C > M | D > N
      error('The shifted boundary is outside the M-by-N region.')
   end
   B = false(M, N);
else
   error('Incorrect number of inputs.') 
end

B(sub2ind(size(B), x, y)) = true;

这段代码定义了一个名为 bound2im 的函数,它的主要作用是将一个边界(由一系列坐标点组成)转换成一个二进制图像。在这个二进制图像中,边界上的点被标记为 1,其他位置则为 0。

以下是对代码的详细分析:

2.1 函数定义

function B = bound2im(b, M, N, x0, y0)

这表示 bound2im 是一个函数,它可以接收从1到5个参数:

  • b:一个 np-by-2 或 2-by-np 的数组,代表边界的整数坐标。
  • M 和 N(可选):指定输出图像的大小(行数和列数)。
  • x0 和 y0(可选):指定边界在图像中的起始位置。

函数返回一个二进制图像 B

2.2 参数处理和验证

首先,函数检查输入边界 b 的尺寸,并确保其为 np-by-2 的格式。如果不是,就将其转置。这样做是为了确保后续操作中坐标的使用是正确的。

接着,函数通过取整操作确保坐标都是整数值,因为图像中的位置索引必须是整数。

2.3 默认大小参数设置

如果没有指定图像的大小(即只传入了 b 参数),函数会根据边界的最小和最大坐标计算出一个默认的图像大小。这样做的目的是让整个边界都能够被包含在生成的图像中。

2.4 根据参数调整边界位置

  • 如果只给出了边界 b,那么函数会创建一个足够大的图像来容纳整个边界,并将边界放在图像的左上角。
  • 如果给出了图像大小 M 和 N,但没有指定边界的起始位置,那么边界会被置于图像的大致中心位置。此时,如果边界超出了指定的图像大小,函数会报错。
  • 如果同时给出了图像大小和边界的起始位置 x0 和 y0,边界会根据这些位置进行偏移。同样,如果偏移后的边界超出了图像大小,函数也会报错。

2.5 生成二进制图像

最后,函数使用 false 初始化一个大小为 M-by-N 的二进制图像矩阵 B,然后根据调整后的边界坐标,在相应的位置将 B 中的值设置为 true,从而生成最终的边界图像。

2.6 错误处理

  • 如果 nargin(传入的参数数量)不符合要求,函数会报告“Incorrect number of inputs”错误。
  • 如果边界超出了指定的图像区域,或者 x0y0 不是正整数,函数同样会报错。

3 对二值图像边界的跟踪和提取

function B = boundaries(BW, conn, dir)
%BOUNDARIES Trace object boundaries.  
%   B = BOUNDARIES(BW) traces the exterior boundaries of objects in
%   the binary image BW.  B is a P-by-1 cell array, where P is the
%   number of objects in the image. Each cell contains a Q-by-2
%   matrix, each row of which contains the row and column coordinates
%   of a boundary pixel.  Q is the number of boundary pixels for the
%   corresponding object.  Object boundaries are traced in the
%   clockwise direction.
%
%   B = BOUNDARIES(BW, CONN) specifies the connectivity to use when
%   tracing boundaries.  CONN may be either 8 or 4.  The default
%   value for CONN is 8.
%
%   B = BOUNDARIES(BW, CONN, DIR) specifies the direction used for
%   tracing boundaries.  DIR should be either 'cw' (trace boundaries
%   clockwise) or 'ccw' (trace boundaries counterclockwise).  If DIR
%   is omitted BOUNDARIES traces in the clockwise direction.

%   Copyright 2002-2004 R. C. Gonzalez, R. E. Woods, & S. L. Eddins
%   Digital Image Processing Using MATLAB, Prentice-Hall, 2004
%   $Revision: 1.6 $  $Date: 2003/11/21 14:22:07 $

if nargin < 3
   dir = 'cw';
end

if nargin < 2
   conn = 8;
end

L = bwlabel(BW, conn);

% The number of objects is the maximum value of L.  Initialize the
% cell array B so that each cell initially contains a 0-by-2 matrix.
numObjects = max(L(:));
if numObjects > 0
   B = {zeros(0, 2)};
   B = repmat(B, numObjects, 1);
else
   B = {};
end

% Pad label matrix with zeros.  This lets us write the
% boundary-following loop without worrying about going off the edge
% of the image. 
Lp = padarray(L, [1 1], 0, 'both');

% Compute the linear indexing offsets to take us from a pixel to its
% neighbors.  
M = size(Lp, 1);
if conn == 8
   % Order is N NE E SE S SW W NW.
   offsets = [-1, M - 1, M, M + 1, 1, -M + 1, -M, -M-1];
else
   % Order is N E S W.
   offsets = [-1, M, 1, -M];
end

% next_search_direction_lut is a lookup table.  Given the direction
% from pixel k to pixel k+1, what is the direction to start with when
% examining the neighborhood of pixel k+1?
if conn == 8
   next_search_direction_lut = [8 8 2 2 4 4 6 6];
else
   next_search_direction_lut = [4 1 2 3];
end

% next_direction_lut is a lookup table.  Given that we just looked at
% neighbor in a given direction, which neighbor do we look at next? 
if conn == 8
   next_direction_lut = [2 3 4 5 6 7 8 1];
else
   next_direction_lut = [2 3 4 1];
end

% Values used for marking the starting and boundary pixels.
START    = -1;
BOUNDARY = -2;

% Initialize scratch space in which to record the boundary pixels as
% well as follow the boundary.
scratch = zeros(100, 1);

% Find candidate starting locations for boundaries.
[rr, cc] = find((Lp(2:end-1, :) > 0) & (Lp(1:end-2, :) == 0));
rr = rr + 1;

for k = 1:length(rr)
   r = rr(k);
   c = cc(k);
   if (Lp(r,c) > 0) & (Lp(r - 1, c) == 0) & isempty(B{Lp(r, c)})
      % We've found the start of the next boundary.  Compute its
      % linear offset, record which boundary it is, mark it, and
      % initialize the counter for the number of boundary pixels.
      idx = (c-1)*size(Lp, 1) + r;
      which = Lp(idx);
      
      scratch(1) = idx;
      Lp(idx) = START;
      numPixels = 1;
      currentPixel = idx;
      initial_departure_direction = [];
      
      done = 0;
      next_search_direction = 2;
      while ~done
         % Find the next boundary pixel.
         direction = next_search_direction;
         found_next_pixel = 0;
         for k = 1:length(offsets)
            neighbor = currentPixel + offsets(direction);
            if Lp(neighbor) ~= 0
               % Found the next boundary pixel.
               
               if (Lp(currentPixel) == START) & ...
                      isempty(initial_departure_direction)
                  % We are making the initial departure from
                  % the starting pixel.
                  initial_departure_direction = direction;
                  
               elseif (Lp(currentPixel) == START) & ...
                      (initial_departure_direction == direction)
                  % We are about to retrace our path.
                  % That means we're done.
                  done = 1;
                  found_next_pixel = 1;
                  break;
               end
               
               % Take the next step along the boundary.
               next_search_direction = ...
                   next_search_direction_lut(direction);
               found_next_pixel = 1;
               numPixels = numPixels + 1;
               if numPixels > size(scratch, 1)
                  % Double the scratch space.
                  scratch(2*size(scratch, 1)) = 0;
               end
               scratch(numPixels) = neighbor;
               
               if Lp(neighbor) ~= START
                  Lp(neighbor) = BOUNDARY;
               end
               
               currentPixel = neighbor;
               break;
            end
            
            direction = next_direction_lut(direction);
         end
         
         if ~found_next_pixel
            % If there is no next neighbor, the object must just
            % have a single pixel.
            numPixels = 2;
            scratch(2) = scratch(1);
            done = 1;
         end
      end
      
      % Convert linear indices to row-column coordinates and save
      % in the output cell array. 
      [row, col] = ind2sub(size(Lp), scratch(1:numPixels));
      B{which} = [row - 1, col - 1];
   end
end

if strcmp(dir, 'ccw')
   for k = 1:length(B)
      B{k} = B{k}(end:-1:1, :);
   end
end

这段代码实现了对二值图像中对象的边界进行跟踪,最终输出一个包含所有对象边界坐标的 cell 数组。

主要函数 boundaries 接受三个参数:BW 表示输入的二值图像,conn 表示连接性(8 连通或 4 连通),dir 表示跟踪边界的方向(顺时针或逆时针)。根据不同的输入情况,函数会进行相应的处理。其中,首先根据输入参数确定连接性和跟踪方向,然后使用 bwlabel 函数标记输入二值图像中的对象,并初始化一个 cell 数组 B 用于存储边界坐标。

接着,对标记矩阵进行填充操作以简化边界跟踪过程,并定义了一些变量和查找表用于指导边界跟踪的方向。通过在图像中寻找起始位置,然后按照设定的方向依次跟踪边界像素,直到形成完整的边界闭合路径。最后,根据跟踪方向对边界路径进行修正,最终将每个对象的边界坐标存储在 cell 数组 B 中,并按照设定的方向进行排序。

需要注意的是,该代码是基于 MATLAB 的图像处理工具箱编写的,涉及到图像处理中的边界跟踪算法,主要通过对相邻像素进行搜索和遍历完成对象边界的提取。

以下是对代码的详细分析:

3.1 函数描述

函数名:boundaries

功能:跟踪二值图像中对象的边界

输入参数:

  • BW:二值图像
  • conn:连接性(8 连通或 4 连通,默认为 8 连通)
  • dir:跟踪方向(顺时针或逆时针,默认为顺时针)

输出参数:

  • B:包含所有对象边界坐标的 cell 数组

3.2 参数处理

  • 检查输入参数,确保足够数量
  • 如果参数缺失,设置默认值
  • 确定连接性和跟踪方向设置

3.3 对象标记

  • 使用 bwlabel 函数对输入的二值图像进行对象标记
  • 获取每个对象的唯一标识
  • 初始化存储边界坐标的 cell 数组 B

3.4 图像填充

  • 对标记矩阵进行填充操作,简化边界跟踪
  • 定义变量和查找表指导边界跟踪方向

3.5 边界跟踪

  • 在图像中搜索起始位置
  • 按照设定方向依次跟踪边界像素,形成闭合路径
  • 考虑边界的闭合性和连通性

3.6 边界坐标存储

  • 将每个对象的边界坐标存储在 cell 数组 B 中
  • 使用线性索引转换为行列坐标,并存储在对应的 cell 元素中

3.7 结果修正

  • 根据跟踪方向对边界路径进行修正,确保正确的边界顺序

3.8 结果输出

  • 将存储了对象边界坐标的 cell 数组 B 输出作为函数的返回结果

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/429386.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Linux运维工具-ywtool默认功能介绍

提示:工具下载链接在文章最后 目录 一.资源检查二.日志刷新三.工具升级四.linux运维工具ywtool介绍五.ywtool工具下载链接 一.资源检查 只要系统安装了ywtool工具,默认就会配置上"资源检查"的脚本资源检查脚本的执行时间:每天凌晨3点进行检查资源检查脚本的检查内容…

激活函数Swish(ICLR 2018)

paper&#xff1a;Searching for Activation Functions 背景 深度网络中激活函数的选择对训练和任务表现有显著的影响。目前&#xff0c;最成功和最广泛使用的激活函数是校正线性单元&#xff08;ReLU&#xff09;。虽然各种手工设计的ReLU替代方案被提出&#xff0c;但由于在…

C# WinForm AndtUI第三方库 Tree控件使用记录

环境搭建 1.在NuGet中搜索AndtUI并下载至C# .NetFramework WinForm项目。 2.添加Tree控件至窗体。 使用方法集合 1.添加节点、子节点 using AntdUI; private void UpdateTreeView() {Tree tvwTestnew Tree();TreeItem rootTreeItem;TreeItem subTreeItem;Dictionary<str…

代码随想录刷题笔记-Day28

1. 重新安排行程 332. 重新安排行程https://leetcode.cn/problems/reconstruct-itinerary/给你一份航线列表 tickets &#xff0c;其中 tickets[i] [fromi, toi] 表示飞机出发和降落的机场地点。请你对该行程进行重新规划排序。 所有这些机票都属于一个从 JFK&#xff08;肯…

centos7安装kafka、zookeeper

安装jdk 安装jdk8 安装zookeeper 在指定目录执行下载命令 我是在/newdisk/zookeeper目录下 wget https://archive.apache.org/dist/zookeeper/zookeeper-3.5.8/apache-zookeeper-3.5.8-bin.tar.gz --no-check-certificate下载好后并解压 tar -zxvf apache-zookeeper-3.5…

[译]BNF 表示法:深入了解 Python 的语法

[译]BNF 表示法&#xff1a;深入了解 Python 的语法 原文&#xff1a;《BNF Notation: Dive Deeper Into Python’s Grammar》 https://realpython.com/python-bnf-notation/ 在阅读Python文档的时候&#xff0c;你可能已经遇到过BNF(Backus–Naur form)表示法&#xff1a; 下…

微软大中华区商业应用事业部高级产品经理张诗源,将出席“ISIG-低代码/零代码技术与应用发展峰会”

3月16日&#xff0c;第四届「ISIG中国产业智能大会」将在上海中庚聚龙酒店拉开序幕。本届大会由苏州市金融科技协会指导&#xff0c;企智未来科技&#xff08;LowCode低码时代、RPA中国、AIGC开放社区&#xff09;主办。大会旨在聚合每一位产业成员的力量&#xff0c;深入探索低…

ClickHouse SQL Reference (四)数据类型

Tuple(T1, T2, …) 元素元组&#xff0c;每个元素都有一个单独的类型。元组必须至少包含一个元素。 元组用于临时列分组。在查询中使用IN表达式时&#xff0c;以及指定lambda函数的某些形式参数时&#xff0c;可以对列进行分组。有关更多信息&#xff0c;请参阅IN操作符和高阶…

MATLAB知识点:while-end循环语句

​讲解视频&#xff1a;可以在bilibili搜索《MATLAB教程新手入门篇——数学建模清风主讲》。​ MATLAB教程新手入门篇&#xff08;数学建模清风主讲&#xff0c;适合零基础同学观看&#xff09;_哔哩哔哩_bilibili 节选自​第4章&#xff1a;MATLAB程序流程控制 除了for-end语…

解决win10系统cmd命令无法使用ssh问题

目录 问题说明&#xff1a;在使用ssh命令连接虚拟机地址时&#xff0c;出现了以下报错&#xff1a;​编辑 解决方法如下&#xff1a; 1.打开Windows设置&#xff0c;搜索点击添加可选功能&#xff1a; 2.点击添加功能&#xff1a; 3.安装Open SSH客户端和Open SSH服务器: …

Kube-Prometheus 监控Istio

推荐 Istio 多集群监控使用 Prometheus&#xff0c;其主要原因是基于 Prometheus 的分层联邦&#xff08;Hierarchical Federation&#xff09;。 通过 Istio 部署到每个集群中的 Prometheus 实例作为初始收集器&#xff0c;然后将数据聚合到网格层次的 Prometheus 实例上。 网…

大模型学习笔记五:RAG

文章目录 一、RAG介绍1)局限性2)通过检索增强生成二、RAG系统的基本搭建流程1)搭建流程简介2)文档的加载和切割3)检索引擎4)LLM接口封装5)prompt模板6)RAG Pipeline初探7)关键字检索局限性三、向量检索1)文本向量2)向量相似度计算3)向量数据库4)基于向量检索的RAG…

【MATLAB源码-第156期】基于matlab的OFDM系统多径信道下BPSK,4QAM和16QAM三种调制方式误码率对比。

操作环境&#xff1a; MATLAB 2022a 1、算法描述 OFDM&#xff08;Orthogonal Frequency Division Multiplexing&#xff0c;正交频分复用&#xff09;是一种高效的无线信号传输技术&#xff0c;广泛应用于现代通信系统&#xff0c;如Wi-Fi、LTE和5G。OFDM通过将宽带信道划分…

【力扣hot100】刷题笔记Day21

前言 快乐周日&#xff0c;做了个美梦睡了个懒觉&#xff0c;组会前刷刷栈的题吧 20. 有效的括号 - 力扣&#xff08;LeetCode&#xff09; 辅助栈 class Solution:def isValid(self, s: str) -> bool:dic {):(,]:[,}:{}st []for c in s:if st and c in dic:if dic[c] …

SqlServer 默认值约束示例

创建表&#xff0c;创建时指定 money 字段默认值为0.00&#xff1b; create table t_24 ( account varchar(19) not null, id_card char(18) not null, name varchar(20) not null, money decimal(16,2) default 0.00 not null ); 录入2条记录&#xff0c;money字…

Unity之街机捕鱼

目录 &#x1f62a;炮台系统 &#x1f3b6;炮口方向跟随鼠标 &#x1f3b6;切换炮台 &#x1f62a;战斗系统 &#x1f3ae;概述 &#x1f3ae;单例模式 &#x1f3ae;开炮 &#x1f3ae;子弹脚本 &#x1f3ae;渔网脚本 &#x1f3ae;鱼属性信息的脚本 &#x1f6…

08. Nginx进阶-Nginx动静分离

简介 什么是动静分离&#xff1f; 通过中间件将动态请求和静态请求进行分离。分离资源&#xff0c;减少不必要的请求消耗&#xff0c;减少请求延时。 动静分离的好处 动静分离以后&#xff0c;即使动态服务不可用&#xff0c;静态资源仍不受影响。 动静分离示意图 动静分离…

【学习心得】网站运行时间轴(爬虫逆向)

一、网站运行时间轴 掌握网站运行时间轴&#xff0c;有助于我们对“请求参数加密”和“响应数据加密”这两种反爬手段的深入理解。 二、从网站运行的时间轴角度来理解两种反爬手段 1、加载HTML&#xff1a; 这是浏览器访问网站时的第一步&#xff0c;服务器会返回基础…

bashplotlib,一个有趣的 Python 数据可视化图形库

前些天发现了一个巨牛的人工智能学习网站&#xff0c;通俗易懂&#xff0c;风趣幽默&#xff0c;忍不住分享一下给大家。点击跳转到网站AI学习网站。 目录 前言 什么是Bashplotlib库&#xff1f; 安装Bashplotlib库 使用Bashplotlib库 Bashplotlib库的功能特性 1. 绘…

Git 指令深入浅出【2】—— 分支管理

Git 指令深入浅出【2】—— 分支管理 分支管理1. 常用分支管理指令2. 合并分支合并冲突合并模式 3. 实战演习 分支管理 1. 常用分支管理指令 # 查看本地分支 git branch# 查看远程分支 git branch -r# 查看全部分支 git branch -aHEAD 指向的才是当前的工作分支 # 查看当前分…
最新文章