void Semantic_result_arrived(Message message) { arrived = true; segmented_image = (SensorCompressedImage)message; semantic_result(this, EventArgs.Empty); Debug.Log("segmented_image arrived"); }
void Publish_to_ROS(byte[] image_data) { SensorCompressedImage publish_image = new SensorCompressedImage(); publish_image.format = "jpeg"; publish_image.data = image_data; Debug.Log("ara:Publishing..."); // ROSに画像を送信 rosSocket.Publish(advertise_id, publish_image); }
public void ReqImgHandler(Message message) { StandardString standard = (StandardString)message; dynamic stuff = JObject.Parse(standard.data); string ip = stuff.ip; string name = stuff.img; int percent = (int)stuff.percent; Constant.mainWindowPointer.WriteLog("[" + ip + "]" + " Image loaded: " + percent + "%"); // [192.168.105.5] Image loaded: 40% SensorCompressedImage imgdata = new SensorCompressedImage(); try { // BitmapImage img = new System.Windows.Media.Imaging.BitmapImage(new Uri(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\ATEK\Image\" + standard.data)); String pathImg = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\ATEK\Image\" + name; if (!File.Exists(pathImg)) { //string test = @"pack://*****:*****@"\ATEK\Image\" + "default.png"); //Image img = null; imgdata.format = "NoImage"; //imgdata.data = ImageToByte(img); if (webSocket.IsAlive) { this.Publish(publishdataImg, imgdata); } } else { Image img = Image.FromFile(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\ATEK\Image\" + name); Image resizeImg = new Bitmap(img, new Size(300, 400)); imgdata.format = name; imgdata.data = ImageToByte(resizeImg); if (webSocket.IsAlive) { this.Publish(publishdataImg, imgdata); } } } catch { //Image img = Image.FromFile(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\ATEK\Image\" + "default.png"); //Image img = null; imgdata.format = "NoImage"; //imgdata.data = ImageToByte(img); if (webSocket.IsAlive) { this.Publish(publishdataImg, imgdata); } } }
private void InitializeMessage() { message = new SensorCompressedImage(); message.header.frame_id = FrameId; message.format = "jpeg"; }
void Start() { segmented_image = new SensorCompressedImage(); Invoke("Init", 1.0f); }