/// <summary>
    /// Enable the spatial mapping
    /// </summary>
    /// <param name="resolutionPreset"> A preset resolution</param>
    /// <param name="rangePreset">A preset range</param>
    /// <param name="isTextured">if true, images will be collected during the process</param>
    /// <returns></returns>
    private sl.ERROR_CODE EnableSpatialMapping(RESOLUTION resolutionPreset, RANGE rangePreset, bool isTextured)
    {
        sl.ERROR_CODE error;
        this.isTextured            = isTextured;
        error                      = zedSpatialMapping.EnableSpatialMapping(ZEDSpatialMappingHelper.ConvertResolutionPreset(resolutionPreset), ZEDSpatialMappingHelper.ConvertRangePreset(rangePreset), isTextured);
        ZEDMeshRenderer.isTextured = false;
        stopWanted                 = false;
        running                    = true;

        if (error == sl.ERROR_CODE.SUCCESS)
        {
            display                 = true;
            meshUpdated             = false;
            spatialMappingRequested = false;
            updateTexture           = false;
            updatedTexture          = false;

            // clear all prevous meshes
            ClearMeshes();

            //start the requesting meshes
            zedCamera.RequestMesh();

            //Launch the thread to retrieve the chunks and their sizes
            scanningThread      = new Thread(UpdateMesh);
            updateThreadRunning = true;
            if (OnMeshStarted != null)
            {
                OnMeshStarted();
            }
            scanningThread.Start();
        }
        return(error);
    }
Beispiel #2
0
 /// <summary>
 /// Get the max fps for each resolution, higher fps will cause lower GPU performance
 /// </summary>
 /// <param name="reso"></param>
 /// <returns>The resolution</returns>
 static private uint GetFpsForResolution(RESOLUTION reso)
 {
     if (reso == RESOLUTION.HD1080) return 30;
     else if (reso == RESOLUTION.HD2K) return 15;
     else if (reso == RESOLUTION.HD720) return 60;
     else if (reso == RESOLUTION.VGA) return 100;
     return 30;
 }
Beispiel #3
0
        /// <summary>
        /// Set the resolution (including capture and render)
        /// </summary>
        /// <param name="resolution"></param>
        /// <param name="binMode"></param>
        public void SetResolution(RESOLUTION resolution, int bin, int binMode)
        {
            this.SetMaxXY(resolution);
            _imgControl._bin     = bin;
            _imgControl._binMode = binMode;

            if (SSClassicSetCustomizedResolution(_deviceID, _imgControl._rowSize, _imgControl._columnSize, _imgControl._bin, _imgControl._binMode) < 0)
            {
                MessageBox.Show("Error trying to set camera resolution, bin mode, and image rendor fitting.", _camError, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    /// <summary>
    /// Starts the spatial mapping
    /// </summary>
    /// <param name="resolutionPreset"></param>
    /// <param name="rangePreset"></param>
    /// <param name="isTextured"></param>
    public void StartStatialMapping(RESOLUTION resolutionPreset, RANGE rangePreset, bool isTextured)
    {
        holder.transform.position = Vector3.zero;
        holder.transform.rotation = Quaternion.identity;
        spatialMappingRequested   = true;
        if (spatialMappingRequested && scanningInitState != sl.ERROR_CODE.SUCCESS)
        {
            scanningInitState = EnableSpatialMapping(resolutionPreset, rangePreset, isTextured);
        }

        zedManager.gravityRotation = Quaternion.identity;
    }
Beispiel #5
0
        public Zed(RESOLUTION resolution, DEPTH_MODE depthMode = DEPTH_MODE.QUALITY, bool stabilisation = true)
            : this(new InitParameters
        {
            resolution = resolution,
            depthMode = depthMode,
            depthStabilization = stabilisation,
            enableRightSideMeasure = true,

            coordinateUnit = UNIT.MILLIMETER,
            depthMinimumDistance = 200f
                                   //depthMinimumDistance = 0.2f
        })
        {
        }
Beispiel #6
0
        /// <summary>
        /// Create a camera in live mode
        /// </summary>
        /// <param name="mode"></param>
        /// <param name="fps"></param>
        /// <param name="linux_id"></param>
        public void CreateCameraLive(RESOLUTION mode = RESOLUTION.HD720, float fps = 0.0f, int linux_id = 0)
        {
            string infoSystem = SystemInfo.graphicsDeviceType.ToString().ToUpper();
            if (!infoSystem.Equals("DIRECT3D11"))
            {
                throw new Exception("The graphic library [" + infoSystem + "] is not supported");
            }

            currentResolution = mode;
            fpsMax = GetFpsForResolution(mode);
            if (fps == 0.0f) fps = fpsMax;
            ZEDUpdater.GetInstance().fpsMax = fpsMax;
            dllz_create_camera_live((int)mode, fps, linux_id);
        }
 /// <summary>
 /// Update the range and resolution to match the specified preset.
 /// </summary>
 static public float ConvertResolutionPreset(RESOLUTION resolutionPreset)
 {
     if (resolutionPreset == RESOLUTION.HIGH)
     {
         return(0.05f);
     }
     else if (resolutionPreset == RESOLUTION.MEDIUM)
     {
         return(0.10f);
     }
     if (resolutionPreset == RESOLUTION.LOW)
     {
         return(0.15f);
     }
     return(0.10f);
 }
Beispiel #8
0
 public InitParameters()
 {
     resolution = RESOLUTION.HD720;
     cameraFPS = 60;
     cameraLinuxID = 0;
     pathSVO = "";
     svoRealTimeMode = false;
     coordinateUnit = UNIT.METER;
     coordinateSystem = COORDINATE_SYSTEM.IMAGE;
     depthMode = DEPTH_MODE.PERFORMANCE;
     depthMinimumDistance = -1;
     cameraImageFlip = false;
     cameraDisableSelfCalib = false;
     cameraBufferCountLinux = 4;
     sdkVerbose = false;
     sdkGPUId = -1;
     sdkVerboseLogFile = "";
     enableRightSideMeasure = false;
     depthStabilization = true;
 }
 public virtual void ManipulationCompleted(object sender, ManipulationCompletedEventArgs arg)
 {
     saveLastPossaveLastPositionData();
     outputResolution = RESOLUTION.HIGH;
     requestProcessing();
 }
 public virtual void ManipulationStarted(object sender, ManipulationStartedEventArgs arg)
 {
     oldGestureType = GESTURE_TYPE.NONE;
     outputResolution = RESOLUTION.LOW;
 }
Beispiel #11
0
        private string SendToFaxCom(string _pharmacyName, string _faxNumber, string _scriptFilePath, string _subject)
        {
            string        output          = "false";
            ResultMessage result          = null;
            LOGINTYPE     faxcomlogintype = LOGINTYPE.USERCONFLOGIN;
            PRIORITY      faxcompriority  = PRIORITY.HIGH;
            RESOLUTION    faxresolution   = RESOLUTION.HIRES;

            //Set configuration
            string faxcomserver = System.Configuration.ConfigurationSettings.AppSettings["FaxcomQueuePath"];
            string faxcomuser   = System.Configuration.ConfigurationSettings.AppSettings["FaxcomUser"];
            string faxcompasswd = System.Configuration.ConfigurationSettings.AppSettings["FaxcomPasswd"];
            string temppath     = System.Configuration.ConfigurationSettings.AppSettings["TempPath"];

            try
            {
                using (fcapi FCAPI = new fcapi())
                {
                    //Try to connect to server
                    result = FCAPI.LogOn(faxcomlogintype, faxcomserver, faxcomuser, faxcompasswd);
                    if (result.Result == true)
                    {
                        //Login successful
                        FaxMessage faxmessage = FCAPI.NewFaxMessage();
                        if (faxmessage != null)
                        {
                            //Set the sender info
                            faxmessage.FaxSender = FCAPI.Sender;
                            //Create blank recipient
                            FAXCOMLib.Recipient recipient = faxmessage.FaxRecipients.Add(0);
                            //Valid recipient fax number
                            recipient.FaxNumber = _faxNumber;
                            faxmessage.Subject  = _subject;
                            //Message priority
                            faxmessage.Priority = faxcompriority;
                            //Message Resolution
                            faxmessage.Resolution = faxresolution;
                            //No Coverpage
                            faxmessage.Coverpage = "(none)";
                            FAXCOMLib.Attachments attachment = faxmessage.Attachments;
                            attachment.Add(_scriptFilePath, false);

                            //Send Now
                            faxmessage.SendTime = "0.0";
                            //Try to send fax message
                            try
                            {
                                faxmessage.SubmitFax();
                            }
                            catch (Exception ex)
                            {
                                throw new Exception("Failed to submit fax. " + ex.Message);
                            }
                        }
                    }
                    else
                    {
                        throw new Exception("Faxcom server login failed.");
                    }
                }
            }
            catch (Exception ex)
            {
                return("false");
            }

            return("true");
        }
        async void processRendering()
        {

            try
            {
                if (output != null && source != null)
                {

                    var currentoutputResolution = outputResolution;
                    processRenderingLR();

                    if (currentoutputResolution == RESOLUTION.HIGH)
                    {

                        if (currentScale > InputLR.PixelWidth / inputSize.Width)
                        {
                            await processRenderingHR();
                        }
                        else
                        {
                            outputResolution = RESOLUTION.LOW;
                        }
                    }

                }
            }
            catch (Exception)
            {
                outputResolution = RESOLUTION.LOW;
            }
            finally
            {
                processFinished();
            }


        }
Beispiel #13
0
        private void SetMaxXY(RESOLUTION res)
        {
            //Set maximum X and Y start positions based on resolution
            switch (res)
            {
            case RESOLUTION.TINY:
                _maxX = 32;
                _maxY = 32;
                break;

            case RESOLUTION.LITTLE:
                _maxX = 64;
                _maxY = 64;
                break;

            case RESOLUTION.SMALL:
                _maxX = 160;
                _maxY = 120;
                break;

            case RESOLUTION.MOBILE:
                _maxX = 320;
                _maxY = 240;
                break;

            case RESOLUTION.VGA:
                _maxX = 640;
                _maxY = 480;
                break;

            case RESOLUTION.SVGA:
                _maxX = 800;
                _maxY = 600;
                break;

            case RESOLUTION.UVGA:
                _maxX = 1024;
                _maxY = 768;
                break;

            case RESOLUTION.VGALARGE:
                _maxX = 1280;
                _maxY = 1024;
                break;

            case RESOLUTION.RES_3M:
                _maxX = 2048;
                _maxY = 1536;
                break;

            case RESOLUTION.RES_5M:
                _maxX = 2560;
                _maxY = 1920;
                break;

            default:
                MessageBox.Show("Resolution not defined, unable to set maximum X and Y start positions.", _camError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;
            }
            _imgControl._rowSize    = _maxX;
            _imgControl._columnSize = _maxY;
        }
 public virtual void ManipulationCompleted(object sender, ManipulationCompletedEventArgs arg)
 {
     saveLastPossaveLastPositionData();
     outputResolution = RESOLUTION.HIGH;
     requestProcessing();
 }
 public virtual void ManipulationStarted(object sender, ManipulationStartedEventArgs arg)
 {
     oldGestureType   = GESTURE_TYPE.NONE;
     outputResolution = RESOLUTION.LOW;
 }