Example #1
0
        /// <summary>
        /// Make a measurement of a feature. This function calls elliptical_search() to
        /// find the best match within three standard deviations of the predicted location.
        /// </summary>
        /// <param name="patch">The identifier for this feature (in this case an image patch)</param>
        /// <param name="z">The best image location match for the feature, to be filled in by this function</param>
        /// <param name="h">The expected image location</param>
        /// <param name="S">The expected location covariance, used to specify the search region.</param>
        /// <returns></returns>
        public override bool measure_feature(byte[] patch,
		                                     int patchwidth,
		                                     ref Vector z, 
		                                     Vector vz, 
		                                     Vector h, 
		                                     MatrixFixed S, 
		                                     Random rnd)
        {
            Cholesky S_cholesky = new Cholesky(S);
            MatrixFixed Sinv = S_cholesky.Inverse();

            uint u_found = 0, v_found = 0;
            
            if (SceneLib.elliptical_search(image, image_width, image_height,
			                               patch, patchwidth, patchwidth,
                                           h, Sinv, 
			                               ref u_found, 
			                               ref v_found, 
			                               vz, 
			                               Camera_Constants.BOXSIZE, 
			                               outputimage,
			                               outputimage_width, outputimage_height,
			                               show_ellipses, 
			                               calibrating, 
			                               rnd) != true)
            {
                // Feature not successfully matched
                return false;
            }

            z.Put(0, (float)u_found);
            z.Put(1, (float)v_found);
            
            return true;
        }
Example #2
0
        /// <summary>
        /// Creates a new ImageMonoExtraData to represent the currently-selected image
        /// patch, and also returns its location in the parameter z. The current
        /// image patch is set using set_image_selection_automatically() or manually by the
        /// user using set_image_selection().
        /// </summary>
        /// <param name="z">The measurement vector to be filled in</param>
        /// <returns>The classimage holding this image patch information (created using new, so must be deleted elsewhere), or null if no patch is currently selected.</returns>
        public byte[] partially_initialise_point_feature(Vector z)
        {
            if (location_selected_flag) // Patch selected
            {
                // Go and initialise it in scene + 3D  
                byte[] hip = new byte[(int)Camera_Constants.BOXSIZE * (int)Camera_Constants.BOXSIZE];

                // Final save of fixated image patch
                copy_into_patch(image, hip, uu, vv);

                // And set measurement
                z.Put(0, uu);
                z.Put(1, vv);

                // return the patch
                return hip;
            }
            else
            {
                // No patch selected
                return null;
            }
        }
Example #3
0
        /// <summary>
        /// Creates a new ImageMonoExtraData to represent the currently-selected image
        /// patch, and also returns its location in the parameter z. The current
        /// image patch is set using set_image_selection_automatically() or manually by the
        /// user using set_image_selection().
        /// </summary>
        /// <param name="z">The measurement vector to be filled in</param>
        /// <returns>The classimage holding this image patch information (created using new, so must be deleted elsewhere), or null if no patch is currently selected.</returns>
        public classimage_mono partially_initialise_point_feature(Vector z)
        {
            if (location_selected_flag) // Patch selected
            {
                // Go and initialise it in scene + 3D  
                classimage_mono hip = new classimage_mono();
                hip.createImage((int)Camera_Constants.BOXSIZE, (int)Camera_Constants.BOXSIZE);

                // Final save of fixated image patch
                copy_into_patch(image, hip, uu, vv);

                // And set measurement
                z.Put(0, uu);
                z.Put(1, vv);

                // return the patch
                return hip;
            }
            else
            {
                // No patch selected
                return null;
            }
        }