个人收藏夹

1、MATLAB实现带有保边效果的双边滤波器:

代码引用自博客:

http://blog.chinaaet.com/helimin/p/5100018184

双边滤波器函数代码如下:

function B = bfilter2(A,w,sigma)  
%A为给定图像,归一化到[0,1]的double矩阵  
%W为双边滤波器(核)的边长/2  
%定义域方差σd记为SIGMA(1),值域方差σr记为SIGMA(2) 
%    This function implements 2-D bilateral filtering using
%    the method outlined in:
%
%       C. Tomasi and R. Manduchi. Bilateral Filtering for 
%       Gray and Color Images. In Proceedings of the IEEE 
%       International Conference on Computer Vision, 1998. 
%
%    B = bfilter2(A,W,SIGMA) performs 2-D bilateral filtering
%    for the grayscale or color image A. A should be a double
%    precision matrix of size NxMx1 or NxMx3 (i.e., grayscale
%    or color images, respectively) with normalized values in
%    the closed interval [0,1]. The half-size of the Gaussian
%    bilateral filter window is defined by W. The standard
%    deviations of the bilateral filter are given by SIGMA,
%    where the spatial-domain standard deviation is given by
%    SIGMA(1) and the intensity-domain standard deviation is
%    given by SIGMA(2).
%
% Douglas R. Lanman, Brown University, September 2006.
% [email protected], http://mesh.brown.edu/dlanman

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Pre-process input and select appropriate filter.

% Verify that the input image exists and is valid.
if ~exist('A','var') || isempty(A)
   error('Input image A is undefined or invalid.');
end
if ~isfloat(A) || ~sum([1,3] == size(A,3)) || ...
      min(A(:)) < 0 || max(A(:)) > 1
   error(['Input image A must be a double precision ',...
          'matrix of size NxMx1 or NxMx3 on the closed ',...
          'interval [0,1].']);      
end

% Verify bilateral filter window size.
if ~exist('w','var') || isempty(w) || ...
      numel(w) ~= 1 || w < 1    %计算数组中的元素个数
   w = 5;
end
w = ceil(w);    %大于w的最小整数

% Verify bilateral filter standard deviations.
if ~exist('sigma','var') || isempty(sigma) || ...
      numel(sigma) ~= 2 || sigma(1) <= 0 || sigma(2) <= 0
   sigma = [3 0.1];
end

% Apply either grayscale or color bilateral filtering.
if size(A,3) == 1       %如果输入图像为灰度图像,则调用灰度图像滤波方法
   B = bfltGray(A,w,sigma(1),sigma(2));
else                    %如果输入图像为彩色图像,则调用彩色图像滤波方法
   B = bfltColor(A,w,sigma(1),sigma(2));
end


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Implements bilateral filtering for grayscale images.
function B = bfltGray(A,w,sigma_d,sigma_r)

% Pre-compute Gaussian distance weights.
[X,Y] = meshgrid(-w:w,-w:w);
%创建核距离矩阵,e.g.  
%  [x,y]=meshgrid(-1:1,-1:1)  
%   
% x =  
%   
%     -1     0     1  
%     -1     0     1  
%     -1     0     1  
%   
%   
% y =  
%   
%     -1    -1    -1  
%      0     0     0  
%      1     1     1  
%计算定义域核  
G = exp(-(X.^2+Y.^2)/(2*sigma_d^2));

% Create waitbar.计算过程比较慢,创建waitbar可实时看到进度
h = waitbar(0,'Applying bilateral filter...');
set(h,'Name','Bilateral Filter Progress');

% Apply bilateral filter.
%计算值域核H 并与定义域核G 乘积得到双边权重函数F
dim = size(A);      %得到输入图像的width和height
B = zeros(dim);
for i = 1:dim(1)
   for j = 1:dim(2)     
         % Extract local region.
         iMin = max(i-w,1);
         iMax = min(i+w,dim(1));
         jMin = max(j-w,1);
         jMax = min(j+w,dim(2));
         %定义当前核所作用的区域为(iMin:iMax,jMin:jMax) 
         I = A(iMin:iMax,jMin:jMax);    %提取该区域的源图像值赋给I
      
         % Compute Gaussian intensity weights.
         H = exp(-(I-A(i,j)).^2/(2*sigma_r^2));
      
         % Calculate bilateral filter response.
         F = H.*G((iMin:iMax)-i+w+1,(jMin:jMax)-j+w+1);
         B(i,j) = sum(F(:).*I(:))/sum(F(:));
               
   end
   waitbar(i/dim(1));
end

% Close waitbar.
close(h);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Implements bilateral filter for color images.
function B = bfltColor(A,w,sigma_d,sigma_r)

% Convert input sRGB image to CIELab color space.
if exist('applycform','file')
   A = applycform(A,makecform('srgb2lab'));
else
   A = colorspace('Lab<-RGB',A);
end

% Pre-compute Gaussian domain weights.
[X,Y] = meshgrid(-w:w,-w:w);
G = exp(-(X.^2+Y.^2)/(2*sigma_d^2));

% Rescale range variance (using maximum luminance).
sigma_r = 100*sigma_r;

% Create waitbar.
h = waitbar(0,'Applying bilateral filter...');
set(h,'Name','Bilateral Filter Progress');

% Apply bilateral filter.
dim = size(A);
B = zeros(dim);
for i = 1:dim(1)
   for j = 1:dim(2)
      
         % Extract local region.
         iMin = max(i-w,1);
         iMax = min(i+w,dim(1));
         jMin = max(j-w,1);
         jMax = min(j+w,dim(2));
         I = A(iMin:iMax,jMin:jMax,:);
      
         % Compute Gaussian range weights.
         dL = I(:,:,1)-A(i,j,1);
         da = I(:,:,2)-A(i,j,2);
         db = I(:,:,3)-A(i,j,3);
         H = exp(-(dL.^2+da.^2+db.^2)/(2*sigma_r^2));
      
         % Calculate bilateral filter response.
         F = H.*G((iMin:iMax)-i+w+1,(jMin:jMax)-j+w+1);
         norm_F = sum(F(:));
         B(i,j,1) = sum(sum(F.*I(:,:,1)))/norm_F;
         B(i,j,2) = sum(sum(F.*I(:,:,2)))/norm_F;
         B(i,j,3) = sum(sum(F.*I(:,:,3)))/norm_F;
                
   end
   waitbar(i/dim(1));
end

% Convert filtered image back to sRGB color space.
if exist('applycform','file')
   B = applycform(B,makecform('lab2srgb'));
else  
   B = colorspace('RGB<-Lab',B);
end

% Close waitbar.
close(h);

调用方法示例:

Image_pri = imread('academy.jpg');
Image_normalized = im2double(Image_pri);
w = 5;      %窗口大小
sigma = [3 0.1];    %方差
Image_bf = bfilter2(Image_normalized,w,sigma);

特此感谢原博主!

2、cifar10数据集导入方案

在复现cifar10_inception10.py的时候,考虑到利用在线下载的方式导入数据的方式对国内用户不太友好。决定采用先到网站下载数据集文件,然后离线导入数据。
关于如何正确解决离线导入数据的问题,这一篇博客有很好的解决方法:

https://blog.csdn.net/weixin_45868601/article/details/105231538

3、如何理解马尔科夫链及其在互联网中的应用

找到了一篇很好的博客,文章的难度是渐进的,到后面可能需要一定的数学基础,但是我很喜欢他在文中给出的几个概念的例子。
链接如下:

https://baijiahao.baidu.com/s?id=162790571049

5、CNN解释器

这个网站给出一个简单图片分类神经网络。特别的是,它将数据从原始图片到最后的分类标签的流图可视化,你可以看到每一个在不同的pading,不同的步长等参数下卷积块是怎么移动的。以及池化层是如何缩减数据的,激活函数的映射关系是怎样、数据尺寸是怎样发生变化的。非常直观的一个学习CNN工具。

https://poloclub.github.io/cnn-explainer/

6、keras简单入门教学(含代码)

https://www.cnblogs.com/wj-1314/p/9579490.html

7、文献管理软件Mendely入门与介绍

https://blog.csdn.net/z_h_s/article/details/41575761

8、基于学习的单目深度估计论文综述连接

https://blog.csdn.net/yukinoai/article/details/99715227

9、notepad++编辑Python换行问题不能解决怎么办,那就看这个博主推荐的方法吧

https://blog.csdn.net/iteye_3224/article/details/82400727?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase

10、PDF在线压缩的网站(免费)

https://www.pdf365.cn/

现在百度出来的结果都是五花八门的商业广告,一言不合就让你冲会员,这是一个少有的能用的免费软件。

11、MATLAB图像频谱计算

I =imread('C:\Users\wangd\Desktop\in000155.jpg');  
I1 = rgb2gray(I);
subplot(1,2,1);imshow(I1);         
fftI1=fft2(I1);                       
sfftI1=fftshift(fftI1);            
RR1=real(sfftI1);                    
II1=imag(sfftI1);                   
A1=sqrt(RR1.^2+II1.^2);             
A1=(A1-min(min(A1)))/(max(max(A1))-min(min(A1)))*225;%归一化
subplot(1,2,2);imshow(A1);    
      

12、文本操作

批量处理代码的注释操作。

你可能感兴趣的:(个人收藏夹)