资源简介
利用MATLAB程序对不同时间的两张图片进行变化检测,找出其中的变化部分
代码片段和文件信息
/* salient region detection
* image format: raw PGM
*
* described in:
* A Simple Method for Detecting Salient Regions
* Paul L. Rosin
* Pattern Recognition vol. 42 no. 11 pp. 2363-2371 2009.
*
* Paul Rosin
* September 2007
*/
#include
#include
#include
#ifndef FALSE
# define FALSE 0
# define TRUE (!FALSE)
#endif
#define SQR(x) ((x)*(x))
#define MAX_SIZE 2000
#include “pgmio.h“
int kernel[3][3] = {{121} {000} {-1-2-1}};
unsigned char image[MAX_SIZE][MAX_SIZE];
int dt_image[MAX_SIZE][MAX_SIZE];
unsigned char tmp[MAX_SIZE][MAX_SIZE];
unsigned char thresh[MAX_SIZE][MAX_SIZE];
double edges[MAX_SIZE][MAX_SIZE];
double summed_dt[MAX_SIZE][MAX_SIZE];
int heightwidthdepth;
main(argcargv)
int argc;
char *argv[];
{
int itxy;
char *infile*outfile*maskfile*saliencyfile;
infile = outfile = maskfile = saliencyfile = NULL;
/* parse command line */
for(i = 1; i < argc; i++) {
if (argv[i][0] == ‘-‘) {
switch(argv[i][1]) {
case ‘i‘:
i++;
infile = argv[i];
break;
case ‘m‘:
i++;
maskfile = argv[i];
break;
case ‘o‘:
i++;
outfile = argv[i];
break;
case ‘s‘:
i++;
saliencyfile = argv[i];
break;
default:
printf(“unknown option %s\n“argv[i]);
options(argv[0]);
}
}
else {
printf(“unknown option %s\n“argv[i]);
options(argv[0]);
}
}
if ((infile == NULL) || (outfile == NULL))
options(argv[0]);
read_pgm(imageinfile&width&height&depth);
sobel(imageedges);
/* for consistency with my original implementation
I rescale and copy the edges into an 8 bit image
*/
rescale(edgestmp);
for (y = 0; y < height; y++)
for (x = 0; x < width; x++)
summed_dt[x][y] = 0;
for (t = 4; t < 255; t += 4) {
// threshold
for (y = 0; y < height; y++)
for (x = 0; x < width; x++)
if (tmp[x][y] > t)
thresh[x][y] = 0;
else
thresh[x][y] = 255;
// perform DT
dt(threshdt_image);
// running DT sum
for (y = 0; y < height; y++)
for (x = 0; x < width; x++)
summed_dt[x][y] += dt_image[x][y];
}
/* set corners to average for the time being */
summed_dt[0][0] = (summed_dt[1][0] + summed_dt[0][1]) / 2;
summed_dt[0][height-1] = (summed_dt[1][height-1] + summed_dt[0][height-2]) / 2;
summed_dt[width-1][0] = (summed_dt[width-2][0] + summed_dt[width-1][1]) / 2;
summed_dt[width-1][height-1] = (summed_dt[width-2][height-1] + summe属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 154416 2007-09-24 10:26 19021.pgm
文件 80 2007-09-24 10:29 Makefile
文件 2383 2009-08-05 17:34 pgmio.h
文件 1304 2009-08-28 13:11 README
文件 10140 2009-08-28 13:12 salient_regions.c
- 上一篇:基于OLS 算法完成MG 时间序列问题
- 下一篇:模4可逆计数器
相关资源
- 基于matlab的图像处理源程序
- 引导图像滤波器 Matlab实现
- 图像小波变换MatLab源代码
- 冈萨雷斯数字图像处理matlab版(第三
- 基于区域生长的图像分割MATLAB
- 基于matlab 的图像处理100实例
- 8领域边界跟踪 图像处理 matlab
- 细胞图像分割matlab代码
- 图像的二进小波分解matlab源码(保证
- Matlab图像二值化和逆向二值化
- matlab-图像处理算法
- p文件,MATLAB的
- matlab 数字图像对比度拉伸算法
- MATLAB实现混沌图像加密仿真程序
- 数字图像处理radon matlab变换算法代码
- 图像匹配matlab源程序sift算法
- 图像降噪Matlab代码
- Matlab图像分割边缘提取算法
- 基于MATLAB的图像特征点匹配和筛选
- 传统关联成像、计算鬼成像matlab
- 医学图像重建作业matlab源码
- 高光谱图像pca分析特征提取
- MATLAB7.x图像处理
- SPECT图像重建与结果分析
- 图像的饱和度,亮度,色调的matlab代
- 系数绝对值最大 图像融合MATLAB算法
- MATLAB多聚焦图像融合将两张到六张不
- matlab实现对两幅图像的叠加
- 世上最牛的23个图像跟踪算法MATLAB程序
- 图像信息熵 matlab M文件
川公网安备 51152502000135号
评论
共有 条评论