/*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; File: edges.c
;;; Author: Eero Simoncelli
;;; Description: Boundary handling routines for use with convolve.c
;;; Creation Date: Spring 1987.
;;; MODIFIED, 6/96, to operate on double float arrays.
;;; MODIFIED by dgp, 4/1/97, to support THINK C.
;;; MODIFIED, 8/97: reflect1, reflect2, repeat, extend upgraded to
;;; work properly for non-symmetric filters. Added qreflect2 to handle
;;; even-length QMF's which broke under the reflect2 modification.
;;; ----------------------------------------------------------------
;;; Object-Based Vision and Image Understanding System (OBVIUS),
;;; Copyright 1988, Vision Science Group, Media Laboratory,
;;; Massachusetts Institute of Technology.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
*/
/* This file contains functions which determine how edges are to be
handled when performing convolutions of images with linear filters.
Any edge handling function which is local and linear may be defined,
except (unfortunately) constants cannot be added. So to treat the
edges as if the image is surrounded by a gray field, you must paste it
into a gray image, convolve, and crop it out... The main convolution
functions are called internal_reduce and internal_expand and are
defined in the file convolve.c. The idea is that the convolution
function calls the edge handling function which computes a new filter
based on the old filter and the distance to the edge of the image.
For example, reflection is done by reflecting the filter through the
appropriate axis and summing. Currently defined functions are listed
below.
*/
#include <stdio.h>
#include <math.h>
#include <string.h>
#include "convolve.h"
#define sgn(a) ( ((a)>0)?1:(((a)<0)?-1:0) )
#define clip(a,mn,mx) ( ((a)<(mn))?(mn):(((a)>=(mx))?(mx-1):(a)) )
int reflect1(), reflect2(), qreflect2(), repeat(), zero(), Extend(), nocompute();
int ereflect(), predict();
/* Lookup table matching a descriptive string to the edge-handling function */
#if !THINK_C
static EDGE_HANDLER edge_foos[] =
{
{ "dont-compute", nocompute }, /* zero output for filter touching edge */
{ "zero", zero }, /* zero outside of image */
{ "repeat", repeat }, /* repeat edge pixel */
{ "reflect1", reflect1 }, /* reflect about edge pixels */
{ "reflect2", reflect2 }, /* reflect image, including edge pixels */
{ "qreflect2", qreflect2 }, /* reflect image, including edge pixels
for even-length QMF decompositions */
{ "extend", Extend }, /* extend (reflect & invert) */
{ "ereflect", ereflect }, /* orthogonal QMF reflection */
};
#else
/*
This is really stupid, but THINK C won't allow initialization of static variables in
a code resource with string addresses. So we do it this way.
The 68K code for a MATLAB 4 MEX file can only be created by THINK C.
However, for MATLAB 5, we'll be able to use Metrowerks CodeWarrior for both 68K and PPC, so this
cludge can be dropped when we drop support for MATLAB 4.
Denis Pelli, 4/1/97.
*/
static EDGE_HANDLER edge_foos[8];
void InitializeTable(EDGE_HANDLER edge_foos[])
{
static int i=0;
if(i>0) return;
edge_foos[i].name="dont-compute";
edge_foos[i++].func=nocompute;
edge_foos[i].name="zero";
edge_foos[i++].func=zero;
edge_foos[i].name="repeat";
edge_foos[i++].func=repeat;
edge_foos[i].name="reflect1";
edge_foos[i++].func=reflect1;
edge_foos[i].name="reflect2";
edge_foos[i++].func=reflect2;
edge_foos[i].name="qreflect2";
edge_foos[i++].func=qreflect2;
edge_foos[i].name="extend";
edge_foos[i++].func=Extend;
edge_foos[i].name="ereflect";
edge_foos[i++].func=ereflect;
}
#endif
/*
Function looks up an edge handler id string in the structure above, and
returns the associated function
*/
fptr edge_function(char *edges)
{
int i;
#if THINK_C
InitializeTable(edge_foos);
#endif
for (i = 0; i<sizeof(edge_foos)/sizeof(EDGE_HANDLER); i++)
if (strcmp(edges,edge_foos[i].name) IS 0)
return(edge_foos[i].func);
printf("Error: '%s' is not the name of a valid edge-handler!\n",edges);
for (i=0; i<sizeof(edge_foos)/sizeof(EDGE_HANDLER); i++)
{
if (i IS 0) printf(" Options are: ");
else printf(", ");
printf("%s",edge_foos[i].name);
}
printf("\n");
return(0);
}
/*
---------------- EDGE HANDLER ARGUMENTS ------------------------
filt - array of filter taps.
x_dim, y_dim - x and y dimensions of filt.
x_pos - position of filter relative to the horizontal image edges. Negative
values indicate left edge, positive indicate right edge. Zero
indicates that the filter is not touching either edge. An absolute
value of 1 indicates that the edge tap of the filter is over the
edge pixel of the image.
y_pos - analogous to x_pos.
result - array where the resulting filter will go. The edge
of this filter will be aligned with the image for application...
r_or_e - equal to one of the two constants EXPAND or REDUCE.
--------------------------------------------------------------------
*/
/* --------------------------------------------------------------------
nocompute() - Return zero for values where filter hangs over the edge.
*/
int nocompute(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
register double *filt, *result;
register int x_dim;
int y_dim, x_pos, y_pos, r_or_e;
{
register int i;
register int size = x_dim*y_dim;
if ( (x_pos>1) OR (x_pos<-1) OR (y_pos>1) OR (y_pos<-1) )
for (i=0; i<size; i++) result[i] = 0.0;
else
for (i=0; i<size; i++) result[i] = filt[i];
return(0);
}
/* --------------------------------------------------------------------
zero() - Zero outside of image. Discontinuous, but adds zero energy. */
int zero(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
register double *filt, *result;
register int x_dim;
int y_dim, x_pos, y_pos, r_or_e;
{
register int y_filt,x_filt, y_res,x_res;
int filt_sz = x_dim*y_dim;
int x_start = ((x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0));
int y_start = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
int i;
for (i=0; i<filt_sz; i++) result[i] = 0.0;
for (y_filt=0, y_res=y_start;
y_filt<filt_sz;
y_filt+=x_dim, y_res+=x_dim)
if ((y_res >= 0) AND (y_res < filt_sz))
for (x_filt=y_filt, x_res=x_start;
x_filt<y_filt+x_dim;
x_filt++, x_res++)
if ((x_res >= 0) AND (x_res < x_dim))
result[y_res+x_res] = filt[x_filt];
return(0);
}
/* --------------------------------------------------------------------
reflect1() - Reflection through the edge pixels. Continuous, but
discontinuous first derivative. This is the right thing to do if you
are subsampling by 2, since it maintains parity (even pixels positions
remain even, odd ones remain odd).
*/
int reflect1(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e)
register double *filt, *result;
register int x_dim;
int y_dim, x_pos, y_pos, r_or_e;
{
int filt_sz = x_dim*y_dim;
register int y_filt,x_filt, y_res, x_res;
register int x_base = (x_pos>0)?(x_dim-1):0;
register int y_base = x_dim * ((y_pos>0)?(y_dim-1):0);
int x_overhang = (x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0);
int y_overhang = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0));
int i;
int mx_pos = (x_pos<0)?(x_dim/2):((x_dim-1)/2);
int my_pos = x_dim * ((y_pos<0)?(y_dim/2):((y_dim-1)/2));
for (i=0; i<filt_sz; i++) result[i] = 0.0;
if (r_or_e IS REDUCE)
for (y_filt=0, y_res=y_overhang-y_base;
y_filt<filt_sz;
y_filt+=x_dim, y_res+=x_dim)
for (x_filt=y_filt, x_res=x_overhang-x_base;
x_filt<y_filt+x_dim;
没有合适的资源?快使用搜索试试~ 我知道了~
EZW.rar_EZW_matlab EZW
共207个文件
m:135个
c:11个
bmp:11个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 129 浏览量
2022-09-19
15:49:28
上传
评论
收藏 3.49MB RAR 举报
温馨提示
jpeg compressionnnnnnnn
资源推荐
资源详情
资源评论
收起资源包目录
EZW.rar_EZW_matlab EZW (207个子文件)
lijnen.bmp 192KB
boltrans.bmp 103KB
lena256.bmp 65KB
lena256_reconstruct.bmp 65KB
homer256.bmp 65KB
barb.bmp 65KB
lijnen2.bmp 65KB
lijnen3.bmp 65KB
circuit256.bmp 65KB
bol.bmp 8KB
bolwit.bmp 8KB
edges.c 22KB
edges-orig.c 16KB
dominant_pass_c.c 12KB
convolve.c 11KB
wrap.c 8KB
upConv.c 6KB
corrDn.c 5KB
histo.c 4KB
pointOp.c 4KB
range2.c 2KB
innerProd.c 1KB
ChangeLog 14KB
Thumbs.db 18KB
upConv.dll 50KB
corrDn.dll 49KB
innerProd.dll 41KB
pointOp.dll 34KB
range2.dll 33KB
histo.dll 8KB
lenna.gif 258KB
lenna256.gif 60KB
convolve.h 2KB
Macintosh-MEX.sit.hqx 905KB
lijnen3.jpg 3KB
barb.jpg 2KB
lijnen2.jpg 2KB
lijnen.jpg 2KB
pyramids.m 38KB
arith07.m 29KB
arith06.m 19KB
sp3Filters.m 17KB
sp1Filters.m 9KB
sp5Filters.m 7KB
showIm.m 6KB
dominant_pass.m 6KB
sp0Filters.m 6KB
showWpyr.m 6KB
showLpyr.m 5KB
Contents.m 5KB
showSpyr.m 5KB
treemask_sp.m 5KB
treemask(slow).m 5KB
func_dominant_pass.m 4KB
reconWpyr.m 4KB
matlabPyrTools.m 4KB
compress.m 3KB
buildSFpyr.m 3KB
namedFilter.m 3KB
pgmWrite.m 3KB
reconSFpyr.m 3KB
ezw_encode.m 3KB
ezw_encode.m 3KB
upConv.m 3KB
reconSpyr.m 3KB
buildLpyr.m 3KB
buildWpyr.m 3KB
decode_significancemap.m 2KB
subordinate_pass.m 2KB
mkSquare.m 2KB
corrDn.m 2KB
huffman_encode.m 2KB
ezw_smooth.m 2KB
func_huffman_decode.m 2KB
reconLpyr.m 2KB
func_Mywavedec2.m 2KB
wave_transform_qmf.m 2KB
buildSpyr.m 2KB
reconSFpyrLevs.m 2KB
steer.m 2KB
huffman_decode.m 2KB
pixelAxes.m 2KB
func_ezw_demo_main.m 2KB
buildGpyr.m 2KB
buildSFpyrLevs.m 2KB
histo.m 2KB
steer2HarmMtx.m 2KB
ezw_decode.m 2KB
mkSine.m 2KB
func_huffman_encode.m 2KB
func_InvDWT.m 2KB
func_decode_significancemap.m 2KB
func_Myappcoef2.m 2KB
func_subordinate_pass.m 2KB
decompress.m 2KB
rearrange_list.m 2KB
decode_refine.m 2KB
func_DWT.m 2KB
func_ezw_enc.m 2KB
wave_transform.m 2KB
共 207 条
- 1
- 2
- 3
资源评论
Kinonoyomeo
- 粉丝: 76
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- cn-msdn-library-for-visual-studio-2008-service-pack-1-x86-dvd-x1
- cn-msdn-library-for-visual-studio-2008-service-pack-1-x86-dvd-x1
- cn-msdn-library-for-visual-studio-2008-service-pack-1-x86-dvd-x1
- Screenshot_20240517_181056.jpg
- Oracle中查询哪个存储过程中引用包含T-USER-INFO表语句的命令脚本
- 一个图层擦除掉多个不需要的图层
- c语言UDP传输系统源码
- 易语言驱动级进程名拦截网络
- 基于Chisel3完成基于Mips32R1指令集处理器的设计与实现
- 编程项目+ASP.NET+人事管理系统+项目实战
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功