opencv投影
来源:互联网 发布:网络成瘾症如何治疗 编辑:程序博客网 时间:2024/05/29 08:58
// OpencvTest.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "opencv/cv.h"
#include "opencv/highgui.h"
#include "opencv/ml.h"
#include <afx.h>
#include "math.h"
using namespace cv;
using namespace std;
Mat hp, vp;
void HProjection(const Mat& src, Mat& dst)
{
// accept only char type matrices
CV_Assert(src.depth() != sizeof(uchar));
dst.create(src.rows, 1, CV_32F);
int i, j;
const uchar* p;
float* p_dst;
p_dst = dst.ptr<float>(0);
for(i = 0; i < src.rows; i++)
{
p = src.ptr<uchar>(i);
p_dst[i] = 0;
for(j = 0; j < src.cols; j++)
{
p_dst[i] += p[j];
}
}
}
void VProjection(const Mat& src, Mat& dst)
{
CV_Assert(src.depth() != sizeof(uchar));
dst.create(1, src.cols, CV_32F);
int i,j;
const uchar* p;
float * p_dst = dst.ptr<float>(0);
for (i = 0; i < src.cols; i++)
{
p_dst[i] = 0;
for (j=0; j < src.rows; j++)
{
p = src.ptr<uchar>(j);
p_dst[i] += p[i];
}
cout << p_dst[i] << endl;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
Mat src1Test = (Mat_<uchar>(3,3) << 1,2,3,4,5,6,7,8,9);
HProjection(src1Test, hp);
VProjection(src1Test, vp);
cout << src1Test << endl;
cout << "hp:" << endl;
cout << hp << endl;
cout << "vp" << endl;
cout << vp << endl;
waitKey(0);
}
- opencv投影
- OPENCV 行列投影
- opencv 反向投影
- OpenCV反向投影
- opencv 直方图反向投影
- opencv反向投影
- opencv-反投影
- opencv 直方图反向投影
- OpenCV计算反向投影
- opencv 直方图反向投影
- [OpenCV]图像的投影校正
- OpenCV学习笔记--反向投影
- OPENCV 反向投影的理解
- OpenCv 投影与三维视觉
- 【opencv练习30 - 反投影】
- opencv-python实现水平投影
- opencv-python图像垂直投影
- opencv学习之反向投影
- Linux下彻底卸载mysql数据库
- 实训感悟
- android中数据库sqlite的增删改查
- Alisha’s Party--2015 ACM/ICPC Asia Regional Changchun Online
- java 时间转换
- opencv投影
- 使用InjectView和findViewById说拜拜
- Sort List
- Linux 学习笔记一 :文件拆分和后台执行
- 青蛙跳台阶
- Linux与android进程间的通信及android Binder机制详解
- HDU_3277_Marriage Match III(最大流)
- android的内容提供者范例
- Volley网络通信框架、XUtils