void OnTriggerEnter(Collider collider) { if (collider.transform.parent.name == (CAM.CorridorLength - 3).ToString()) { direct(CAM.Pilot()); } }
public CameraEntiy this[CAM camera] { get { return(this.Entiys[camera]); } }
/* * Each Track just needs a name - the rest is maintained * automatically by the parent CAM. */ public CAMTrackImp(CAM parent, String name, UInt32 trackUid) { this.parent = parent; this.trackUid = trackUid; #if UNITY_ANDROID if (canDoAnnotations()) { gator_cam_track(parent.viewUid, this.trackUid, 0xffffffff, name); } #endif }
public void addMessage(IMessage _Message) { Node tmp = Head; if (notEmpty(_Message)) { if (_Message.GetType().Name.Equals("DENM")) { addDENM(_Message); return; } while (tmp.Next != null) { if (tmp.Data.GetType().Name.Equals("CAM")) { CAM message = (CAM)_Message; CAM data = (CAM)tmp.Data; if (equilsTime(message.gernerationDeltaTime, data.gernerationDeltaTime)) { addCAM(_Message, tmp); return; } } tmp = tmp.Next; } if (tmp.Next == null) { if (tmp.Data.GetType().Name.Equals("DENM") && _Message.GetType().Name.Equals("CAM")) { addLastCAM(_Message); } else if (tmp.Data.GetType().Name.Equals("CAM") && _Message.GetType().Name.Equals("CAM")) { CAM message = (CAM)_Message; CAM data = (CAM)tmp.Data; if (equilsTime(message.gernerationDeltaTime, data.gernerationDeltaTime)) { addFirstCAM(_Message); } else { addLastCAM(_Message); } } } } }
/* * Retrieves the existing time and uses it to register the start * of a job. Finish it with a call to stop(). If you want to * register a job after the fact, use Track.registerJob() to * register a Job with a specific start and end time. */ public CAMJobImp(CAM parent, UInt32 trackUid, UInt32 jobUid, string name, UInt32 color) { this.viewUid = parent.viewUid; this.jobUid = jobUid; this.trackUid = trackUid; #if UNITY_ANDROID if (canDoAnnotations()) { UInt64 startTime = gator_get_time(); gator_cam_job_start(this.viewUid, this.jobUid, name, this.trackUid, startTime, color); } #endif }
// Update is called once per frame void Update() { if (initiate == 0) { // initiate black skybox fixedCamera.GetComponent <Camera>().enabled = false; mirrorCamera.GetComponent <Camera>().enabled = false; mouseCamera.GetComponent <Camera>().enabled = true; simCamera.GetComponent <Camera>().enabled = false; selected = CAM.MOUSE; initiate++; } else if (initiate == 1) { // switch to fixed camera fixedCamera.GetComponent <Camera>().enabled = true; mirrorCamera.GetComponent <Camera>().enabled = false; mouseCamera.GetComponent <Camera>().enabled = false; simCamera.GetComponent <Camera>().enabled = false; selected = CAM.FIXED; initiate++; } if (Input.GetButtonDown("ChangeCam")) { if (selected == CAM.FIXED) { fixedCamera.GetComponent <Camera>().enabled = false; mirrorCamera.GetComponent <Camera>().enabled = true; mouseCamera.GetComponent <Camera>().enabled = false; simCamera.GetComponent <Camera>().enabled = false; selected = CAM.MIRROR; } else if (selected == CAM.MIRROR) { fixedCamera.GetComponent <Camera>().enabled = false; mirrorCamera.GetComponent <Camera>().enabled = false; mouseCamera.GetComponent <Camera>().enabled = true; simCamera.GetComponent <Camera>().enabled = false; selected = CAM.MOUSE; } else if (selected == CAM.MOUSE) { fixedCamera.GetComponent <Camera>().enabled = true; mirrorCamera.GetComponent <Camera>().enabled = false; mouseCamera.GetComponent <Camera>().enabled = false; simCamera.GetComponent <Camera>().enabled = false; selected = CAM.FIXED; } } }
/// <summary> /// Returns a task to generate a CAM color map from a CAM object. /// </summary> /// <param name="cam">The CAM object.</param> /// <param name="color">Color for the color map.</param> /// <param name="width">Width of the generated color map.</param> /// <param name="height">Height of the generated color map.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> to cancel the task returned by this method.</param> /// <returns>The CAM color map SKBitmap.</returns> public static Task <SKBitmap> GetCAMColorMapTask(CAM cam, SKColor color, int width, int height, CancellationToken cancellationToken) { return(Task.Factory.StartNew(() => { SKBitmap colorMap = ImageProcessor.GenerateColorMap(cam, color, width, height); if (cancellationToken.IsCancellationRequested) { colorMap.Dispose(); cancellationToken.ThrowIfCancellationRequested(); } System.Diagnostics.Debug.WriteLine("CAM color map generated"); return colorMap; }, cancellationToken)); }
public CAM generatCAM(uint _stationID) { generateCAM++; uint messageID = (uint)generateCAM; uint stationID = 0; uint protocolVersion = 0; DateTime time = DateTime.UtcNow; string name = "generierte CAM " + generateCAM; //var C = new CAM(new Header(messageID, stationID, protocolVersion), time, new CAMParameters(name)); var C = new CAM(new Header(messageID, stationID, protocolVersion), generateTime(), new CAMParameters(name)); CultureInfo culture = new CultureInfo(cultureNames[culterNumber]); Console.WriteLine("Create CAM \t {0}", time.ToString(culture)); return(C); }
/// <summary> /// Generates an <see cref="SKBitmap"/> of size width x height that represents a set of CAM values mapped over shades of a particular color /// and interpolated to fill the size. /// i.e. The areas with a higher CAM value will appear as a higher intensity of the provided color. /// Note: All channels of the input color are mapped (Red, Green, Blue, Alpha). /// </summary> /// <param name="cam">The CAM data to map.</param> /// <param name="color">The color to map the CAM values over.</param> /// <param name="width">The desired width of the resulting color-map.</param> /// <param name="height">The desired height of the resulting color-map.</param> /// <returns>The color-mapped CAM as a <see cref="SKBitmap"/>.</returns> public static SKBitmap GenerateColorMap(CAM cam, SKColor color, int width, int height) { // Create an array to hold the output float[,] expCAMData = new float[cam.Rows, cam.Cols]; // Map the input data onto an exponential curve (retain higher intensities more than lower intensities) for (int row = 0; row < cam.Rows; row++) { for (int col = 0; col < cam.Cols; col++) { expCAMData[row, col] = (float)Math.Pow(ExpMappingBase, cam[row, col]); } } CAM expCAM = new CAM(expCAMData); // Normalize the new CAM to be between 0 and 1 CAM normalizedCAM = expCAM.Normalize(); // Create a bitmap to hold the output SKBitmap bitmap = new SKBitmap(new SKImageInfo(cam.Cols, cam.Rows, SKColorType.Rgba8888)); // Iterate through and fill the bitmap for (int row = 0; row < cam.Rows; row++) { for (int col = 0; col < cam.Cols; col++) { float camVal = normalizedCAM[row, col]; // SetPixel accepts an x and y coordinate: the row is the y coordinate, the column is the x coordinate bitmap.SetPixel(col, row, new SKColor( (byte)(color.Red * camVal), (byte)(color.Green * camVal), (byte)(color.Blue * camVal), (byte)(color.Alpha * camVal) )); } } // Resize the bitmap (with interpolation) to the desired width and height return(bitmap.Resize(new SKImageInfo(width, height), SKBitmapResizeMethod.Lanczos3)); }
private void ExtractResultsFromIntent() { // Load and unparcel scores IParcelable[] parcelableScores = this.Intent.GetParcelableArrayExtra(ExtraScores); ScoreOutput[] scores = new ScoreOutput[parcelableScores.Length]; for (int i = 0; i < parcelableScores.Length; i++) { scores[i] = ((ParcelableScoreOutput)parcelableScores[i]).Value; } // Load and unparcel CAMs IParcelable[] parcelableCAMs = this.Intent.GetParcelableArrayExtra(ExtraCAMs); CAM[] cams = new CAM[parcelableCAMs.Length]; for (int i = 0; i < parcelableCAMs.Length; i++) { cams[i] = ((ParcelableCAM)parcelableCAMs[i]).Value; } // Collapse into results array results = ResultsHelper.BuildConditionResultArray((ChestCondition[])Enum.GetValues(typeof(ChestCondition)), scores, cams, conditionColors); }
static int EntryPoint() { // Create and start the thread for receiving and parsing the tuple RX rx = new RX(); Thread tuple_parser = new Thread(new ThreadStart(rx.parse_rx)); tuple_parser.Start(); // Create and start the thread for retrieving the tuple from the CAM CAM cam = new CAM(); Thread tupler = new Thread(new ThreadStart(cam.find_tuple)); tupler.Start(); while (true) { Kiwi.Pause(); } ; return(0); }
public bool LoadCalibImage(CAM camera) { try { int len = 1; if (camera == CAM.Bottom1 || camera == CAM.Bottom2) { len = 2; } // 读取标定文件 this.CalibImage = new VisionImage[len]; this.CenterPt = new PointContour[len]; this.IsCailb = true; for (int i = 0; i < len; ++i) { this.CalibImage[i] = new VisionImage(); this.CenterPt[i] = new PointContour(); string direct = string.Format(Variable.sPath_CaliPath, (int)camera, i); this.CalibImage[i].ReadVisionFile(direct + Variable.sPath_CaliImage); // 中心点像素坐标 this.CenterPt[i].X = this.Config.FOV.Width / 2; this.CenterPt[i].Y = this.Config.FOV.Height / 2; var coordreport = Algorithms.ConvertPixelToRealWorldCoordinates(this.CalibImage[i], this.CenterPt[i]); if (coordreport.Points.Count > 0) { this.CenterPt[i] = coordreport.Points[0]; } else { this.IsCailb = false; } } } catch { this.IsCailb = false; } return(this.IsCailb); }
/// <summary> /// Reconstructs a <see cref="ParcelableCAM"/> object from the provided <see cref="Parcel"/> /// </summary> /// <param name="parcel">The <see cref="Parcel"/> containing the data to use for reconstruction.</param> private ParcelableCAM(Parcel parcel) { // Read out the dimensions to initialize the array // (order matches the order they were written) int rows = parcel.ReadInt(); int cols = parcel.ReadInt(); float[,] camData = new float[rows, cols]; // Deserialize the 1D array to a 2D array float[] camData1D = new float[rows * cols]; parcel.ReadFloatArray(camData1D); for (int row = 0; row < rows; row++) { for (int col = 0; col < cols; col++) { camData[row, col] = camData1D[row * cols + col]; } } this.Value = new CAM(camData); }
private async Task <Bitmap> GenerateBlendedCAMImage(CAM cam, SKColor color) { // Cancel the previous blending task if there is one cancellationTokenSource?.Cancel(); cancellationTokenSource = new CancellationTokenSource(); // Dispose of previous blended image blendedImage?.Dispose(); SKBitmap colorMap = await ImageProcessorRunner.GetCAMColorMapTask( cam, color, originalXRay.Width, originalXRay.Height, cancellationTokenSource.Token ); SKBitmap input = originalXRay.ToSKBitmap(); SKBitmap blendedSKBitmap = await ImageProcessorRunner.GetOverlayImageTask( input, colorMap, cancellationTokenSource.Token ); // Dispose of temporary SKBitmap input.Dispose(); Bitmap blendedBitmap = blendedSKBitmap.ToBitmap(); // Cleanup the intermediate bitmaps colorMap?.Dispose(); blendedSKBitmap?.Dispose(); return(blendedBitmap); }
/// <summary> /// Generates a blended image with a CAM and the desired overlay color /// </summary> /// <returns>The blended CAMI mage.</returns> /// <param name="index">Index.</param> /// <param name="color">Color.</param> private async Task <UIImage> GenerateBlendedCAMImage(CAM cam, SKColor color) { // Cancel the previous blending task if there is one cancellationTokenSource?.Cancel(); cancellationTokenSource = new CancellationTokenSource(); // Dispose of previous blended image blendedImage?.Dispose(); SKBitmap colorMap = await ImageProcessorRunner.GetCAMColorMapTask( cam, color, (int)(InputImage.Size.Width *InputImage.CurrentScale), (int)(InputImage.Size.Height *InputImage.CurrentScale), cancellationTokenSource.Token ); SKBitmap input = InputImage.ToSKBitmap(); SKBitmap blendedSKBitmap = await ImageProcessorRunner.GetOverlayImageTask( input, colorMap, cancellationTokenSource.Token ); // Dispose of temporary SKBitmap input.Dispose(); UIImage blendedUIImage = blendedSKBitmap.ToUIImage(); // Cleanup the intermediate bitmaps colorMap?.Dispose(); blendedSKBitmap?.Dispose(); return(blendedUIImage); }
private void UpdateBaslerDeviceList() { try { // Ask the camera finder for a list of camera devices. BaslerCameraAll = CameraFinder.Enumerate(); foreach (ICameraInfo cameraInfo in BaslerCameraAll) { // Loop over all cameras in the list of cameras. bool newitem = true; foreach (CAM cam in CAMs) { ICameraInfo tag = cam.Tag as ICameraInfo; // Is the camera found already in the list of cameras? if (tag[CameraInfoKey.FullName] == cameraInfo[CameraInfoKey.FullName]) { tag = cameraInfo; newitem = false; break; } } // If the camera is not in the list, add it to the list. if (newitem) { // Create the item to display. CAM cam = new CAM() { Name = cameraInfo[CameraInfoKey.FullName], Tag = cameraInfo, CAMType = CAMTYPE.BASLER }; CAMs.Add(cam); } } // Remove old camera devices that have been disconnected. foreach (CAM cam in CAMs) { bool exists = false; // For each camera in the list, check whether it can be found by enumeration. foreach (ICameraInfo cameraInfo in BaslerCameraAll) { if (((ICameraInfo)cam.Tag)[CameraInfoKey.FullName] == cameraInfo[CameraInfoKey.FullName]) { exists = true; break; } } // If the camera has not been found, remove it from the list view. if (!exists) { CAMs.Remove(cam); } } } catch (Exception e) { Debug.WriteLine("Exception: {0}", e.Message); } }
/// <summary> /// Initializes a new instance of <see cref="ConditionResult"/> with the provided data /// </summary> public ConditionResult(ChestCondition condition, ScoreOutput score, CAM cam) { Condition = condition; Score = score; CAM = cam; }
/// <summary> /// Application entry point. /// </summary> /// <param name="args">Standard command-line arguments.</param> public static void Main( string[] args ) { // Attempt a simple CM query. string searchPath = "//report"; string userName = "******"; string userPassword = "******"; string userNamespace = "namespaceID"; char[] arg_separator = { '=' }; foreach( string arg in args ) { string[] command = arg.Split( arg_separator, 2 ); switch( command[0] ) { case "--search": searchPath = command[1]; break; case "--uid": userName = command[1]; break; case "--pwd": userPassword = command[1]; break; case "--namespace": userNamespace = command[1]; break; default: throw new ApplicationException( "Unknown argument: " + arg ); } } // Concatenate the read filter to the searchPath this way we // ask CM to only return the objects we have read acces on. searchPath = searchPath + "[permission('read')]"; // Create the ReportNet connection object. Console.WriteLine( "Creating CognosReportNetService..." ); CognosReportNetService crn = new CognosReportNetService(); crn.Url = "http://localhost:8080/series8/cgi-bin/cognos.cgi"; // Add the authentication information, if any. // // Another option would be to use the logon() methods... CAM cam = new CAM(); cam.action = "logonAs"; hdrSession header = new hdrSession(); if( userName != null ) { formFieldVar[] vars = new formFieldVar[3]; vars[0] = new formFieldVar(); vars[0].name = "CAMNamespace"; vars[0].value = userNamespace; vars[0].format = formatEnum.not_encrypted; vars[1] = new formFieldVar(); vars[1].name = "CAMUsername"; vars[1].value = userName; vars[1].format = formatEnum.not_encrypted; vars[2] = new formFieldVar(); vars[2].name = "CAMPassword"; vars[2].value = userPassword; vars[2].format = formatEnum.not_encrypted; header.formFieldVars = vars; } else { cam.action = "logon"; } biBusHeader bibus = new biBusHeader(); bibus.CAM = cam; bibus.hdrSession = header; crn.biBusHeaderValue = bibus; try { propEnum[] props = new propEnum[] { propEnum.searchPath, propEnum.defaultName, propEnum.policies, propEnum.permissions, propEnum.members }; sort[] s = new sort[]{ new sort() }; s[0].order = orderEnum.ascending; s[0].propName = propEnum.defaultName; queryOptions qo = new queryOptions(); // Look for all of the reports. Console.WriteLine( "\nReports:\n" ); baseClass[] bc = crn.query( "/content//report", props, s, qo ); if( bc.Length > 0 ) { foreach( baseClass report_item in bc ) { Console.WriteLine( " {0}", report_item.searchPath.value); policy[] p = report_item.policies.value; if (p.Length > 0) { foreach( policy pol in p ) { Console.WriteLine( " {0}", pol.securityObject.searchPath.value); permission[] perm = pol.permissions; foreach( permission prm in perm ) Console.WriteLine( " {0} {1}",prm.name, prm.access.ToString()); } } } } } catch( System.Web.Services.Protocols.SoapHeaderException ex ) { Console.WriteLine( "SOAP Header Exception:" ); Console.WriteLine( "Actor : " + ex.Actor ); Console.WriteLine( "Code : " + ex.Code ); Console.WriteLine( "Detail : " + ex.Detail ); Console.WriteLine( "Message: " + ex.Message ); // We can access the SOAP fault information through // the ex.Detail property. System.Xml.XmlNode node = ex.Detail; Console.WriteLine( node.OuterXml ); } catch( System.Web.Services.Protocols.SoapException ex ) { Console.WriteLine( "SOAP Exception:" ); Console.WriteLine( "Actor : " + ex.Actor ); Console.WriteLine( "Code : " + ex.Code ); Console.WriteLine( "Detail : " + ex.Detail ); Console.WriteLine( "Message: " + ex.Message ); // We can access the SOAP fault information through // the ex.Detail property. System.Xml.XmlNode node = ex.Detail; Console.WriteLine( node.OuterXml ); } }
public string doQuery(CognosReportNetService reportNet, string searchPath, string userName, string userPassword, string userNamespace, bool isGUImode) { string output = ""; try { // Search properties: we need the defaultName and the searchPath. propEnum[] properties = { propEnum.defaultName, propEnum.searchPath }; // Sort options: ascending sort on the defaultName property. sort[] sortBy = { new sort()}; sortBy[0].order = orderEnum.ascending; sortBy[0].propName = propEnum.defaultName; // Query options; use the defaults. queryOptions options = new queryOptions(); // Add the authentication information, if any. // // Another option would be to use the logon() and logonAs() methods... CAM cam = new CAM(); cam.action = "logonAs"; hdrSession header = new hdrSession(); if ((userName != null) && (0 != userName.CompareTo("")) ) { formFieldVar[] vars = new formFieldVar[3]; vars[0] = new formFieldVar(); vars[0].name = "CAMNamespace"; vars[0].value = userNamespace; vars[0].format = formatEnum.not_encrypted; vars[1] = new formFieldVar(); vars[1].name = "CAMUsername"; vars[1].value = userName; vars[1].format = formatEnum.not_encrypted; vars[2] = new formFieldVar(); vars[2].name = "CAMPassword"; vars[2].value = userPassword; vars[2].format = formatEnum.not_encrypted; header.formFieldVars = vars; } else { cam.action = "logon"; } biBusHeader bibus = new biBusHeader(); bibus.CAM = cam; bibus.hdrSession = header; reportNet.biBusHeaderValue = bibus; // Make the query. baseClass[] results = reportNet.query(searchPath, properties, sortBy, options); // Display the results. output += "Results:\n\n"; for (int i = 0; i < results.GetLength(0); i++) { tokenProp theDefaultName = results[i].defaultName; stringProp theSearchPath = results[i].searchPath; output += "\t" + theDefaultName.value + "\t\t" + theSearchPath.value + "\n"; } } catch(SoapException ex) { SamplesException.ShowExceptionMessage("\n" + ex, isGUImode, "Content Manager Query Sample - doQuery()" ); return "The error occurred in doQuery()"; } catch(System.Exception ex) { if (0 != ex.Message.CompareTo("INPUT_CANCELLED_BY_USER")) { SamplesException.ShowExceptionMessage("\n" + ex.Message, isGUImode, "Content Manager Query Sample - doQuery()" ); } return "The error occurred in doQuery()"; } return output; }
/// <summary> /// Initializes a new instance of the <see cref="ParcelableCAM"/> class to wrap the provided <see cref="CAM"/>. /// </summary> /// <param name="value">The <see cref="CAM"/> to wrap.</param> public ParcelableCAM(CAM value) { this.Value = value; }