图像中添加二项式分布噪声
来源:互联网 发布:mysql 连接数查看 编辑:程序博客网 时间:2024/05/16 11:16
clc,clear,close allwarning offfeature jit offim = imread('coloredChips.png');Z0 = imnoise_B(im,size(im,1),size(im,2),0.5);Z1 = im2uint8(Z0); % 类型转换figure('color',[1,1,1]),im(:,:,1) = im(:,:,1) + Z1; % Rim(:,:,2) = im(:,:,2) + Z1; % Gim(:,:,3) = im(:,:,3) + Z1; % Bsubplot(121); imshow(im);title('加二项式分布噪声图像')subplot(122); imhist(Z1); title('加二项式分布噪声图像直方图')
function R = imnoise_B(im,M, N, b)% input:% 二项式B分布,噪声的类型;% M,N:输出噪声图像矩阵的大小% a,b:各种噪声的分布参数% output:% R: 输出的噪声图像矩阵,数据类型为double型% 设定默认值% 考虑第floor(a/2)次命中if nargin < 4 b = 0.5;end % 产生二项式分布噪声 for i = 1:M for j=1:N a = double( floor(im(i,j)/30)+1 ); R(i,j) = nchoosek(a,floor(a/2)) * b.^(floor(a/2)) .* (1-b).^(a- floor(a/2)); end endend
nchoosek Binomial coefficient or all combinations
Syntax
C = nchoosek(n,k)
C = nchoosek(v,k)
Description
C = nchoosek(n,k) where n and k are nonnegative integers, returns n!/((n–k)! k!).
This is the number of combinations of n things taken k at a time.
C = nchoosek(v,k), where v is a row vector of length n, creates a matrix whose rows consist of all possible combinations of the n elements of v taken k at a time.
Matrix C contains n!/((n–k)! k!) rows and k columns.
Inputs n, k, and v support classes of float double and float single.
Examples
The command nchoosek(2:2:10,4) returns the even numbers from two to ten, taken four at a time:
2 4 6 8
2 4 6 10
2 4 8 10
2 6 8 10
4 6 8 10
- 图像中添加二项式分布噪声
- 图像添加Beta分布噪声
- 图像添加柯西分布噪声
- F分布噪声图像
- 几何分布噪声图像
- 瑞利分布噪声图像
- t分布噪声图像
- 瑞利分布噪声图像
- 图像中添加高斯噪声
- 伽玛分布噪声图像
- 泊松分布噪声图像
- 威布尔分布噪声图像
- Opencv 图像添加噪声
- 图像添加噪声
- 图像添加椒盐噪声
- 给图像添加噪声
- 图像中噪声分类
- 图像基本噪声添加函数
- Spring 容器IOC解析及简单实现
- height、clientHeight、scrollHeight、offsetHeight区别
- 如何查找一个表中的索引
- $.unique()——JQuery
- 1234
- 图像中添加二项式分布噪声
- 关于POD
- Swift 异常处理 (待更新)
- javascript 杂记1
- java中如何定义一个泛型函数?
- PHP 魔术方法
- iOS中截图功能的实现
- selenium-安装-自动化环境准备-ide录制-1
- SVN:客户端适用独立客户端——TortoiseSvn