vector<vector<Point2d>>的有关问题 5C

vector>的形式，开始想用迭代器push_back来做，可是行不通，

vector > imagepoints[2];
vector > imagePoints[2];
for (vector>::iterator imP0 = imagePoints[0].begin(); imP0 != imagePoints[0].end(); imP0++)
{
imagepoints[0].push_back（imP0）;
}
push_back那一直说没有此类操作，想请问大神们该怎么解决，或是有什么其他办法？

2个回答

qqweh 可能是显示的原因因该是vector<vector<Point2f>>和vector<vector<Point2d>>
2 年多之前 回复
qqweh 我一开始也是这么想的，但改完以后仍然有红杠杠在push_back前的点上
2 年多之前 回复

`````` for (int i = 0;i < imagePoints[0].size();i++) {
imagepoints[0].push_back(imagePoints[0].at(i));
}
``````

qqweh 可能是显示的原因,因该是vector<vector<Point2f>>和vector<vector<Point2d>>
2 年多之前 回复
qqweh 我也试过想把它转成Mat，在转回去，可是好像都行不通哎。。。
2 年多之前 回复
qqweh 这些我都试过，可是一直报错，我就不知道怎么办了
2 年多之前 回复

vs c++ 关于类中vector成员的一些问题

A high-dimensional problem
Problem Description As we all know, a point in n-dimensional space can be represented as a vector (x1, x2, ..., xn), where xi is a real number. Given a vector D = (d1, d2, ..., dn), we can generate a series of planes perpendicular to D: each plane satisfies the condition that for any two point on the plane, say A = (a1, a2, ..., an), B = (b1, b2, ..., bn), the inner product of (A - B) and D is zero, ie. (a1 - b1) * d1 + (a2 - b2) * d2 + ... + (an - bn) * dn = 0, and we call D the normal vector of the plane. let A * B denotes the inner product of A and B. Here are n planes in n-dimensional space: S1, S2, ..., Sn with normal vector D1, D2, ..., Dn respectively. And P1, P2, ..., Pn lies on S1, S2,..., Sn respectively. We don't know the coordinates of P1, P2, ..., Pn, but instead we know D1 * P1, D2 * D2, ..., Dn * Pn. Can we find out the point of intersection of S1, S2, ..., Sn? Input There will be multiple test cases. Each data set will be formatted according to the following description: 1. A line containing two integers n, m, 3 <= n <= 100, 1 <= m <= n, m represents the number of queries to the same D1, D2, ..., Dn. 2. line 1 + i(1 <= i <= n) : n real number denoting the coordinates of Di. 3. line 1 + n + i(1 <= i <= m): n real number denoting D1 * P1, D2 * P2, ..., Dn * Pn. Output For each test data, there will be exactly m lines. For each query output a line containing the coordinates of the point of intersetion of S1, S2, ..., Sn.Round all the coordinates to the second digit after the decimal point.You may assume there will always be exactly one such point Sample Input 3 1 1 0 0 0 1 0 0 0 1 1 1 1 Sample Output 1.00 1.00 1.00
vector对象，push_back访问越界，怎么解决？

Vector上限问题，点云数据

OpenCV中對vector<Mat>添加return返還

class IPM { private: // Sizes cv::Size m_origSize; cv::Size m_dstSize; // Points std::vector<cv::Point2f> m_origPoints; std::vector<cv::Point2f> m_dstPoints; // Homography cv::Mat m_H; cv::Mat m_H_inv; // Maps cv::Mat m_mapX, m_mapY; cv::Mat m_invMapX, m_invMapY; void createMaps(); public: IPM( const cv::Size& _origSize, const cv::Size& _dstSize, const std::vector<cv::Point2f>& _origPoints, const std::vector<cv::Point2f>& _dstPoints ); // Apply IPM on points cv::Point2d applyHomography(const cv::Point2d& _point, const cv::Mat& _H); cv::Point3d applyHomography( const cv::Point3d& _point, const cv::Mat& _H); cv::Point2d applyHomography(const cv::Point2d& _point); cv::Point3d applyHomography( const cv::Point3d& _point); cv::Point2d applyHomographyInv(const cv::Point2d& _point); cv::Point3d applyHomographyInv( const cv::Point3d& _point); void applyHomography( const cv::Mat& _origBGR, cv::Mat& _ipmBGR, int borderMode = cv::BORDER_CONSTANT); void applyHomographyInv( const cv::Mat& _ipmBGR, cv::Mat& _origBGR, int borderMode = cv::BORDER_CONSTANT); // Draw void drawPoints( const std::vector<cv::Point2f>& _points, cv::Mat& _img ) const; //******************************************************************************************** //* SETTERS AND GETTERS //******************************************************************************************** cv::Mat getH() const { return m_H; } cv::Mat getHinv() const { return m_H_inv; } void getPoints(std::vector<cv::Point2f>& _origPts, std::vector<cv::Point2f>& _ipmPts); }; IPM::IPM( const Size& _origSize, const Size& _dstSize, const vector<Point2f>& _origPoints, const vector<Point2f>& _dstPoints ): m_origSize(_origSize), m_dstSize(_dstSize), m_origPoints(_origPoints), m_dstPoints(_dstPoints){ m_H = getPerspectiveTransform( m_origPoints, m_dstPoints ); m_H_inv = m_H.inv(); createMaps(); } IPM::IPM ipm( Size(imgG.cols, imgG.rows), Size(imgG.cols, imgG.rows), orgPts, dstPts ); // IPM object ipm.applyHomography( imgG, imgIpm ); 鼠标放在IPM::IPM ipm时会出现无法确定需要哪个重载函数 错误提示“IPM::{ctor}”: 函数调用缺少参数列表；请使用“&IPM::{ctor}”创建指向成员的指针 “ipm”: 找不到标识符

Draw 画图的问题
Problem Description huicpc0860 likes drawing,but not good at drawing.One day, he gets a software of drawing. The software provides a eraser B,you can consider it like a convex hull. Yet, the eraser can make your draw from black to white.Now give you a black convex hull A which you can consider like a drawing, and a white convex hull which is a eraser.Now, we only know the angle a between the eraser's moving direction and the x-axis,and I want to move the eraser the least distance to make the remaind part area of the drawing is K percent of the original's. Input First line is the number of soiled area A's vectors NA(3<=NA<=100).Follows NA lines, describes the convex polygon counterclockwise, each line has two decimal xi, yi ( -10000 ≤ xi, yi ≤ 10000) representatives one vector's coordinate. Then, another line is the number of soiled area B's vectors NB(3<=NB<=100).Follows NB lines, describes the convex polygon counterclockwise, each line has two decimal xi, yi ( -10000 ≤ xi, yi ≤ 10000) representatives one vector's coordinate. Lastest line has two decimal, a and K.a (0 ≤a< 360)is the direction's angle with x positive axis and K is the rate. Output Only one line for each case,the minimum distance D (retain four digitals after decimal point). If it's impossible to get,output -1. Sample Input 4 0 0 2 0 2 2 0 2 4 -2 0 -1 0 -1 1 -2 1 0 0.75 3 -2 -1 -1 0 -2 1 3 1 -1 2 0 1 1 180 0.5 Sample Output 2.0000 2.7071
Computational Geometry? 几何的计算
Problem Description Computational geometry is a branch of computer science devoted to the study of algorithms which can be stated in terms of geometry. It often comes up with charming shapes and ideas. In this problem, our poor princess is trapped in a castle by some bad guys again, yeah, again. So, let's seize the chance to be a hero. Right now, the beautiful princess is in the original point of a Cartesian coordinate system, for simplification, the castle is treated as a coordinate system, like a common computational geometry problem. There is a bomb which can be exploded anytime, and it locates at (Xo, Yo) in the castle. To save the princess, we need design a route for her to leave away the bomb as far as possible. But she already has a plan written on her notebook, which contains some vectors, and she insists on escaping in the vectors’ direction one by one, that is, if she is in point(0, 0), and the vector is (X, Y), she will be in point(X, Y) if she escapes in this vector. You get her notebook now, and find princess's plan is a not a good plan sometimes. Then you decide to help the princess to make some slight modification, you can change the order of those vectors, and/or reverse some vectors, that is, change vector (X, Y) to vector (-X, -Y). We want to know the maximum distance to the bomb after modification. Input The first line contains a single integer T, indicating the number of test cases. Each test case begins with three integers N, Xo, Yo. Then N lines following, each line contains two integers, Xi and Yi, indicating a vector. Technical Specification 1. 1 <= T <= 100 2. 1 <= N <= 100 3. -100 <= Xi, Yi <= 100 4. -10 000 <= Xo, Yo <= 10 000 Output For each test case, output the case number first, then the distance rounded to three fractional digits. Sample Input 3 1 1 1 1 1 2 2 3 -1 2 1 -2 3 3 0 2 3 3 2 1 -1 Sample Output Case 1: 2.828 Case 2: 7.000 Case 3: 9.849

void Cut_img(Mat src_img, int m, int n, vector<Mat> ceil_img) { int t = m * n; int height = src_img.rows; int width = src_img.cols; int ceil_height = height / m; int ceil_width = width / n; Mat roi_img, tmp_img; Point p1, p2; for (int i = 0; i<m; i++) for (int j = 0; j<n; j++) { //p1 = Rect rect(i + j*ceil_width, j + i*ceil_height, ceil_width, ceil_height); src_img(rect).copyTo(roi_img); ceil_img.push_back(roi_img); imshow("roi_img", roi_img); //getchar(); waitKey(0); //rectangle(i+j*ceil_width,j+i*ceil_height,); } } void show_images(vector<Mat> imgs, int n) { //do something } int _tmain(int argc, _TCHAR* argv[]) { Mat img = imread("dog.jpg", 1); imshow("src img", img); int m = 3; int n = 3; vector<Mat> ceil_img = m*n; Cut_img(img, m, n, ceil_img); waitKey(); return 0; } 整个代码是图片剪切的代码，问题出现在倒数第三行代码，cut_img(img,m,n,ceil_img); 错误为：不存在从"int"转换到"std::vector<cv::Mat,std::allocator<cv::Mat>>"的适当构造函数 还有错误C2440："初始化"：无法从“int”转换为"std::vector<cv::Mat,std::allocator<_Ty>>"
c++的范围for语句，关于auto
``` vector<vector<Point>> a; for(auto &b : a) { } ``` VS直接对for语句括号里的内容划红线，我想要b的类型是: ``` vector<Point> ``` 类型 为什么这种写法不对呢？
opencv和vs2013的问题，请大神帮忙

opencv Contours排序与筛选问题
opencv2 Contours如何按区域大小进么排序, vector\<vector\<Point\> \> contours; 。。。。。。 sort(contours.begin(), contours.end());//运行会报错，报的系统源文件错误 两个问题： 1、如何进其进行大小排序 2、如何排除完全的包含关系（筛选），见如下示例图片： ![图片说明](https://img-ask.csdn.net/upload/201606/05/1465118228_595751.jpg) contours画出来的矩形，想排除掉绿色的数据，因为它被完全包含了。 谢谢回答！
findContours函数问题
great为二值化后的图片 vector<vector<Point>> contours; vector<Vec4i> hierarchy; findContours(great, contours, hierarchy, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE); 在这段代码中用findContours进行轮廓检测程序结束后会触发一个断点，请各位大神求解

unity 射线方向问题，射线总是射到0.0.0上
``` void Update () { RaycastHit hit; Vector3 fwd = transform.TransformDirection(Vector3.forward);//创建一个射线的方向 if (Physics.Raycast(transform.position, fwd, out hit, 10))//这里的“10”是射线的最大距离 { ////划出射线，在scene视图中能看到的射线 Debug.DrawLine(transform.position, hit.point, Color.yellow); } else { Debug.DrawLine(transform.position, hit.point, Color.red); } } ``` 我这样子写，所有的射线都朝着 0.0.0 射过去了， 第二个方向参数怎么改都没用， 然后我在2d 里面试了一下 所有的射线又都朝着 摄像机坐标射过去，， 所以这个射线方向到底应该怎么写。。。 还有一个问题，这么写， 即使我在射线中添加 box 有碰撞体，但是射线还是能传过去。。。。。

Java学习的正确打开方式

linux系列之常用运维命令整理笔录

python 简易微信实现（注册登录+数据库存储+聊天+GUI+文件传输）
socket+tkinter详解+简易微信实现 历经多天的努力，查阅了许多大佬的博客后终于实现了一个简易的微信O(∩_∩)O~~ 简易数据库的实现 使用pands+CSV实现数据库框架搭建 import socket import threading from pandas import * import pymysql import csv # 创建DataFrame对象 # 存储用户数据的表（...

Python十大装B语法
Python 是一种代表简单思想的语言，其语法相对简单，很容易上手。不过，如果就此小视 Python 语法的精妙和深邃，那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点，并附上详细的实例代码。如能在实战中融会贯通、灵活使用，必将使代码更为精炼、高效，同时也会极大提升代码B格，使之看上去更老练，读起来更优雅。

2019年11月中国大陆编程语言排行榜
2019年11月2日，我统计了某招聘网站，获得有效程序员招聘数据9万条。针对招聘信息，提取编程语言关键字，并统计如下： 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...

《奇巧淫技》系列-python！！每天早上八点自动发送天气预报邮件到QQ邮箱

JavaScript 为什么能活到现在？

Nginx 原理和架构
Nginx 是一个免费的，开源的，高性能的 HTTP 服务器和反向代理，以及 IMAP / POP3 代理服务器。Nginx 以其高性能，稳定性，丰富的功能，简单的配置和低资源消耗而闻名。 Nginx 的整体架构 Nginx 里有一个 master 进程和多个 worker 进程。master 进程并不处理网络请求，主要负责调度工作进程：加载配置、启动工作进程及非停升级。worker 进程负责处...

Python 编程开发 实用经验和技巧
Python是一门很灵活的语言，也有很多实用的方法，有时候实现一个功能可以用多种方法实现，我这里总结了一些常用的方法和技巧，包括小数保留指定位小数、判断变量的数据类型、类方法@classmethod、制表符中文对齐、遍历字典、datetime.timedelta的使用等，会持续更新......

“狗屁不通文章生成器”登顶GitHub热榜，分分钟写出万字形式主义大作

《程序人生》系列-这个程序员只用了20行代码就拿了冠军

11月8日，由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办，科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。 　　区块链技术被认为是继蒸汽机、电力、互联网之后，下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力，电力解决了人类基本的生活需求，互联网彻底改变了信息传递的方式，区块链作为构造信任的技术有重要的价值。 　　1...
Python 植物大战僵尸代码实现(2):植物卡片选择和种植