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

news2024/7/3 19:47:18

目录

1 对边界进行子采样

1.1 输入参数检查

1.2 处理重复坐标

1.3 计算边界最大范围

1.4 确定网格线数量

1.5 构建网格位置向量

1.6 计算曼哈顿距离

1.7 整理输出结果

1.8 返回结果

2 改变图像的存储类别

2.1 函数输入

2.2 数据类型转换

2.3 错误处理

2.4 返回结果

3 计算RGB图像的向量梯度并对梯度进行阈值处理

3.1 函数定义

3.2 注释说明

3.3 参数验证

3.4 计算x和y方向导数

3.5 计算向量梯度的参数

3.6 对梯度方向进行处理

3.7 计算每个颜色通道的梯度

3.8 对结果进行阈值处理

4 对彩色图像进行分割

4.1 参数数量判断与方法选择

4.2 欧氏距离计算与前景标记

4.3 马哈拉诺比斯距离计算与前景标记

4.4 前景像素组合与二值图像生成


1 对边界进行子采样

function [s, su] = bsubsamp(b, gridsep)
%BSUBSAMP Subsample a boundary.
%   [S, SU] = BSUBSAMP(B, GRIDSEP) subsamples the boundary B by
%   assigning each of its points to the grid node to which it is
%   closest.  The grid is specified by GRIDSEP, which is the
%   separation in pixels between the grid lines. For example, if
%   GRIDSEP = 2, there are two pixels in between grid lines. So, for
%   instance, the grid points in the first row would be at (1,1),
%   (1,4), (1,6), ..., and similarly in the y direction. The value
%   of GRIDSEP must be an even integer. The boundary is specified by
%   a set of coordinates in the form of an np-by-2 array.  It is
%   assumed that the boundary is one pixel thick. 
%
%   Output S is the subsampled boundary. Output SU is normalized so
%   that the grid separation is unity.  This is useful for obtaining
%   the Freeman chain code of the subsampled boundary.

%   Copyright 2002-2004 R. C. Gonzalez, R. E. Woods, & S. L. Eddins
%   Digital Image Processing Using MATLAB, Prentice-Hall, 2004
%   $Revision: 1.8 $  $Date: 2004/11/04 20:17:59 $
 
% Check input.
[np, nc] = size(b);
if np < nc 
   error('B must be of size np-by-2.'); 
end
if gridsep/2 ~= round(gridsep/2) 
   error('GRIDSEP must be an even integer.')
end

% Some boundary tracing programs, such as boundaries.m, end with 
% the beginning, resulting in a sequence in which the coordinates
% of the first and last points are the same. If this is the case 
% in b, eliminate the last point.
if isequal(b(1, :), b(np, :))
   np = np - 1;
   b = b(1:np, :);
end

% Find the max x and y spanned by the boundary.
xmax = max(b(:, 1));
ymax = max(b(:, 2));

% Determine the integral number of grid lines with gridsep points in
% between them that encompass the intervals [1,xmax], [1,ymax].
GLx = ceil((xmax + gridsep)/(gridsep + 1));
GLy = ceil((ymax + gridsep)/(gridsep + 1));

% Form vectors of x and y grid locations.
I = 1:GLx;
% Vector of grid line locations intersecting x-axis.
X(I) = gridsep*I + (I - gridsep); 

J = 1:GLy;
% Vector of grid line locations intersecting y-axis.
Y(J) = gridsep*J + (J - gridsep); 

% Compute both components of the cityblock distance between each
% element of b and all the grid-line intersections.  Assign each
% point to the grid location for which each comp of the cityblock
% distance was <= gridsep/2. Note the use of meshgrid to
% optimize the code. Keep in mind that meshgrid requires that columns
% be listed first (see Chapter 2).
DIST = gridsep/2;
[YG, XG] = meshgrid(Y, X);
Q = 1;
for k=1:np
   [I,J] = find(abs(XG - b(k, 1)) <= DIST & abs(YG - b(k, 2)) <= ...
                DIST); 
   % If point b(k,:) is equidistant from two or more grid intersections,
   % assign the point arbitrarily to the first one:
   I = I(1);
   J = J(1);
   ord = k; % To keep track of order of input coordinates.
   d1(Q, :) = cat(2, Y(J), ord);
   d2(Q, :) = cat(2, X(I), ord);
   Q = Q + 1;
end
 
% d is the set of points assigned to the new grid with line
% separation of gridsep. Note that it is formed as d=(d2,d1) to
% compensate for the coordinate transposition inherent in using
% meshgrid (see Chapter 2). 
d = cat(2, d2(:, 1), d1); % The second column of d1 & d2 is ord.

% Sort the points using the values in ord, which is the last col in
% d.
d = fliplr(d); % So the last column becomes first.
d = sortrows(d);
d = fliplr(d); % Flip back.

% Eliminate duplicate rows in the first two components of 
% d to create the output. The cw or ccw order MUST be preserved.
s = d(:, 1:2);
[s, m, n] = unique(s, 'rows');

% Function unique sorts the data--Restore to original order
% by using the contents of m.
s = [s, m];
s = fliplr(s);
s = sortrows(s);
s = fliplr(s);
s = s(:, 1:2);

% Scale to unit grid so that can use directly to obtain Freeman
% chain code.  The shape does not change.
su = round(s./gridsep) + 1;

这段代码通过有效地计算边界点与网格线的距离,并将每个点分配到最近的网格位置,实现了边界的子采样处理,同时保持边界的形状不变。最终输出的结果可以用于获取Freeman链码等进一步的图像处理操作。

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

1.1 输入参数检查

  • 使用size函数获取边界数组b的行数np和列数nc,确保b是一个np行2列的数组。
  • 检查np是否小于nc,若是则报错,要求b必须是np行2列的数组。
  • 检查gridsep是否为偶数,通过计算gridsep除以2的余数是否为0来判断,若不是则报错,要求gridsep必须是偶数。

1.2 处理重复坐标

  • 检查边界的第一个点和最后一个点坐标是否相同,若相同则删除最后一个点。
  • 更新np的值,将其减去1,同时更新边界数组b,去掉最后一个重复的点。

1.3 计算边界最大范围

  • 使用max函数分别计算边界数组b在x和y方向上的最大值,得到xmax和ymax,用于确定网格线的数量。

1.4 确定网格线数量

  • 根据xmax、ymax和gridsep计算在x和y方向上网格线的数量GLx和GLy,使用ceil函数向上取整。

1.5 构建网格位置向量

  • 使用1:GLx生成表示x方向网格线位置的向量I。
  • 根据公式gridsep*I + (I - gridsep)计算x轴上网格线的位置向量X。
  • 同理,生成表示y方向网格线位置的向量J,并计算y轴上网格线的位置向量Y。

1.6 计算曼哈顿距离

  • 使用meshgrid函数构建网格点的坐标矩阵XG和YG,用于计算每个边界点到网格线交点的曼哈顿距离。
  • 遍历边界点,计算每个点到所有网格线交点的曼哈顿距离,找到距离最近的网格位置并分配给该点。

1.7 整理输出结果

  • 对分配到的网格位置进行整理和排序,得到子采样后的边界s。
  • 使用unique函数去除重复的坐标点,保持顺时针或逆时针顺序不变。

1.8 返回结果

  • 将子采样后的边界s返回作为主要输出。
  • 将边界坐标归一化到单位网格上,得到归一化的边界su,方便后续处理。

2 改变图像的存储类别

function image = changeclass(class, varargin)
%CHANGECLASS changes the storage class of an image.
%  I2 = CHANGECLASS(CLASS, I);
%  RGB2 = CHANGECLASS(CLASS, RGB);
%  BW2 = CHANGECLASS(CLASS, BW);
%  X2 = CHANGECLASS(CLASS, X, 'indexed');

%  Copyright 1993-2002 The MathWorks, Inc.  Used with permission.
%  $Revision: 1.2 $  $Date: 2003/02/19 22:09:58 $

switch class
case 'uint8'
   image = im2uint8(varargin{:});
case 'uint16'
   image = im2uint16(varargin{:});
case 'double'
   image = im2double(varargin{:});
otherwise
   error('Unsupported IPT data class.');
end

这段代码的功能是根据指定的存储类别(class)将输入图像(varargin)进行类型转换,并返回转换后的图像(image)。这段代码是一个 MATLAB 函数,用于改变图像的存储类别。函数接受两个参数,第一个参数是目标存储类别,第二个参数是输入的图像数据。根据不同的存储类别,调用不同的内置函数进行数据类型转换。

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

2.1 函数输入

函数接受两个参数,分别是目标存储类别 class 和输入的图像数据 varargin。其中 varargin 可能包括普通图像、RGB 图像或者二值图像,也可以指定为索引图像。

2.2 数据类型转换

根据目标存储类别 class 的不同,采取相应的数据类型转换操作:

  • 当 class 为 'uint8' 时,调用 im2uint8 函数进行转换。
  • 当 class 为 'uint16' 时,调用 im2uint16 函数进行转换。
  • 当 class 为 'double' 时,调用 im2double 函数进行转换。
  • 对于其他不支持的类型,抛出错误提示。

2.3 错误处理

如果输入的存储类别 class 不属于 'uint8'、'uint16' 或 'double' 中的任何一种,将会抛出错误信息 "Unsupported IPT data class."。

2.4 返回结果

根据输入的存储类别(class)的不同,经过相应的数据类型转换后,最终得到的图像(image)将作为函数的返回值返回。

该代码封装了常见的图像数据类型转换操作,提供了一个方便的接口,使用户可以根据需要轻松地改变图像的存储类别。

3 计算RGB图像的向量梯度并对梯度进行阈值处理

function [VG, A, PPG]= colorgrad(f, T)
%COLORGRAD Computes the vector gradient of an RGB image.
%   [VG, VA, PPG] = COLORGRAD(F, T) computes the vector gradient, VG,
%   and corresponding angle array, VA, (in radians) of RGB image
%   F. It also computes PPG, the per-plane composite gradient
%   obtained by summing the 2-D gradients of the individual color 
%   planes. Input T is a threshold in the range [0, 1]. If it is
%   included in the argument list, the values of VG and PPG are
%   thresholded by letting VG(x,y) = 0 for values <= T and VG(x,y) =
%   VG(x,y) otherwise. Similar comments apply to PPG.  If T is not
%   included in the argument list then T is set to 0. Both output
%   gradients are scaled to the range [0, 1].

%   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:27:21 $

if (ndims(f) ~= 3) | (size(f, 3) ~= 3)
   error('Input image must be RGB.');
end

% Compute the x and y derivatives of the three component images 
% using Sobel operators.
sh = fspecial('sobel');
sv = sh';
Rx = imfilter(double(f(:, :, 1)), sh, 'replicate');
Ry = imfilter(double(f(:, :, 1)), sv, 'replicate');
Gx = imfilter(double(f(:, :, 2)), sh, 'replicate');
Gy = imfilter(double(f(:, :, 2)), sv, 'replicate');
Bx = imfilter(double(f(:, :, 3)), sh, 'replicate');
By = imfilter(double(f(:, :, 3)), sv, 'replicate');

% Compute the parameters of the vector gradient. 
gxx = Rx.^2 + Gx.^2 + Bx.^2;
gyy = Ry.^2 + Gy.^2 + By.^2;
gxy = Rx.*Ry + Gx.*Gy + Bx.*By;
A = 0.5*(atan(2*gxy./(gxx - gyy + eps)));
G1 = 0.5*((gxx + gyy) + (gxx - gyy).*cos(2*A) + 2*gxy.*sin(2*A));

% Now repeat for angle + pi/2. Then select the maximum at each point.
A = A + pi/2;
G2 = 0.5*((gxx + gyy) + (gxx - gyy).*cos(2*A) + 2*gxy.*sin(2*A));
G1 = G1.^0.5;
G2 = G2.^0.5;
% Form VG by picking the maximum at each (x,y) and then scale
% to the range [0, 1].
VG = mat2gray(max(G1, G2));

% Compute the per-plane gradients.
RG = sqrt(Rx.^2 + Ry.^2);
GG = sqrt(Gx.^2 + Gy.^2);
BG = sqrt(Bx.^2 + By.^2);
% Form the composite by adding the individual results and
% scale to [0, 1].
PPG = mat2gray(RG + GG + BG);

% Threshold the result.
if nargin == 2
   VG = (VG > T).*VG;
   PPG = (PPG > T).*PPG;
end

这段代码实现了计算RGB图像的向量梯度,并对梯度进行阈值处理。

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

3.1 函数定义

function [VG, A, PPG]= colorgrad(f, T)

这定义了一个名为colorgrad的函数,它接受两个输入参数fT,并返回三个输出参数VGAPPG

3.2 注释说明

%COLORGRAD Computes the vector gradient of an RGB image.
%   [VG, VA, PPG] = COLORGRAD(F, T) computes the vector gradient, VG,
%   and corresponding angle array, VA, (in radians) of RGB image
%   F. It also computes PPG, the per-plane composite gradient
%   obtained by summing the 2-D gradients of the individual color 
%   planes. Input T is a threshold in the range [0, 1]. If it is
%   included in the argument list, the values of VG and PPG are
%   thresholded by letting VG(x,y) = 0 for values <= T and VG(x,y) =
%   VG(x,y) otherwise. Similar comments apply to PPG.  If T is not
%   included in the argument list then T is set to 0. Both output
%   gradients are scaled to the range [0, 1].
%
%   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:27:21 $

这段注释提供了函数的目的和功能描述,以及对输入参数和输出参数的说明。同时还包含了版权信息和修订记录。

3.3 参数验证

if (ndims(f) ~= 3) | (size(f, 3) ~= 3)
   error('Input image must be RGB.');
end

这段代码用于验证输入图像f是否为RGB图像(3维且第三维大小为3),如果不是,则抛出错误信息。

3.4 计算x和y方向导数

sh = fspecial('sobel');
sv = sh';
Rx = imfilter(double(f(:, :, 1)), sh, 'replicate');
Ry = imfilter(double(f(:, :, 1)), sv, 'replicate');
Gx = imfilter(double(f(:, :, 2)), sh, 'replicate');
Gy = imfilter(double(f(:, :, 2)), sv, 'replicate');
Bx = imfilter(double(f(:, :, 3)), sh, 'replicate');
By = imfilter(double(f(:, :, 3)), sv, 'replicate');

这部分代码使用Sobel算子计算RGB图像各个通道的x和y方向的导数。

3.5 计算向量梯度的参数

gxx = Rx.^2 + Gx.^2 + Bx.^2;
gyy = Ry.^2 + Gy.^2 + By.^2;
gxy = Rx.*Ry + Gx.*Gy + Bx.*By;
A = 0.5*(atan(2*gxy./(gxx - gyy + eps)));
G1 = 0.5*((gxx + gyy) + (gxx - gyy).*cos(2*A) + 2*gxy.*sin(2*A));

这部分代码计算了向量梯度的各种组合参数,包括梯度幅值G1和梯度方向A

3.6 对梯度方向进行处理

A = A + pi/2;
G2 = 0.5*((gxx + gyy) + (gxx - gyy).*cos(2*A) + 2*gxy.*sin(2*A));
G1 = G1.^0.5;
G2 = G2.^0.5;
VG = mat2gray(max(G1, G2));

这部分代码将梯度方向加上π/2,然后选择每个点的最大梯度值,并将其缩放到[0, 1]的范围。

3.7 计算每个颜色通道的梯度

RG = sqrt(Rx.^2 + Ry.^2);
GG = sqrt(Gx.^2 + Gy.^2);
BG = sqrt(Bx.^2 + By.^2);
PPG = mat2gray(RG + GG + BG);

这部分代码用于实现计算每个颜色通道的梯度,并将其相加形成组合梯度,同样缩放到[0, 1]范围。

3.8 对结果进行阈值处理

if nargin == 2
   VG = (VG > T).*VG;
   PPG = (PPG > T).*PPG;
end

如果输入参数包含阈值T,则根据阈值对向量梯度VG和组合梯度PPG进行阈值处理。

4 对彩色图像进行分割

function I = colorseg(varargin)
%COLORSEG Performs segmentation of a color image.
%   S = COLORSEG('EUCLIDEAN', F, T, M) performs segmentation of color
%   image F using a Euclidean measure of similarity. M is a 1-by-3
%   vector representing the average color used for segmentation (this
%   is the center of the sphere in Fig. 6.26 of DIPUM). T is the
%   threshold against which the distances are compared.
%
%   S = COLORSEG('MAHALANOBIS', F, T, M, C) performs segmentation of
%   color image F using the Mahalanobis distance as a measure of
%   similarity. C is the 3-by-3 covariance matrix of the sample color
%   vectors of the class of interest. See function covmatrix for the
%   computation of C and M. 
%
%   S is the segmented image (a binary matrix) in which 0s denote the
%   background. 

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

% Preliminaries.
% Recall that varargin is a cell array.
f = varargin{2};
if (ndims(f) ~= 3) | (size(f, 3) ~= 3)
   error('Input image must be RGB.');
end
M = size(f, 1); N = size(f, 2);
% Convert f to vector format using function imstack2vectors.
[f, L] = imstack2vectors(f);
f = double(f);
% Initialize I as a column vector.  It will be reshaped later
% into an image.
I = zeros(M*N, 1); 
T = varargin{3};
m = varargin{4};
m = m(:)'; % Make sure that m is a row vector.

if length(varargin) == 4 
   method = 'euclidean';
elseif length(varargin) == 5 
   method = 'mahalanobis';
else 
   error('Wrong number of inputs.');
end

switch method
case 'euclidean'
   % Compute the Euclidean distance between all rows of X and m. See
   % Section 12.2 of DIPUM for an explanation of the following
   % expression. D(i) is the Euclidean distance between vector X(i,:)
   % and vector m. 
   p = length(f);
   D = sqrt(sum(abs(f - repmat(m, p, 1)).^2, 2));
case 'mahalanobis'
   C = varargin{5};
   D = mahalanobis(f, C, m);
otherwise 
   error('Unknown segmentation method.')
end

% D is a vector of size MN-by-1 containing the distance computations
% from all the color pixels to vector m. Find the distances <= T.
J = find(D <= T);

% Set the values of I(J) to 1.  These are the segmented
% color pixels.
I(J) = 1;

% Reshape I into an M-by-N image.
I = reshape(I, M, N);  

这段代码是一个用于对彩色图像进行分割的函数colorseg。该函数提供了两种不同的颜色相似度度量方法:欧氏距离('EUCLIDEAN')和马哈拉诺比斯距离('MAHALANOBIS')。根据输入参数的不同,函数会选择不同的方法来执行图像分割。

首先,函数通过检查输入参数的数量来确定使用哪种方法进行分割。然后根据所选的方法计算颜色像素与给定颜色均值之间的距离,并根据阈值T将图像分割为前景和背景。最终返回一个二值化的分割图像。

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

4.1 参数数量判断与方法选择

if nargin == 4
    % 使用欧氏距离方法
    % 实现代码
elseif nargin == 5
    % 使用马哈拉诺比斯距离方法
    % 实现代码
else
    error('Incorrect number of input arguments');
end

在这部分代码中,根据输入参数的数量判断使用哪种方法进行图像分割。如果输入参数为4个,则选择欧氏距离方法;如果输入参数为5个,则选择马哈拉诺比斯距离方法;否则抛出错误信息。

4.2 欧氏距离计算与前景标记

dist = sqrt(sum((img - color_mean).^2, 3));
foreground = dist <= T;

在欧氏距离方法中,首先计算每个颜色像素与给定颜色均值之间的欧氏距离。然后根据阈值T将距离小于等于阈值的像素标记为前景。

4.3 马哈拉诺比斯距离计算与前景标记

C_inv = inv(C);
dist = sqrt(sum((img - color_mean) * C_inv .* (img - color_mean), 3));
foreground = dist <= T;

在马哈拉诺比斯距离方法中,需要额外的参数C(协方差矩阵)。首先计算马哈拉诺比斯距离,然后同样根据阈值T将距离小于等于阈值的像素标记为前景。

4.4 前景像素组合与二值图像生成

binary_image = uint8(foreground);

最后,将标记为前景的像素组合成一个二值图像,并以uint8格式返回该图像作为分割结果。

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

LabVIEW高温摩擦磨损测试系统

LabVIEW高温摩擦磨损测试系统 介绍了一个基于LabVIEW的高温摩擦磨损测试系统的软件开发项目。该系统实现高温条件下材料摩擦磨损特性的自动化测试&#xff0c;通过精确控制和数据采集&#xff0c;为材料性能研究提供重要数据支持。 项目背景 随着材料科学的发展&#xff0c;…

视觉Transformers中的位置嵌入 - 研究与应用指南

视觉 Transformer 中位置嵌入背后的数学和代码简介。 自从 2017 年推出《Attention is All You Need》以来&#xff0c;Transformer 已成为自然语言处理 (NLP) 领域最先进的技术。 2021 年&#xff0c;An Image is Worth 16x16 Words 成功地将 Transformer 应用于计算机视觉任务…

小迪安全31WEB 攻防-通用漏洞文件上传js 验证mimeuser.ini语言特性

#知识点&#xff1a; 1、文件上传-前端验证 2、文件上传-黑白名单 3、文件上传-user.ini 妙用 4、文件上传-PHP 语言特性 #详细点&#xff1a; 检测层面&#xff1a;前端&#xff0c;后端等 2、检测内容&#xff1a;文件头&#xff0c;完整性&#xff0c;二次渲染…

docker快照备份回滚

1. 安装系统 1.1 vm安装Ubuntu 参考:https://blog.csdn.net/u010308917/article/details/125157774 1.2 其他操作 添加自定义物理卷 –待补充– 1.2.1 查询可用物理卷 fdisk -l 输出如下 Disk /dev/loop0: 73.9 MiB, 77492224 bytes, 151352 sectors Units: sectors of …

Vue 项目重复点击菜单刷新当前页面

需求&#xff1a;“在当前页面点击当前页面对应的菜单时&#xff0c;也能刷新页面。” 由于 Vue 项目的路由机制是路由不变的情况下&#xff0c;对应的组件是不重新渲染的。所以重复点击菜单不会改变路由&#xff0c;然后页面就无法刷新了。 方案一 在vue项目中&#xff0c;…

英特尔/ARM/国产化EMS储能控制器解决方案

新型储能是建设新型电⼒系统、推动能源绿⾊低碳转型的重要装备基础和关键⽀撑技术&#xff0c;是实现碳达峰、碳中和⽬标的重要⽀撑。说到储能&#xff0c;大众首先想到的就是电池&#xff0c;其好坏关系到能量转换效率、系统寿命和安全等重要方面&#xff0c;但储能要想作为一…

[LeetBook]【学习日记】数组内乘积

题目 按规则计算统计结果 为了深入了解这些生物群体的生态特征&#xff0c;你们进行了大量的实地观察和数据采集。数组 arrayA 记录了各个生物群体数量数据&#xff0c;其中 arrayA[i] 表示第 i 个生物群体的数量。请返回一个数组 arrayB&#xff0c;该数组为基于数组 arrayA …

vue点击按钮同时下载多个文件

点击下载按钮根据需要的id调接口拿到返回需要下载的文件 再看返回的数据结构 数组中一个对象&#xff0c;就是一个文件&#xff0c;多个对象就是多个文件 下载函数 // 下载tableDownload(row) {getuploadInventoryDownload({ sysBatch: row.sysBatch, fileName: row.fileName…

STM32 TIM编码器接口

单片机学习&#xff01; 目录 文章目录 前言 一、编码器接口简介 1.1 编码器接口作用 1.2 编码器接口工作流程 1.3 编码器接口资源分布 1.4 编码器接口输入引脚 二、正交编码器 2.1 正交编码器功能 2.2 引脚作用 2.3 如何测量方向 2.4 正交信号优势 2.5 执行逻辑 三、编码器定时…

前端+php:实现提示框(自动消失)

效果 php部分&#xff1a;只展示插入过程 <?php//插入注册表中$sql_insert "INSERT INTO regist_user(userid,password,phone,email)VALUES (" . $_POST[UserID] . "," . CryptPass($_POST[Password]) . "," . $_POST[Phone] . ",&qu…

“而且,再加上”可以用哪个语法来表示,柯桥考级韩语学习

语法 --는/은/ㄴ 데다가 1.语法&#xff1a;는/은/ㄴ 데다가 2.表示&#xff1a;用于谓词词干和体词谓词形后, 表示在原有的状况上再加上其他情况。 3.添加&#xff1a; 4.例句&#xff1a; 当然&#xff0c;与这个语法含义相近的还有不少语法&#xff0c;有一部分是初级暂时…

【AI视野·今日NLP 自然语言处理论文速览 第八十期】Fri, 1 Mar 2024

AI视野今日CS.NLP 自然语言处理论文速览 Fri, 1 Mar 2024 Totally 67 papers &#x1f449;上期速览✈更多精彩请移步主页 Daily Computation and Language Papers Loose LIPS Sink Ships: Asking Questions in Battleship with Language-Informed Program Sampling Authors G…

Libevent的使用及reactor模型

Libevent 是一个用C语言编写的、轻量级的开源高性能事件通知库&#xff0c;主要有以下几个亮点&#xff1a;事件驱动&#xff08; event-driven&#xff09;&#xff0c;高性能;轻量级&#xff0c;专注于网络&#xff0c;不如 ACE 那么臃肿庞大&#xff1b;源代码相当精炼、易读…

HTTP常用状态码详解

目录 1xx - 信息性状态码 2xx - 成功状态码 3xx - 重定向状态码 4xx - 客户端错误状态码 5xx - 服务器错误状态码 总结 HTTP&#xff08;Hypertext Transfer Protocol&#xff09;是一种用于传输超文本的应用层协议。在HTTP通信中&#xff0c;服务器和客户端之间会通过状态…

Chrome禁止自动升级

一、关闭计划任务 1、首先我们需要右键点击我的电脑&#xff0c;在打开的选项里选择管理。   2、在打开的对话框中选择任务计划程序。   3、在任务计划程序库中找到两个和chrome自动更新相关的任务计划GoogleUpdateTaskMachineCore与GoogleUpdateTaskMachineUA。     4…

C++模拟揭秘刘谦魔术,领略数学的魅力

新的一年又开始了&#xff0c;大家新年好呀~。在这我想问大家一个问题&#xff0c;有没有同学看了联欢晚会上刘谦的魔术呢&#xff1f; 这个节目还挺有意思的&#xff0c;它最出彩的不是魔术本身&#xff0c;而是小尼老师“念错咒语”而导致他手里的排没有拼在一起&#xff0c;…

Python数据可视化库之bashplotlib使用详解

概要 在数据可视化领域,Python拥有许多优秀的库,如Matplotlib、Seaborn等,它们可以创建漂亮而复杂的图形。但是,有时候我们可能需要在终端中绘制简单的图形,这时候Bashplotlib就派上了用场。Bashplotlib是一个Python库,可以在终端中绘制基本的图形,如条形图、散点图等。…

用Python爬取古诗文网的各类古诗

fetch-gushiwen 用途 可以拿去用于个人知识库、知识图谱的创建等其他学习用途。 使用 输入古诗文网的链接&#xff0c;即可爬取该页面所有诗歌的诗名&#xff0c;作者&#xff0c;朝代&#xff0c;内容&#xff0c;译文&#xff0c;注释&#xff0c;赏析&#xff0c;创作背…

文心一言 VS 讯飞星火 VS chatgpt (208)-- 算法导论15.4 5题

五、设计一个 O( n 2 n^2 n2) 时间的算法&#xff0c;求一个 n 个数的序列的最长单调递增子序列。要写代码的时候&#xff0c;请用go语言。 文心一言&#xff0c;抛panic&#xff1a; 在 Go 语言中设计一个 O(n^2) 时间复杂度的算法来求一个 n 个数的序列的最长单调递增子序列…

【数据结构】20 树的应用(堆及其操作)

堆的定义 堆是一种优先队列&#xff0c;从堆中取出元素时按照元素的优先级大小&#xff0c;而不是元素进入队列的先后顺序。 堆的最常用结构是二叉树&#xff0c;一般为完全二叉树。通常使用数组来实现堆的存储。 最大堆&#xff1a;任一结点的值大于或等于其子节点的值。这一…