【opencv基础】OpenCV从Mat中提取某些行或列
前言
Opencv中可以调用函数提取某些连续的行或者列,Mat的rowRange和colRange可以获取某些范围内行或列的指针;
这两个函数返回的是指向原矩阵内部位置的指针,类似于浅拷贝;
example
cv::Mat align_mean(cv::Mat mean, cv::Rect facebox, float scaling_x=1.0f, float scaling_y=1.0f, float translation_x=0.0f, float translation_y=0.0f)
{
using cv::Mat;
// Initial estimate x_0: Center the mean face at the [-0.5, 0.5] x [-0.5, 0.5] square (assuming the face-box is that square)
// More precise: Take the mean as it is (assume it is in a space [-0.5, 0.5] x [-0.5, 0.5]), and just place it in the face-box as
// if the box is [-0.5, 0.5] x [-0.5, 0.5]. (i.e. the mean coordinates get upscaled)
Mat aligned_mean = mean.clone();
Mat aligned_mean_x = aligned_mean.colRange(, aligned_mean.cols / );
Mat aligned_mean_y = aligned_mean.colRange(aligned_mean.cols / , aligned_mean.cols);
aligned_mean_x = (aligned_mean_x*scaling_x + 0.5f + translation_x) * facebox.width + facebox.x;
aligned_mean_y = (aligned_mean_y*scaling_y + 0.3f + translation_y) * facebox.height + facebox.y;
return aligned_mean;
}
引申
如果要提取Mat数据某些间隔的行、列呢??比如只提取奇数行或者偶数行,或者每隔3行提取数据。。。
分析:之前博主是由vector得到的Mat,所以可以在最开始得到Mat的过程中就间隔提取数据。
参考
完
【opencv基础】OpenCV从Mat中提取某些行或列的更多相关文章
- 调用opencv相关函数,从视频流中提取出图片序列&&&&jpg图片序列,转化成avi格式视频
/************************ @HJ 2017/3/30 参考http://blog.sina.com.cn/s/blog_4b0020f301010qcz.html修改的代码 ...
- 【转】MySQL存储过程中使用动态行转列
MySQL存储过程中使用动态行转列 最近做项目关于数据报表处理,然而数据库存储格式和报表展现形式不同,需要进行一下行转列的操作,在做上一个项目的时候也看了一下,但是后来换了读取方式,也就没深入研究这个 ...
- WPF 在画布中布局N行N列的实现方法
最近写一个WPF项目,中间有一个实现在画布中排列的问题(整齐摆列几行几列的算法).本人逻辑有点差啊,废了老大功夫才实现,也没啥就牛逼的,就是拿出来分享一下,给需要的同学节省点时间,如果有用的话别忘赞一 ...
- 用JavaScript,获取Table中指定的行、列
前言: 先要谢谢George Wing的慷慨赠书<悟透JavaScript>,让我更加感受到了技术交流的重要性,呵呵~ 进入正题,面试题中有一题:如何通过JavaScript获取Table ...
- Bootstrap3基础 栅格系统 列中有行,行中有列
内容 参数 OS Windows 10 x64 browser Firefox 65.0.2 framework Bootstrap 3.3.7 editor ...
- 转Delphi中Memo显示行号列号
http://www.alonely.com.cn/Delphi/20160814/8912.html 实例说明本例是个光标应用的简单技巧,希望通过这个例子的学习后能举一反三.Delphi中像这样简单 ...
- 在GridView的RowDataBound事件中获取某行某列的值!
protected void gdvOrders_RowDataBound(object sender, GridViewRowEventArgs e) { if (e ...
- SQL Server中使用PIVOT行转列
使用PIVOT行转列 1.建表及插入数据 USE [AdventureDB] GO /****** Object: Table [dbo].[Score] Script Date: 11/25/201 ...
- Hive基础之Hive开启查询列名及行转列显示
Hive默认情况下查询结果里面是只显示值: hive> select * from click_log; OK ad_101 :: ad_102 :: ad_103 :: ad_104 :: a ...
随机推荐
- Ubuntu 定时任务
一.cron相关命令 #重载cron sudo service cron reload #查看cron状态 service cron status #查看cron pid pidof ...
- Codeforces 96C - Hockey
96C - Hockey 字符串处理 代码: #include<bits/stdc++.h> using namespace std; #define ll long long ; con ...
- [don't have permission to access]的一个经典原因
那就是 ..... SELinux ...... 几年前好像经历过这个恶梦.现在又经历了一回. 从Windows上传了一个目录,做一个apache的别名Alias, 结果总是没有权限. chmod 7 ...
- C++中基类虚析构函数的作用及其原理分析
虚析构函数的理论前提是 执行完子类的析构函数,那么父类的虚构函数必然会被执行. 那么当用delete释放一个父类指针所实例化的子类对象时,如果没有定义虚析构函数,那么将只会调用父类的析构函数,而不会调 ...
- Oracle11g温习-第一章 1、ORACLE实例
2013年4月27日 星期六 10:23 1.ORACLE 实例 System Global Area(SGA) 和 Background Process(后台进程) 称为数据库的实例. 2.ORAC ...
- spring--boot数据库连接以及class建表
Spring-Boot 数据库连接以及class建表 提前在pom.xml文件中添加:jpa,mysql资源 <dependency> <groupId>org.spring ...
- cas 服务端相关配置
SSO-安全证书配置 CAS默认使用的是HTTPS协议,如果对安全要求不高,可以使用HTTP协议 修改deployerConfigContext.xml(cas/WEB-INF)增加参数 p:requ ...
- Wifi Troughput Test using iperf
learning wifi throughput test using iperf [Purpose] Learning how to do wifi throughput test u ...
- learning docker steps(8) ----- docker network 初次体验
参考: docker network 主要是介绍了docker 容器之间的组网模式, 一般来说实像组网主要是依赖于bridge iptalbes vlan来实现,但是附带的如端口转发会降低效率. 新型 ...
- Our supersheet
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...