public void Init(FPFImage img, Metadata mt) { this.irImage = img; this.metadata = mt; this.refArea = 1; }
public RTDP(RTDPService service) { this.service = service; hotSpots = new ArrayList(); if (RTDPSettings.doSegmentation) segmentation = new Segmentation(UASProperties.irCamProperties); if (RTDPSettings.doImageFusion) fusion = new Fusion(UASProperties.irCamProperties, UASProperties.viCamProperties); if (RTDPSettings.doGeolocation) { if (RTDPSettings.geolocationSettings.geolocateVIimage) viGeolocation = new Geolocation(UASProperties.viCamProperties, UASProperties.gpsProperties); if (RTDPSettings.geolocationSettings.geolocateHotspots || RTDPSettings.geolocationSettings.geolocateIRimage) irGeolocation = new Geolocation(UASProperties.irCamProperties, UASProperties.gpsProperties); } DemManager.DemManagerService.GetInstance().FunctionCall("SetPrecision", new object[] { RTDPSettings.terrainModelSettings.demPrecision }); metadata = new Metadata(); this.DeleteTempFiles(); // RTDP is now ready to process a package ready = true; }
public void Init(Metadata mt) { double cosYaw = Math.Cos(mt.uavTelemetry.uavAngles.Yaw); double sinYaw = Math.Sin(mt.uavTelemetry.uavAngles.Yaw); double speed_x = mt.uavTelemetry.uavSpeed.North * cosYaw + mt.uavTelemetry.uavSpeed.East * sinYaw; // to the nose double speed_y = -mt.uavTelemetry.uavSpeed.North * sinYaw + mt.uavTelemetry.uavSpeed.East * cosYaw; // to the right wing double delay_ir = mt.camDelay.irDelay; double delay_vi = mt.camDelay.viAverage; double height = mt.AGL - (irCamera.camPosition.z + viCamera.camPosition.z) / 2; double tilt_ir = mt.uavTelemetry.uavAngles.Pitch + irCamera.camAngles.Pitch; double tilt_vi = mt.uavTelemetry.uavAngles.Pitch + viCamera.camAngles.Pitch; // Scale factor and offsets between IR and VI for three IR pixels double S_ir_vi = (irCamera.pixelPitch * viCamera.focalLength) / (irCamera.focalLength * viCamera.pixelPitch); double ydif = ((irCamera.camPosition.y - viCamera.camPosition.y) +0.8 + speed_y * (delay_ir - delay_vi)) * viCamera.focalLength / (height * viCamera.pixelPitch); double xdif = ((irCamera.camPosition.x - viCamera.camPosition.x) -1.2 + speed_x * (delay_ir - delay_vi)) / height; double tao_ir, tao_vi, sm_ir_vi, sm_vi; // Top-left and top-right pixels tao_ir = tilt_ir + Math.Atan2((M_ir - 1) * irCamera.pixelPitch, 2 * irCamera.focalLength); tao_vi = Math.Atan(xdif + Math.Tan(tao_ir)); int y_tl_vi = (int)(M_vi / 2 - viCamera.focalLength * Math.Tan(tao_vi - tilt_vi) / viCamera.pixelPitch); int y_tr_vi = y_tl_vi; sm_ir_vi = S_ir_vi * (Math.Cos(tao_vi) * Math.Cos(tao_ir - tilt_ir)) / (Math.Cos(tao_ir) * Math.Cos(tao_vi - tilt_vi)); sm_vi = Math.Cos(tao_vi) / Math.Cos(tao_vi - tilt_vi); int x_tl_vi = (int)((N_vi - sm_ir_vi * N_ir) / 2 + ydif * sm_vi); int x_tr_vi = (int)(x_tl_vi + N_ir * sm_ir_vi); // Bottom-left and bottom-right pixels tao_ir = tilt_ir - Math.Atan2((M_ir - 1) * irCamera.pixelPitch, 2 * irCamera.focalLength); tao_vi = Math.Atan(xdif + Math.Tan(tao_ir)); int y_bl_vi = (int)(M_vi / 2 - viCamera.focalLength * Math.Tan(tao_vi - tilt_vi) / viCamera.pixelPitch); int y_br_vi = y_bl_vi; sm_ir_vi = S_ir_vi * (Math.Cos(tao_vi) * Math.Cos(tao_ir - tilt_ir)) / (Math.Cos(tao_ir) * Math.Cos(tao_vi - tilt_vi)); sm_vi = Math.Cos(tao_vi) / Math.Cos(tao_vi - tilt_vi); int x_bl_vi = (int)((N_vi - sm_ir_vi * N_ir) / 2 + ydif * sm_vi); int x_br_vi = (int)(x_bl_vi + N_ir * sm_ir_vi); // Compute affine matrix this.ComputeAffineMatrix(x_tl_vi, y_tl_vi, x_tr_vi, y_tr_vi, x_bl_vi, y_bl_vi, x_br_vi, y_br_vi); //// Rectangle enclosing the IR image in the VI image int top = y_tl_vi; int bottom = y_bl_vi; int left = (x_tl_vi < x_bl_vi) ? x_tl_vi : x_bl_vi; int right = (x_tr_vi > x_br_vi) ? x_tr_vi : x_br_vi; if (top < 0) top = 0; if (top > M_vi - 1) top = M_vi - 1; if (left < 0) left = 0; if (left > N_vi - 1) left = N_vi - 1; if (bottom < top) bottom = top; if (bottom > M_vi - 1) bottom = M_vi - 1; if (right < left) right = left; if (right > N_vi - 1) right = N_vi -1; viLockRectangle = new Rectangle(left, top, right - left + 1, bottom - top + 1); }
public void Init(FPFImage ir_img, ViImage vi_img, Metadata mt) { this.irImage = ir_img; this.viImage = vi_img; map.Init(mt); }