Exemplo n.º 1
0
        public void Execute(List <string> FbpCommands, bool RunOnce = true, bool InfiniteLoop = false, int LoopLimit = 1)
        {
            // ReturnResult = false
            CommandType command     = new CommandType(FbpCommands, RunOnce, InfiniteLoop, LoopLimit, false);
            string      jsonCommand = JsonConvert.SerializeObject(command);

            imageClient.MakePostCall(jsonCommand);
        }
        public string LoadTargetDeviceLocalImage(string deviceLocalImagePath, ComputeDeviceInfo computeDeviceInfo, int port)
        {
            try
            {
                string apiCallBody = "{\n\"Fbp\":[\"Start\",\"globals()['imageSrc'] = cv2.imread('{{deviceLocalImagePath}}')\",\"\"],\"RunOnce\": true,\"InfiniteLoop\": false,\"LoopLimit\": 1,\"ReturnResult\": true}";

                apiCallBody = apiCallBody.Replace("{{deviceLocalImagePath}}", "\"" + deviceLocalImagePath + "\"");

                string result = imageClient.MakePostCall("http://{{host}}:{{port}}/task".Replace("{{host}}", computeDeviceInfo.IpAddress).Replace("{{port}}", port.ToString()), apiCallBody);

                return(result);
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("[ERROR] ICANSEEUtility.LoadCamera(val=" + deviceLocalImagePath + ", ipAddress=" + computeDeviceInfo.IpAddress + ", port=" + port.ToString() + ") " + ex.Message);
                Console.ResetColor();
            }
            return(null);
        }