/* Resampling along the column (Type 1 and 2)
*
* Created by: Minh N. Do, March 2000
*/
#include "mex.h"
/*
function y = resampc(x, type, shift, extmod)
% RESAMPC Resampling along the column
%
% y = resampc(x, type, shift, extmod)
%
% Input:
% x: image that is extendable along the column direction
% type: either 1 or 2 (1 for shuffering down and 2 for up)
% shift: amount of shifts (typically 1)
% extmod: extension mode:
% 'per' periodic
% 'ref1' reflect about the edge pixels
% 'ref2' reflect, doubling the edge pixels
%
% Output:
% y: resampled image with:
% R1 = [1, shift; 0, 1] or R2 = [1, -shift; 0, 1]
*/
void
mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
double *x, *px; /* input matrix and pointer */
double *y, *py; /* result matrix and pointer */
int type; /* type of resampling */
int s; /* amount of shifts */
char extmod[10]; /* extension mode */
int i, j, k, m, n;
/* Parse input */
if (nrhs < 4)
mexErrMsgTxt("Not enough input for RESAMPC!");
x = mxGetPr(prhs[0]);
m = mxGetM(prhs[0]);
n = mxGetN(prhs[0]);
type = (int) mxGetPr(prhs[1])[0];
if ((type != 1) && (type != 2))
mexErrMsgTxt("The second input (type) must be either 1 or 2");
s = (int) mxGetPr(prhs[2])[0];
if (!mxIsChar(prhs[3]))
mexErrMsgTxt("EXTMOD arg must be a string");
mxGetString(prhs[3], extmod, 10);
/* Create output */
plhs[0] = mxCreateDoubleMatrix(m, n, mxREAL);
y = mxGetPr(plhs[0]);
px = x;
py = y;
if (strcmp(extmod, "per") == 0)
{
/* Resampling column-wise:
* y[i, j] = x[<i+sj>, j] if type == 1
* y[i, j] = x[<i-sj>, j] if type == 2
*/
for (j = 0; j < n; j++)
{
/* Circular shift in each column */
if (type == 1)
k = (s * j) % m;
else
k = (-s * j) % m;
/* Convert to non-negative mod if needed */
if (k < 0)
k += m;
for (i = 0; i < m; i++)
{
if (k >= m)
k -= m;
py[i] = px[k];
k++;
}
px += m;
py += m;
}
}
else
mexErrMsgTxt("Invalid EXTMOD");
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【达摩老生出品,必属精品,亲测校正,质量保证】 资源名:图像增强图像去噪_单尺度小波去噪_多尺度小波去噪_matlab 资源类型:matlab项目全套源码 源码说明: 全部项目源码都是经过测试校正后百分百成功运行的,如果您下载后不能运行可联系我进行指导或者更换。 适合人群:新手及有一定经验的开发人员
资源推荐
资源详情
资源评论
收起资源包目录
图像增强图像去噪_单尺度小波去噪_多尺度小波去噪_matlab (138个子文件)
ff3.bmp 350KB
ff5.bmp 350KB
ff4.bmp 350KB
lena.bmp 257KB
lena1.bmp 213KB
lena2.bmp 213KB
lena3.bmp 213KB
212.bmp 192KB
resampc.c 2KB
ChangeLog 2KB
COPYING 706B
resampc.dll 7KB
程序说明.doc 26KB
~$程序说明.doc 162B
ff3.fig 1.56MB
3.fig 1.56MB
2.fig 955KB
1.fig 168KB
lptoolbox.tar.gz 4KB
21.jpg 17KB
image003(2).jpg 11KB
image004(2).jpg 9KB
image002(2).jpg 8KB
image001(2).jpg 5KB
showpdfb.m 13KB
dccs_main.m 7KB
nlademo.m 5KB
computescale.m 5KB
cawenhance_main.m 4KB
greytrans.m 4KB
Contents.m 3KB
decdemo.m 3KB
contourenhance_main.m 3KB
dfilters.m 3KB
pdfbdec.m 3KB
denoisedemo.m 2KB
fbrec.m 2KB
dfbdec.m 2KB
fbdec.m 2KB
dfbrec.m 2KB
resampz.m 2KB
qup.m 2KB
remapim.m 2KB
pup.m 2KB
extend2.m 2KB
dfbdec_l.m 2KB
dfbimage.m 2KB
dfbrec_l.m 2KB
lpdemo.m 2KB
pfilters.m 2KB
qprec.m 2KB
qdown.m 2KB
upfilt.m 1KB
pdown.m 1KB
fbdec_l.m 1KB
pprec.m 1KB
qpdec.m 1KB
pdfbrec.m 1KB
mulscalewave.m 1KB
fbrec_l.m 1KB
wfb2rec.m 1KB
ppdec.m 1KB
wfb2dec.m 1KB
wenhance.m 1KB
filtdn.m 1KB
wavedenoise_main.m 1KB
sefilter2.m 1KB
resamp.m 1KB
pdfb2vec.m 1KB
pdfb_tr.m 1KB
nlademo2.m 1KB
qupz.m 1KB
rebacksamp.m 1KB
adjcontrast.m 1KB
backsamp.m 1KB
efilter2.m 1KB
vec2pdfb.m 1KB
lprec1.m 995B
probability.m 986B
shannon.m 979B
lprec.m 935B
pdfb_nest.m 931B
smthborder.m 930B
variance1.m 927B
fuzzy_s11.m 886B
mctrans.m 882B
lpwenhance_main.m 882B
ld2quin.m 856B
lpdec1.m 817B
modulate2.m 775B
xinxishang.m 770B
dup.m 755B
Cal_entropy.m 752B
lprec1_old.m 730B
lpdec.m 722B
lpdenhance_main.m 717B
lpd.m 698B
lpenhance_main.m 684B
adjgamma.m 669B
ldfilter.m 662B
共 138 条
- 1
- 2
资源评论
阿里matlab建模师
- 粉丝: 3280
- 资源: 2780
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功