cvMinMaxLoc函数实例
cvMinMaxLoc()的實作
#include <cv.h>
#include <highgui.h>
#include <stdio.h>
int main()
{
IplImage *Image1=cvLoadImage("grotto.jpg" ,1 );
double MinValue;
double MaxValue;
CvPoint MinLocation;
CvPoint MaxLocation;
cvSetImageCOI(Image1,1 );
cvMinMaxLoc(Image1,&
MinValue,&
MaxValue,&
MinLocation,&
MaxLocation);
printf("The Min number is : %.f/n" ,MinValue);
printf("The position is : ( %d , %d )/n" ,MinLocation.x,MinLocation.y);
printf("The Max number is : %.f/n" ,MaxValue);
printf("The position is : (%d , %d )/n" ,MaxLocation.x,MaxLocation.y);
cvNamedWindow("grotto" ,1 );
cvShowImage("grotto" ,Image1);
cvWaitKey(0 );
}
#include <highgui.h>
#include <stdio.h>
int main()
{
IplImage *Image1=cvLoadImage("grotto.jpg" ,1 );
IplImage *MaskImage1=cvLoadImage("grotto_Threshold.bmp" ,0 );
double MinValue;
double MaxValue;
CvPoint MinLocation;
CvPoint MaxLocation;
cvSetImageCOI(Image1,1 );
cvMinMaxLoc(Image1,&
MinValue,&
MaxValue,&
MinLocation,&
MaxLocation,MaskImage1);
printf("The Min number is : %.f/n" ,MinValue);
printf("The position is : ( %d , %d )/n" ,MinLocation.x,MinLocation.y);
printf("The Max number is : %.f/n" ,MaxValue);
printf("The position is : (%d , %d )/n" ,MaxLocation.x,MaxLocation.y);
cvNamedWindow("grotto" ,1 );
cvShowImage("grotto" ,Image1);
cvWaitKey(0 );
}
cvSetImageROI(result,resultrect);
cvMinMaxLoc(result, &min_val, &max_val,&min_loc,&max_loc, NULL );
center.x=min_loc.x-(int)objsize/2;center.y=min_loc.y-(int)objsize/2;
cvResetImageROI(result);
有时候,匹配要结合位置,所以之匹配的目标不一定是真正的目标。所以要求roi的最小值,这样写结果总不对,后来才发现,原来结果min_loc是roi的坐标,还要反算出原图的坐标。
trackback: http://blog.csdn.net/schoolers/article/details/4728400
转载于:https://www.cnblogs.com/JohnShao/archive/2011/08/24/2151804.html
cvMinMaxLoc函数实例相关推荐
- php脚本函数,PHP执行系统命令函数实例讲解
命令注入 命令注入(Command Injection),对一些函数的参数没有做过滤或过滤不严导致的,可以执行系统或者应用指令(CMD命令或者 bash 命令)的一种注入攻击手段. 常见的执行系统命令 ...
- 一张图说明 函数, 实例(对象), 原型之间的关系
前言 很多初学者都对函数,实例(对象), 原型之间的关系理不清楚. 网上五花八门的文章很多,要么不知所云,要么是晦涩难懂. 本文意在用最简洁的语言跟示例让初学者理清楚这三者之间的关系,无需理会其内部原 ...
- countif和sum套用_if函数嵌套countif、sumif函数实例操作详解 你需要学习了
excel中if函数嵌套countif函数实例操作详解,需要了解if函数.countif函数.sumif函数字符串引用方式,isblank函数 操作方法 01 用扫描枪连接excel后将自动将货物名称 ...
- python编程入门与案例详解课后题答案-Python入门之三角函数sin()函数实例详解
描述 sin()返回的x弧度的正弦值. 语法 以下是sin()方法的语法: importmath math.sin(x) 注意:sin()是不能直接访问的,需要导入math模块,然后通过math静态对 ...
- python编程入门与案例详解pdf-Python入门之三角函数sin()函数实例详解
描述 sin()返回的x弧度的正弦值. 语法 以下是sin()方法的语法: importmath math.sin(x) 注意:sin()是不能直接访问的,需要导入math模块,然后通过math静态对 ...
- python教程三角函数_Python入门之三角函数tan()函数实例详解
描述 tan() 返回x弧度的正弦值. 语法 以下是 tan() 方法的语法: import math math.tan(x) 注意:tan()是不能直接访问的,需要导入 math 模块,然后通过 m ...
- python3 next_对Python 3.2 迭代器的next函数实例讲解
在python中,使用iter函数可以获得有序聚合类型的迭代器,我个人将迭代器理解为带有next指针的单向链表,获取到的迭代器为链表的表头,表头内容为空,next指针指向有序聚合类型的第一个元素.在访 ...
- 中文字符串函数php,php截取中文字符串函数实例,_PHP教程
php截取中文字符串函数实例, 本文实例讲述了php截取中文字符串函数.分享给大家供大家参考.具体实现方法如下: 复制代码 代码如下: //中文字符串截取 function substr_zh($st ...
- python中字典的常用函数_Python字典dict常用方法函数实例
dict={'name':'Joe','age':18,'height':60} clear,清空 dict.clear() #运行结果{} pop,移除指定key的键值对并返回vlaue(如果没有该 ...
最新文章
- print(__doc__)
- php alert 乱码
- python有趣代码-wtfPython―Python中一组有趣微妙的代码【收藏】
- 如何量化考核技术人的 KPI?
- 3信号处理之:避免异步IO的类型,SIGCHLD信号处理
- Dev GridView 绑定Listlt;Tgt;、BindingList lt;Tgt;、BindingSource
- 小论接口(interface)和抽象类(abstract class)的区别
- 汽车电子知识篇(十二)-汽车域控制器主芯片选型
- LeetCode 1618. 找出适应屏幕的最大字号(二分查找)
- Java学习路线,你值得了解
- linux home目录重装,Linux/centos 卸载重装
- Linux性能分析之IO篇
- Safe Or Unsafe(hdu2527)哈弗曼VS优先队列
- hdu 4536 dfs
- 学习笔记: PCIe 4.0 协议(一)-- 概述
- 原来PDF解密有这么多方法,你知道几个?
- oracle自增序列带字母,[原创]Oracle自增序列
- 【STC15系列】SYK-0806-A2S1 工业自动化控制之【05-定时器控制的流水灯】
- 支持多线程的DRB server
- 【Linux操作系统基础】第六章 Linux中的进程管理