Exemple #1
0
    public void updateFrameDisplay(ChannelInfo img, ChannelInfo Feature)
    {
        List <Mat> imgList  = CppInterface.GetIMList(img.id);
        Mat        colorMat = new Mat();

        Imgproc.cvtColor(imgList[0], colorMat, Imgproc.COLOR_GRAY2RGB);
        if (Feature != null)
        {
            List <FeaturesCpp> featureList = CppInterface.GetFPList(Feature.id);
            for (int i = 0; i < featureList.Count; i++)
            {
                FeaturesCpp info = featureList [i];
                Imgproc.circle(colorMat, new Point(info.u, info.v), info.r / 2, new Scalar(info.red, info.green, 0), 2);
                if (info.lastU > 10)
                {
                    Imgproc.line(colorMat, new Point(info.u, info.v), new Point(info.lastU, info.lastV), new Scalar(255, 0, 255), 2);
                }
            }
        }

        RectTransform sizeSetting = FrameDisplay.GetComponent <RectTransform> ();
        float         winH        = colorMat.rows();
        float         winW        = colorMat.cols();

        if (winH > 600)
        {
            winW = winW * 600f / winH;
            winH = 600;
        }
        sizeSetting.sizeDelta = new Vector2(winW, winH);
        Texture2D texture = new Texture2D(colorMat.cols(), colorMat.rows(), TextureFormat.RGBA32, false);

        Utils.matToTexture2D(colorMat, texture);
        FrameDisplay.GetComponent <RawImage> ().texture = texture;
    }
Exemple #2
0
    public static List <FeaturesCpp> GetFPList(int channel)
    {
        List <FeaturesCpp> fpList = new List <FeaturesCpp> ();
        int fpCount = GetListCount(4, channel);

        for (int i = 0; i < fpCount; i++)
        {
            FeaturesCpp item = GetFPListCpp(channel, i);
            if (item.id != -1)
            {
                fpList.Add(item);
            }
        }
        ;
        return(fpList);
    }