[英]invalid cast from type ‘CvSeq’ to type ‘CvPoint* (How to typecast in Opencv)
i get the error at line below 我在下面的行中得到错误
Vertex2 = (CvPoint*)Vertices[I]; Vertex2 =(CvPoint *)Vertices [I]; //where vertices is cvseq of contour and Vertex2 is cvpoint
//其中顶点是轮廓的cvseq , 顶点 2是cvpoint
i get error invalid cast from type 'CvSeq' to type 'CvPoint* 我从类型'CvSeq'到类型'CvPoint *的错误无效转换
how do i solve this 我该如何解决
Are you just trying to get the address of the element in the array? 您是否只是在尝试获取数组中元素的地址? in which case you would go
在这种情况下,你会去
cvseq* Vertex2 = &Vertices[i];
A pointer called Vertex2 of type cvseq pointer whose value is the address of element i in the array Vertices. 一个名为Vertex2的指针,类型为cvseq指针,其值是数组顶点中元素i的地址。
UPDATE: 更新:
Just to help you know exactly what is wrong with your code. 只是为了帮助您确切地知道代码有什么问题。
'CvSeq' to type 'CvPoint*'
This is saying the you have a varaible of type CvPoint* (that would be your Vertex2) and you are trying to assign data of the type CvSeq. 这就是说您有一个CvPoint *类型的变量(那将是您的Vertex2),并且您正在尝试分配CvSeq类型的数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.