Exemple #1
0
        private void cbIcCol_SelectedIndexChanged(object sender, EventArgs e)
        {
            string recipeID = cbRecipeID.Text;

            if (string.IsNullOrEmpty(recipeID))
            {
                return;
            }
            JFDLAFRecipeManager rm     = JFHubCenter.Instance.RecipeManager as JFDLAFRecipeManager;
            JFDLAFProductRecipe recipe = rm.GetRecipe(CategoteProduct, cbRecipeID.Text) as JFDLAFProductRecipe;

            if (null == recipe)
            {
                return;
            }
            if (cbIcRow.SelectedIndex < 0)
            {
                return;
            }
            if (cbIcCol.SelectedIndex < 0)
            {
                return;
            }


            double x, y;

            recipe.GetICSnapCenter(Convert.ToInt32(cbIcRow.SelectedItem), Convert.ToInt32(cbIcCol.SelectedItem), out x, out y);
            lbICPos.Text = string.Format("x:{0:F3} y:{1:F3}", x, y);
        }
Exemple #2
0
        /// <summary>
        /// 获取检测区域
        /// </summary>
        /// <param name="icRow"></param>
        /// <param name="icCol"></param>
        /// <param name="regions"></param>
        /// <param name="diesRows"></param>
        /// <param name="diesCols"></param>
        /// <param name="errorInfo"></param>
        /// <returns></returns>
        public bool GetDetectRegionInFov(int icRow, int icCol, out HObject regions, out int[] diesRows, out int[] diesCols, out int diesRow, out int diesCol, out string errorInfo)
        {
            regions  = null;
            diesRows = null;
            diesCols = null;
            diesRow  = 0;
            diesCol  = 0;

            // Initialize local and output iconic variables
            double snapPositionX = 0, snapPositionY = 0;//Recipe拍照点XY

            _recipe.GetICSnapCenter(icRow, icCol, out snapPositionX, out snapPositionY);

            HTuple hv_dilationSize = new HTuple();
            HTuple hv_dieRows      = new HTuple();
            HTuple hv_dieCols      = new HTuple();
            HTuple hv_iFlag        = new HTuple();
            HTuple hv_uvHXY        = new HTuple();

            hv_dilationSize = 0;                                      //该参数值不可变

            if (_recipe.DieRowInFov == 0 && _recipe.DieColInFov == 0) //大芯片
            {
                HOperatorSet.GenRectangle1(out regions, 0, 0, _imgHegiht, _imgWidth);
                errorInfo   = "Success";
                diesRows    = new int[1];
                diesCols    = new int[1];
                diesRows[0] = icRow;
                diesCols[0] = icCol;
                diesRow     = 0;
                diesCol     = 0;
            }
            else//小芯片
            {
                gen_die_match_region(out regions, snapPositionX, snapPositionY, _recipe.DieWidth, _recipe.DieHeight, _recipe.icMapX, _recipe.icMapY,
                                     _cmrCalibData, _imgWidth, _imgHegiht, _recipe.WidthFactor, _recipe.HeightFactor, _recipe.ScaleFactor,
                                     hv_dilationSize, _recipe.RowNumber, _recipe.ColumnNumber * _recipe.BlockNumber, out hv_dieRows, out hv_dieCols, out hv_iFlag);

                int iregion = regions.CountObj();
                if (hv_iFlag.S != "Success")
                {
                    errorInfo = hv_iFlag.S;
                    return(false);
                }

                diesRow = hv_dieRows.TupleMax().I - hv_dieRows.TupleMin().I + 1;
                diesCol = hv_dieCols.TupleMax().I - hv_dieCols.TupleMin().I + 1;

                diesRows = new int[hv_dieRows.Length];
                diesCols = new int[hv_dieRows.Length];
                for (int i = 0; i < hv_dieRows.Length; i++)
                {
                    diesRows[i] = hv_dieRows.TupleSelect(i).I;
                    diesCols[i] = hv_dieCols.TupleSelect(i).I;
                }
                errorInfo = "Success";
            }
            return(true);
        }
Exemple #3
0
        protected override bool ActionGenuine(out string errorInfo)
        {
            string recipeID = GetMethodInputValue("RecipeID") as string;

            if (string.IsNullOrEmpty(recipeID))
            {
                errorInfo = "输入参数RecipeID 为空字串";
                return(false);
            }

            IJFImage markImg1 = GetMethodInputValue("MarkImage1") as IJFImage;

            if (null == markImg1)
            {
                errorInfo = "MarkImage1 is null";
                return(false);
            }

            IJFImage markImg2 = GetMethodInputValue("MarkImage2") as IJFImage;

            if (null == markImg1)
            {
                errorInfo = "MarkImage1 is null";
                return(false);
            }

            IDLAFProductFixReceiver rcver = GetMethodInputValue("定位结果接收者") as IDLAFProductFixReceiver;

            if (null == rcver)
            {
                errorInfo = "定位结果接收者 未设置";
                return(false);
            }
            double markSnapX1 = Convert.ToDouble(GetMethodInputValue("MarkSanpX1"));
            double markSnapY1 = Convert.ToDouble(GetMethodInputValue("MarkSanpY1"));
            double markSnapX2 = Convert.ToDouble(GetMethodInputValue("MarkSanpX2"));
            double markSnapY2 = Convert.ToDouble(GetMethodInputValue("MarkSanpY2"));

            double[] icCenterX    = null;
            double[] icCenterY    = null;
            double[] fovOffsetX   = null;
            double[] fovOffsetY   = null;
            int      fixErrorCode = -1;
            string   fixErrorInfo = "软件功能未实现";
            //////////////////////////////////////////////添加定位算法流程

            IJFRecipeManager irm = JFHubCenter.Instance.RecipeManager;

            if (null == irm)
            {
                errorInfo         = "配方管理器未设置";
                rcver.PFErrorInfo = errorInfo;
                rcver.PFErrorCode = -1;

                return(false);
            }

            if (!irm.IsInitOK)
            {
                errorInfo         = "配方管理器未初始化 :" + irm.GetInitErrorInfo();
                rcver.PFErrorInfo = errorInfo;
                rcver.PFErrorCode = -1;
                return(false);
            }
            JFDLAFRecipeManager rm = irm as JFDLAFRecipeManager;

            if (null == rm)
            {
                errorInfo         = "配方管理器类型错误 :" + irm.GetType().Name;
                rcver.PFErrorInfo = errorInfo;
                rcver.PFErrorCode = -1;
                return(false);
            }

            JFDLAFProductRecipe recipe = rm.GetRecipe("Product", recipeID) as JFDLAFProductRecipe;

            if (null == recipe)
            {
                errorInfo         = "RecipeID =\"" + recipeID + "\" 在配方管理器中不存在";
                rcver.PFErrorInfo = errorInfo;
                rcver.PFErrorCode = -1;
                return(false);
            }

            ///使用原始拍照点位
            icCenterX = new double[recipe.ICCount];
            icCenterY = new double[recipe.ICCount];
            for (int i = 0; i < recipe.RowCount; i++)
            {
                for (int j = 0; j < recipe.ColCount; j++)
                {
                    recipe.GetICSnapCenter(i, j, out icCenterX[i * recipe.ColCount + j], out icCenterY[i * recipe.ColCount + j]);
                }
            }

            ///使用原始Fov偏移量
            fovOffsetX = new double[recipe.FovCount];
            fovOffsetY = new double[recipe.FovCount];
            for (int i = 0; i < recipe.FovCount; i++)
            {
                recipe.GetFovOffset(recipe.FovNames()[i], out fovOffsetX[i], out fovOffsetY[i]);
            }
            fixErrorCode = 0;


            //当前为演示代码,返回模板图像拍照位置
            rcver.PFRecipeID   = recipeID;
            rcver.PFErrorInfo  = fixErrorInfo;
            rcver.PFICCenterX  = icCenterX;
            rcver.PFICCenterY  = icCenterY;
            rcver.PFFovOffsetX = fovOffsetX;
            rcver.PFFovOffsetY = fovOffsetY;
            rcver.PFErrorCode  = fixErrorCode;


            errorInfo = "Success";
            return(true);
        }