数字图像的基本运算

数字图像的基本运算

实验任务

  • 用数字运算符合实现图像的加减乘运算。
  • 用IPT函数实现图像的加减乘运算。
  • 实现图像的缩放。
  • 实现图像的旋转。

设计函数

imresize

  • 功能 :改变图像的大小。
  • 函数原型 :
    • B = imresize(A,m)
    • B = imresize(A,m,method)
    • B = imresize(A,[mrows ncols],method)
  • PS :
    • mrersize函数使用由参数method指定的插值运算来改变图像的大小。
    • method的几种可选值:
      • ’nearest’(默认值)最近邻插值
      • ‘bilinear’双线性插值
      • ‘bicubic’双三次插值
    • B = imresize(A,m)表示把图像A放大m倍
    • B = imresize(…,method,h)中的h可以是任意一个FIR滤波器(h通常由函数ftrans2、fwind1、fwind2、或fsamp2等生成的二维FIR滤波器)。

imrotate

  • 功能 :对图像进行旋转操作。
  • 函数原型 :
    • B = imrotate(A,angle)
    • B = imrotate(A,angle,method)
    • B = imrotate(A,angle,m
  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好资源#include <iostream> #include <string> #include <queue> using namespace std; //表结点 typedef struct ArcNode{ int adjvex;//该弧所指向的顶点的位置 ArcNode *nextarc;//指向下一条弧的指针 }ArcNode; //头结点 typedef struct VNode{ string data;//顶点信息 ArcNode* firstarc;//第一个表结点的地址,指向第一条依附该顶点的弧的指针 }VNode, AdjList[10]; typedef struct{ AdjList vertices; int vexnum, arcnum;//图的顶点数和弧数 }ALGraph; int LocateVex(ALGraph G, string u)//返回顶点u在图中的位置 { for(int i=0; i<G.vexnum; i++) if(G.vertices[i].data==u) return i; return -1; } void CreateUDG(ALGraph &G)//构造无向图 { string v1, v2; int i, j, k; cout<<"请输入顶点数和边数:"; cin>>G.vexnum>>G.arcnum; cout<<"请输入顶点:"; for(i=0; i<G.vexnum; i++) { cin>>G.vertices[i].data; G.vertices[i].firstarc=NULL; } cout<<"请输入边:"; cout<<endl; for(k=0; k<G.arcnum; k++) { cin>>v1>>v2; i=LocateVex(G, v1); j=LocateVex(G, v2); //插入v1的邻接表,为了提高效率,总在表头插入结点。 ArcNode *arc=new ArcNode; arc->adjvex=j; arc->nextarc=G.vertices[i].firstarc; G.vertices[i].firstarc=arc; //插入v2的邻接表,为了提高效率,总在表头插入结点。 arc=new ArcNode; arc->adjvex=i; arc->nextarc=G.vertices[j].firstarc; G.vertices[j].firstarc=arc; } } void Print(ALGraph G)//打印邻接表 { cout<<"打印邻接表如下:"; cout<<endl; for(int i=0; i<G.vexnum; i++)//遍历每个顶点的邻接表 { cout<<G.vertices[i].data; ArcNode *p=G.vertices[i].firstarc; while(p) { cout<<"->"<<G.vertices[p->adjvex].data; p=p->nextarc; } cout<<endl; } } int FirstAdjVex(ALGraph G, int v)//返回顶点v的第一个邻接点序号 { ArcNode *p=G.vertices[v].firstarc; if(p) return p->adjvex; else return -1; } int NextAdjVex(ALGraph G, int v, int w)//返回顶点v的相对于w的下一个邻接点序号 { ArcNode* p=G.vertices[v].firstarc; while(p) { if(p->adjvex==w) break; p=p->nextarc; } if(p->adjvex!=w || !p->nextarc)//如果没找到w或者w是最后一个邻接点 return -1; return p->nextarc->adjvex; } bool visited[10]; void DFS(ALGraph G, int v) { visited[v]=true; cout<<G.vertices[v].data<<" "; for(int w=FirstAdjVex(G, v); w>=0; w=NextAdjVex(G, v, w) ) if(!visited[w]) DFS(G, w); } void DFSTraverse(ALGraph G)//深搜 { for(int i=0; i<G.vexnum; i++) visited[i]=false; for(i=0; i<G.vexnum; i++) if(!visited[i]) DFS(G, i); } void BFSTraverse(ALGraph G)//广搜 { queue<int> q; for(int i=0; i<G.vexnum; i++) visited[i]=false; for(i=0; i<G.vexnum; i++) { if(!visited[i]) { q.push(i); visited[i]=true; while(!q.empty()) { int v=q.front(); q.pop(); cout<<G.vertices[v].data<<" "; for(int w=FirstAdjVex(G, v); w>=0; w=NextAdjVex(G, v, w)) { if (!visited[w]) { q.push(w); visited[w]=true; } } } } } } void main() { ALGraph G; CreateUDG(G); Print(G); cout<<"深搜:"; DFSTraverse(G); cout<<endl; cout<<"广搜:"; BFSTraverse(G); cout<<endl; }

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值