上传文件至 /
This commit is contained in:
		
							parent
							
								
									f23783e77c
								
							
						
					
					
						commit
						6b07338ff2
					
				
							
								
								
									
										124
									
								
								config.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										124
									
								
								config.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,124 @@ | ||||
| import argparse | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| parser = argparse.ArgumentParser() | ||||
| 
 | ||||
| parser.add_argument('--acreage', type=int, default=100, help='Minimum wall area') | ||||
| parser.add_argument('--length', type=int, default=80, help='Minimum value of wall length in line detection') | ||||
| parser.add_argument('--k', type=int, default=45, help='door width') | ||||
| parser.add_argument('--m', type=int, default=200, help='wall length') | ||||
| parser.add_argument('--log-imgs', type=int, default=16, help='number of images for W&B logging, max 100') | ||||
| parser.add_argument('--workers', type=int, default=8, help='maximum number of dataloader workers') | ||||
| parser.add_argument('--distance', type=int, default=25, help='Minimum distance between wall endpoints') | ||||
| 
 | ||||
| '''语义物体参数设置''' | ||||
| parser.add_argument('--min_samples_115', type=int, default=4, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_115', type=int, default=4, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_115', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_115', type=int, default=1, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_116', type=int, default=10, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_116', type=int, default=15, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_116', type=int, default=0, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_116', type=int, default=0, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_117', type=int, default=10, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_117', type=int, default=15, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_117', type=int, default=0, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_117', type=int, default=0, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_118', type=int, default=16, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_118', type=int, default=28, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_118', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_118', type=int, default=0, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_119', type=int, default=16, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_119', type=int, default=28, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_119', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_119', type=int, default=0, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_120', type=int, default=16, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_120', type=int, default=24, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_120', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_120', type=int, default=0, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_121', type=int, default=4, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_121', type=int, default=15, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_121', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_121', type=int, default=0, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_150', type=int, default=8, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_150', type=int, default=20, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_150', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_150', type=int, default=0, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_151', type=int, default=10, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_151', type=int, default=28, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_151', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_151', type=int, default=0, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_152', type=int, default=10, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_152', type=int, default=60, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_152', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_152', type=int, default=0, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_153', type=int, default=12, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_153', type=int, default=10, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_153', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_153', type=int, default=0, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_154', type=int, default=4, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_154', type=int, default=8, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_154', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_154', type=int, default=1, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_155', type=int, default=8, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_155', type=int, default=40, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_155', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_155', type=int, default=0, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_156', type=int, default=4, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_156', type=int, default=60, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_156', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_156', type=int, default=0, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_200', type=int, default=8, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_200', type=int, default=6, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_200', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_200', type=int, default=1, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_201', type=int, default=4, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_201', type=int, default=4, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_201', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_201', type=int, default=1, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_202', type=int, default=20, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_202', type=int, default=60, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_202', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_202', type=int, default=0, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| 
 | ||||
| parser.add_argument('--min_samples_203', type=int, default=2, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_203', type=int, default=80, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_203', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_203', type=int, default=0, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_204', type=int, default=4, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_204', type=int, default=60, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_204', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_204', type=int, default=0, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| 
 | ||||
| parser.add_argument('--min_samples_205', type=int, default=2, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_205', type=int, default=14, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_205', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_205', type=int, default=0, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| parser.add_argument('--min_samples_209', type=int, default=4, help='Minimum number of samples') | ||||
| parser.add_argument('--max_eps_209', type=int, default=4, help='Maximum cluster radius') | ||||
| parser.add_argument('--shape_209', type=int, default=1, help='Shape 0 is a circle, shape 1 is a rectangle') | ||||
| parser.add_argument('--size_209', type=int, default=1, help='0 means by outline, 1 means regular rectangle') | ||||
| 
 | ||||
| 
 | ||||
| opt = parser.parse_args() | ||||
							
								
								
									
										53
									
								
								map.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								map.cpp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,53 @@ | ||||
| #include"ros/ros.h" | ||||
| #include "nav_msgs/OccupancyGrid.h" | ||||
| #include "std_msgs/String.h" | ||||
| #include <opencv2/opencv.hpp> | ||||
| #include <opencv2/highgui.hpp> | ||||
| #include <stdio.h> | ||||
| 
 | ||||
|   | ||||
| 
 | ||||
| 
 | ||||
| void callback(const nav_msgs::OccupancyGrid::ConstPtr& mapmsg) | ||||
| { | ||||
|    int height,width,k=0; | ||||
|    // cv::Mat map(2000,2000,CV_8UC1);
 | ||||
|    height = mapmsg->info.height; | ||||
|    width = mapmsg->info.width; | ||||
|    cv::Mat map(height,width,CV_8UC1); | ||||
|    std::vector<int> compression_params; | ||||
|    compression_params.push_back(cv::IMWRITE_PNG_COMPRESSION); | ||||
|    compression_params.push_back(0);    | ||||
| 
 | ||||
|    for (int i = 0; i < height; i++) | ||||
|    { | ||||
|        for(int j = 0; j < width; j++) | ||||
|        { | ||||
|           map.at<uchar>(i,j) = mapmsg->data[k]; | ||||
|           k++; | ||||
|        } | ||||
|         | ||||
|    } | ||||
| 
 | ||||
|    cv::imshow("map",map); | ||||
|    if (cv::waitKey(1)==27) | ||||
|    { | ||||
|       cv::imwrite("map.png", map, compression_params); | ||||
|       exit(0); | ||||
|    } | ||||
|     | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| int main(int argc, char *argv[]) | ||||
| { | ||||
|     //init_keyboard();
 | ||||
|     setlocale(LC_ALL,""); | ||||
|     ros::init(argc,argv,"listener_map"); | ||||
|     ros::NodeHandle nh; | ||||
|     ros::Subscriber map_sub = nh.subscribe<nav_msgs::OccupancyGrid>("map",1,callback); | ||||
|     ros::spin(); | ||||
|     return 0; | ||||
| 
 | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user