Exemplo n.º 1
0
    // Main procedure
    private void action()
    {
        // Local iconic variables

        HObject ho_Image, ho_EdgeAmplitude = null;

        // Local control variables

        HTuple hv_WindowHandle = new HTuple(), hv_DrawID = null;

        // Initialize local and output iconic variables
        HOperatorSet.GenEmptyObj(out ho_Image);
        HOperatorSet.GenEmptyObj(out ho_EdgeAmplitude);
        try
        {
            //Initialize visualization
            dev_update_off();
            //dev_close_window(...);
            //dev_open_window(...);
            HOperatorSet.SetPart(hv_ExpDefaultWinHandle, 0, 0, 511, 511);
            //
            //Read background image and attach it to the window
            ho_Image.Dispose();
            HOperatorSet.ReadImage(out ho_Image, "fabrik");
            HOperatorSet.AttachBackgroundToWindow(ho_Image, hv_ExpDefaultWinHandle);
            //
            //Add a drawing object and start the processing loop
            add_new_drawing_object("rectangle1", hv_ExpDefaultWinHandle, out hv_DrawID);
            while ((int)(1) != 0)
            {
                ho_EdgeAmplitude.Dispose();
                process_image(ho_Image, out ho_EdgeAmplitude, hv_ExpDefaultWinHandle, hv_DrawID);
                display_results(ho_EdgeAmplitude);
            }
        }
        catch (HalconException HDevExpDefaultException)
        {
            ho_Image.Dispose();
            ho_EdgeAmplitude.Dispose();

            throw HDevExpDefaultException;
        }
        ho_Image.Dispose();
        ho_EdgeAmplitude.Dispose();
    }