Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

C# and C++中使用vision的bug

bug 1:

 

VAS2013生成的C#代码中:

 //////////////////////////////////////////////////////////////////////////////
        //
        //  IVA_FindExtremeEdge
        //
        //  Description:
        //      Finds the edge that is either closest or farthest from the start
        //      of a set of rake lines.
        //
        //  Parameters:
        //      report          -   The rake report to process.
        //      findClosestEdge -   The direction of the main axis.
        //                          If false, report must contain both first and last
        //                          edge information
        //
        //  Return Value:
        //      The extreme edge
        //
        //////////////////////////////////////////////////////////////////////////////
        public static PointContour IVA_FindExtremeEdge(RakeReport report, bool findClosestEdge)
        {
            Double extremeDistance;
            Double tempDistance;
            PointContour edge = new PointContour(0,0);

            // Determine if the function should process the first edges or the last edges array
            if (findClosestEdge)
            {
                if (report.FirstEdges.Count > 0 )
                {
                    extremeDistance = report.FirstEdges[0].Distance;
                    edge = report.FirstEdges[0].Position;

                    // Then find the edge that is closest to the boundary of the search area
                    for (int i = 1 ; i < report.FirstEdges.Count ; i++)
                    {
                        tempDistance = report.FirstEdges[i].Distance;
                        if (tempDistance < extremeDistance)
                        {
                            extremeDistance = tempDistance;
                            edge = report.FirstEdges[i].Position;
                        }
                    }
                }
            }
            else
            {
                if( report.LastEdges.Count > 0 )
                {
                    // First, intialize the value with the first edge in the array
                    extremeDistance = report.LastEdges[0].Distance;
                    edge = report.LastEdges[0].Position;

                    // Then find the edge that are closest to the boundary of the search area
                    for (int i = 1 ; i < report.LastEdges.Count ; i++ )
                    {
                        tempDistance = report.LastEdges[i].Distance;
                        if (tempDistance < extremeDistance)             //此处应为:if (tempDistance > extremeDistance)
                        {
                            extremeDistance = tempDistance;
                            edge = report.LastEdges[i].Position;
                        }
                    }
                }
            }
           
            return edge;
        }

 

 

bug 2:

 

VAS2013生成的C++代码中:

findEdgeReport = imaqFindEdge2(image, roi, NULL, NULL, &findEdgeOptions, &straightEdgeOptions);

 

对于函数imaqFindEdge2的调用,经反复测试,存在内存泄漏的问题,对此函数的调用,会导致内存一直增长。

 

 

如有误请指教!

谢谢!

0 Kudos
Message 1 of 3
(4,824 Views)

Hi

    have you read the following attachments? I hope this can help

  

0 Kudos
Message 2 of 3
(4,791 Views)

对的,第一个问题我也发现了

0 Kudos
Message 3 of 3
(1,693 Views)