Vb.net 从OpenCV.点阵列中选择整数阵列

Vb.net 从OpenCV.点阵列中选择整数阵列,vb.net,linq,select,opencvsharp,Vb.net,Linq,Select,Opencvsharp,我试图从OpenCvSharp.Point数组中选择整数 Dim hull() As Integer = Cv2.ConvexHullIndices(origPoints.Skip(48)).Select(i >= i + 48) 这一行失败,编译器告诉我错误重载,因为这些类型的参数没有[Select] 正确的方法是什么 origPoints的声明如下: Dim origPoints() As OpenCvSharp.Point Public Shared Function Conv

我试图从OpenCvSharp.Point数组中选择整数

Dim hull() As Integer = Cv2.ConvexHullIndices(origPoints.Skip(48)).Select(i >= i + 48)
这一行失败,编译器告诉我错误重载,因为这些类型的参数没有[Select]

正确的方法是什么

origPoints的声明如下:

Dim origPoints() As OpenCvSharp.Point 
Public Shared Function ConvexHullIndices(points As IEnumerable(Of Point), Optional clockwise As Boolean = False) As Integer()
#Region "Assembly OpenCvSharp, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=6adad1e807fea099"
' D:\Dev\Projects\faceshift\faceshift\packages\OpenCvSharp3- 
AnyCPU.3.4.1.20180830\lib\net46\OpenCvSharp.dll
#End Region

Imports System

Namespace OpenCvSharp
'
Public Structure Point
    Implements IEquatable(Of Point)
    '
    Public Const SizeOf As Integer = 8
    '
    Public X As Integer
    '
    Public Y As Integer

    '
    ' Parameter:
    '   x:
    '
    '   y:
    Public Sub New(x As Integer, y As Integer)
    '
    ' Parameter:
    '   x:
    '
    '   y:
    Public Sub New(x As Double, y As Double)

    '
    ' Zusammenfassung:
    '     Calculates the dot product of two 2D vectors.
    '
    ' Parameter:
    '   p1:
    '
    '   p2:
    Public Shared Function DotProduct(p1 As Point, p2 As Point) As Double
    '
    ' Zusammenfassung:
    '     Returns the distance between the specified two points
    '
    ' Parameter:
    '   p1:
    '
    '   p2:
    Public Shared Function Distance(p1 As Point, p2 As Point) As Double
    '
    ' Zusammenfassung:
    '     Calculates the cross product of two 2D vectors.
    '
    ' Parameter:
    '   p1:
    '
    '   p2:
    Public Shared Function CrossProduct(p1 As Point, p2 As Point) As Double
    '
    ' Zusammenfassung:
    '     Calculates the dot product of two 2D vectors.
    '
    ' Parameter:
    '   p:
    Public Function DotProduct(p As Point) As Double
    '
    ' Zusammenfassung:
    '     Returns the distance between the specified two points
    '
    ' Parameter:
    '   p:
    Public Function DistanceTo(p As Point) As Double
    '
    ' Zusammenfassung:
    '     Converts this object to a human readable string.
    '
    ' Rückgabewerte:
    '     A string that represents this object.
    Public Overrides Function ToString() As String
    '
    ' Zusammenfassung:
    '     Returns a hash code for this object.
    '
    ' Rückgabewerte:
    '     An integer value that specifies a hash value for this object.
    Public Overrides Function GetHashCode() As Integer
    '
    ' Zusammenfassung:
    '     Specifies whether this object contains the same members as the specified Object.
    '
    ' Parameter:
    '   obj:
    '     The Object to test.
    '
    ' Rückgabewerte:
    '     This method returns true if obj is the same type as this object and has the same
    '     members as this object.
    Public Overrides Function Equals(obj As Object) As Boolean
    '
    ' Zusammenfassung:
    '     Calculates the cross product of two 2D vectors.
    '
    ' Parameter:
    '   p:
    Public Function CrossProduct(p As Point) As Double
    '
    ' Zusammenfassung:
    '     Specifies whether this object contains the same members as the specified Object.
    '
    ' Parameter:
    '   obj:
    '     The Object to test.
    '
    ' Rückgabewerte:
    '     This method returns true if obj is the same type as this object and has the same
    '     members as this object.
    Public Function Equals(obj As Point) As Boolean

    '
    ' Zusammenfassung:
    '     Unary plus operator
    '
    ' Parameter:
    '   pt:
    Public Shared Operator +(pt As Point) As Point
    '
    ' Zusammenfassung:
    '     Shifts point by a certain offset
    '
    ' Parameter:
    '   p1:
    '
    '   p2:
    Public Shared Operator +(p1 As Point, p2 As Point) As Point
    '
    ' Zusammenfassung:
    '     Unary minus operator
    '
    ' Parameter:
    '   pt:
    Public Shared Operator -(pt As Point) As Point
    '
    ' Zusammenfassung:
    '     Shifts point by a certain offset
    '
    ' Parameter:
    '   p1:
    '
    '   p2:
    Public Shared Operator -(p1 As Point, p2 As Point) As Point
    '
    ' Zusammenfassung:
    '     Shifts point by a certain offset
    '
    ' Parameter:
    '   pt:
    '
    '   scale:
    Public Shared Operator *(pt As Point, scale As Double) As Point
    '
    ' Zusammenfassung:
    '     Compares two Point objects. The result specifies whether the values of the X
    '     and Y properties of the two Point objects are equal.
    '
    ' Parameter:
    '   lhs:
    '     A Point to compare.
    '
    '   rhs:
    '     A Point to compare.
    '
    ' Rückgabewerte:
    '     This operator returns true if the X and Y values of left and right are equal;
    '     otherwise, false.
    Public Shared Operator =(lhs As Point, rhs As Point) As Boolean
    '
    ' Zusammenfassung:
    '     Compares two Point objects. The result specifies whether the values of the X
    '     or Y properties of the two Point objects are unequal.
    '
    ' Parameter:
    '   lhs:
    '     A Point to compare.
    '
    '   rhs:
    '     A Point to compare.
    '
    ' Rückgabewerte:
    '     This operator returns true if the values of either the X properties or the Y
    '     properties of left and right differ; otherwise, false.
    Public Shared Operator <>(lhs As Point, rhs As Point) As Boolean
    Public Shared Widening Operator CType(vec As Vec2i) As Point
    Public Shared Widening Operator CType(point As Point) As Vec2i
End Structure
对流指数声明如下:

Dim origPoints() As OpenCvSharp.Point 
Public Shared Function ConvexHullIndices(points As IEnumerable(Of Point), Optional clockwise As Boolean = False) As Integer()
#Region "Assembly OpenCvSharp, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=6adad1e807fea099"
' D:\Dev\Projects\faceshift\faceshift\packages\OpenCvSharp3- 
AnyCPU.3.4.1.20180830\lib\net46\OpenCvSharp.dll
#End Region

Imports System

Namespace OpenCvSharp
'
Public Structure Point
    Implements IEquatable(Of Point)
    '
    Public Const SizeOf As Integer = 8
    '
    Public X As Integer
    '
    Public Y As Integer

    '
    ' Parameter:
    '   x:
    '
    '   y:
    Public Sub New(x As Integer, y As Integer)
    '
    ' Parameter:
    '   x:
    '
    '   y:
    Public Sub New(x As Double, y As Double)

    '
    ' Zusammenfassung:
    '     Calculates the dot product of two 2D vectors.
    '
    ' Parameter:
    '   p1:
    '
    '   p2:
    Public Shared Function DotProduct(p1 As Point, p2 As Point) As Double
    '
    ' Zusammenfassung:
    '     Returns the distance between the specified two points
    '
    ' Parameter:
    '   p1:
    '
    '   p2:
    Public Shared Function Distance(p1 As Point, p2 As Point) As Double
    '
    ' Zusammenfassung:
    '     Calculates the cross product of two 2D vectors.
    '
    ' Parameter:
    '   p1:
    '
    '   p2:
    Public Shared Function CrossProduct(p1 As Point, p2 As Point) As Double
    '
    ' Zusammenfassung:
    '     Calculates the dot product of two 2D vectors.
    '
    ' Parameter:
    '   p:
    Public Function DotProduct(p As Point) As Double
    '
    ' Zusammenfassung:
    '     Returns the distance between the specified two points
    '
    ' Parameter:
    '   p:
    Public Function DistanceTo(p As Point) As Double
    '
    ' Zusammenfassung:
    '     Converts this object to a human readable string.
    '
    ' Rückgabewerte:
    '     A string that represents this object.
    Public Overrides Function ToString() As String
    '
    ' Zusammenfassung:
    '     Returns a hash code for this object.
    '
    ' Rückgabewerte:
    '     An integer value that specifies a hash value for this object.
    Public Overrides Function GetHashCode() As Integer
    '
    ' Zusammenfassung:
    '     Specifies whether this object contains the same members as the specified Object.
    '
    ' Parameter:
    '   obj:
    '     The Object to test.
    '
    ' Rückgabewerte:
    '     This method returns true if obj is the same type as this object and has the same
    '     members as this object.
    Public Overrides Function Equals(obj As Object) As Boolean
    '
    ' Zusammenfassung:
    '     Calculates the cross product of two 2D vectors.
    '
    ' Parameter:
    '   p:
    Public Function CrossProduct(p As Point) As Double
    '
    ' Zusammenfassung:
    '     Specifies whether this object contains the same members as the specified Object.
    '
    ' Parameter:
    '   obj:
    '     The Object to test.
    '
    ' Rückgabewerte:
    '     This method returns true if obj is the same type as this object and has the same
    '     members as this object.
    Public Function Equals(obj As Point) As Boolean

    '
    ' Zusammenfassung:
    '     Unary plus operator
    '
    ' Parameter:
    '   pt:
    Public Shared Operator +(pt As Point) As Point
    '
    ' Zusammenfassung:
    '     Shifts point by a certain offset
    '
    ' Parameter:
    '   p1:
    '
    '   p2:
    Public Shared Operator +(p1 As Point, p2 As Point) As Point
    '
    ' Zusammenfassung:
    '     Unary minus operator
    '
    ' Parameter:
    '   pt:
    Public Shared Operator -(pt As Point) As Point
    '
    ' Zusammenfassung:
    '     Shifts point by a certain offset
    '
    ' Parameter:
    '   p1:
    '
    '   p2:
    Public Shared Operator -(p1 As Point, p2 As Point) As Point
    '
    ' Zusammenfassung:
    '     Shifts point by a certain offset
    '
    ' Parameter:
    '   pt:
    '
    '   scale:
    Public Shared Operator *(pt As Point, scale As Double) As Point
    '
    ' Zusammenfassung:
    '     Compares two Point objects. The result specifies whether the values of the X
    '     and Y properties of the two Point objects are equal.
    '
    ' Parameter:
    '   lhs:
    '     A Point to compare.
    '
    '   rhs:
    '     A Point to compare.
    '
    ' Rückgabewerte:
    '     This operator returns true if the X and Y values of left and right are equal;
    '     otherwise, false.
    Public Shared Operator =(lhs As Point, rhs As Point) As Boolean
    '
    ' Zusammenfassung:
    '     Compares two Point objects. The result specifies whether the values of the X
    '     or Y properties of the two Point objects are unequal.
    '
    ' Parameter:
    '   lhs:
    '     A Point to compare.
    '
    '   rhs:
    '     A Point to compare.
    '
    ' Rückgabewerte:
    '     This operator returns true if the values of either the X properties or the Y
    '     properties of left and right differ; otherwise, false.
    Public Shared Operator <>(lhs As Point, rhs As Point) As Boolean
    Public Shared Widening Operator CType(vec As Vec2i) As Point
    Public Shared Widening Operator CType(point As Point) As Vec2i
End Structure
OpenCvSharp.Point声明如下:

Dim origPoints() As OpenCvSharp.Point 
Public Shared Function ConvexHullIndices(points As IEnumerable(Of Point), Optional clockwise As Boolean = False) As Integer()
#Region "Assembly OpenCvSharp, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=6adad1e807fea099"
' D:\Dev\Projects\faceshift\faceshift\packages\OpenCvSharp3- 
AnyCPU.3.4.1.20180830\lib\net46\OpenCvSharp.dll
#End Region

Imports System

Namespace OpenCvSharp
'
Public Structure Point
    Implements IEquatable(Of Point)
    '
    Public Const SizeOf As Integer = 8
    '
    Public X As Integer
    '
    Public Y As Integer

    '
    ' Parameter:
    '   x:
    '
    '   y:
    Public Sub New(x As Integer, y As Integer)
    '
    ' Parameter:
    '   x:
    '
    '   y:
    Public Sub New(x As Double, y As Double)

    '
    ' Zusammenfassung:
    '     Calculates the dot product of two 2D vectors.
    '
    ' Parameter:
    '   p1:
    '
    '   p2:
    Public Shared Function DotProduct(p1 As Point, p2 As Point) As Double
    '
    ' Zusammenfassung:
    '     Returns the distance between the specified two points
    '
    ' Parameter:
    '   p1:
    '
    '   p2:
    Public Shared Function Distance(p1 As Point, p2 As Point) As Double
    '
    ' Zusammenfassung:
    '     Calculates the cross product of two 2D vectors.
    '
    ' Parameter:
    '   p1:
    '
    '   p2:
    Public Shared Function CrossProduct(p1 As Point, p2 As Point) As Double
    '
    ' Zusammenfassung:
    '     Calculates the dot product of two 2D vectors.
    '
    ' Parameter:
    '   p:
    Public Function DotProduct(p As Point) As Double
    '
    ' Zusammenfassung:
    '     Returns the distance between the specified two points
    '
    ' Parameter:
    '   p:
    Public Function DistanceTo(p As Point) As Double
    '
    ' Zusammenfassung:
    '     Converts this object to a human readable string.
    '
    ' Rückgabewerte:
    '     A string that represents this object.
    Public Overrides Function ToString() As String
    '
    ' Zusammenfassung:
    '     Returns a hash code for this object.
    '
    ' Rückgabewerte:
    '     An integer value that specifies a hash value for this object.
    Public Overrides Function GetHashCode() As Integer
    '
    ' Zusammenfassung:
    '     Specifies whether this object contains the same members as the specified Object.
    '
    ' Parameter:
    '   obj:
    '     The Object to test.
    '
    ' Rückgabewerte:
    '     This method returns true if obj is the same type as this object and has the same
    '     members as this object.
    Public Overrides Function Equals(obj As Object) As Boolean
    '
    ' Zusammenfassung:
    '     Calculates the cross product of two 2D vectors.
    '
    ' Parameter:
    '   p:
    Public Function CrossProduct(p As Point) As Double
    '
    ' Zusammenfassung:
    '     Specifies whether this object contains the same members as the specified Object.
    '
    ' Parameter:
    '   obj:
    '     The Object to test.
    '
    ' Rückgabewerte:
    '     This method returns true if obj is the same type as this object and has the same
    '     members as this object.
    Public Function Equals(obj As Point) As Boolean

    '
    ' Zusammenfassung:
    '     Unary plus operator
    '
    ' Parameter:
    '   pt:
    Public Shared Operator +(pt As Point) As Point
    '
    ' Zusammenfassung:
    '     Shifts point by a certain offset
    '
    ' Parameter:
    '   p1:
    '
    '   p2:
    Public Shared Operator +(p1 As Point, p2 As Point) As Point
    '
    ' Zusammenfassung:
    '     Unary minus operator
    '
    ' Parameter:
    '   pt:
    Public Shared Operator -(pt As Point) As Point
    '
    ' Zusammenfassung:
    '     Shifts point by a certain offset
    '
    ' Parameter:
    '   p1:
    '
    '   p2:
    Public Shared Operator -(p1 As Point, p2 As Point) As Point
    '
    ' Zusammenfassung:
    '     Shifts point by a certain offset
    '
    ' Parameter:
    '   pt:
    '
    '   scale:
    Public Shared Operator *(pt As Point, scale As Double) As Point
    '
    ' Zusammenfassung:
    '     Compares two Point objects. The result specifies whether the values of the X
    '     and Y properties of the two Point objects are equal.
    '
    ' Parameter:
    '   lhs:
    '     A Point to compare.
    '
    '   rhs:
    '     A Point to compare.
    '
    ' Rückgabewerte:
    '     This operator returns true if the X and Y values of left and right are equal;
    '     otherwise, false.
    Public Shared Operator =(lhs As Point, rhs As Point) As Boolean
    '
    ' Zusammenfassung:
    '     Compares two Point objects. The result specifies whether the values of the X
    '     or Y properties of the two Point objects are unequal.
    '
    ' Parameter:
    '   lhs:
    '     A Point to compare.
    '
    '   rhs:
    '     A Point to compare.
    '
    ' Rückgabewerte:
    '     This operator returns true if the values of either the X properties or the Y
    '     properties of left and right differ; otherwise, false.
    Public Shared Operator <>(lhs As Point, rhs As Point) As Boolean
    Public Shared Widening Operator CType(vec As Vec2i) As Point
    Public Shared Widening Operator CType(point As Point) As Vec2i
End Structure

结束名称空间

我认为您错误地编写了C lambda而不是VB lambda。这在C中是有效的:

.Select(i => i + 48)
注意=>不是>=而VB等价物是:

.Select(Function(i) i + 48)
这能解决你的问题吗

编辑:


另外,Select方法将返回IEnumerableOf T,因此,如果您想要数组,则需要向ToArray追加一个调用。

谢谢,也感谢您提供了有关不同运算符的课程!!