示例#1
0
        /// <summary>
        /// Create some default features for use with a target image
        /// </summary>
        private void createDefaultKnownFeatures(String path)
        {
            Byte value=0;
            Byte high_value = 180;
            Byte low_value = 60;
            classimage_mono known_feature = new classimage_mono();
            known_feature.createImage((int)Camera_Constants.BOXSIZE, (int)Camera_Constants.BOXSIZE);

            for (int i = 0; i < 4; i++)
            {
                for (int x = 0; x < Camera_Constants.BOXSIZE; x++)
                {
                    for (int y = 0; y < Camera_Constants.BOXSIZE; y++)
                    {
                        switch (i)
                        {
                            case 0:
                                {
                                    if ((x > Camera_Constants.BOXSIZE / 2) &&
                                        (y > Camera_Constants.BOXSIZE / 2))
                                        value = low_value;
                                    else
                                        value = high_value;
                                    break;
                                }
                            case 1:
                                {
                                    if ((x < Camera_Constants.BOXSIZE / 2) &&
                                        (y > Camera_Constants.BOXSIZE / 2))
                                        value = low_value;
                                    else
                                        value = high_value;
                                    break;
                                }
                            case 2:
                                {
                                    if ((x > Camera_Constants.BOXSIZE / 2) &&
                                        (y < Camera_Constants.BOXSIZE / 2))
                                        value = low_value;
                                    else
                                        value = high_value;
                                    break;
                                }
                            case 3:
                                {
                                    if ((x < Camera_Constants.BOXSIZE / 2) &&
                                        (y < Camera_Constants.BOXSIZE / 2))
                                        value = low_value;
                                    else
                                        value = high_value;
                                    break;
                                }
                        }

                        known_feature.image[x, y] = value;
                    }
                }
                known_feature.SaveAsBitmapMono(path + "known_patch" + Convert.ToString(i) + ".bmp");
            }
        }
示例#2
0
文件: robot.cs 项目: iManbot/monoslam
        //**************************Write Image Patch to Disk**************************

        /// <summary>
        /// Save the currently-selected patch to a file.
        /// </summary>
        /// <param name="name"></param>
        public void write_patch(String name)
        {
            classimage_mono hip = new classimage_mono();
            hip.createImage((int)Camera_Constants.BOXSIZE, (int)Camera_Constants.BOXSIZE);

            if (location_selected_flag)
            {
                // Copy the selected patch to the save space patch 
                copy_into_patch(image, hip, uu, vv);
                hip.SaveAsBitmapMono(name);
            }
        }