size

How to set android camera2 preview and capture size?

匿名 (未验证) 提交于 2019-12-03 01:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using a SurfaceView to show the preview I capture. I want to use width=1080,height=1920 for the preview. Where can I set the size of the preview? I googled for an answer, but they are all for camera version one. I am using the android.hardware.camera2. private void takePreview() { try { final CaptureRequest.Builder previewRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW); previewRequestBuilder.addTarget(mSurfaceHolder.getSurface()); mCameraDevice.createCaptureSession(Arrays.asList(mSurfaceHolder

散列表

匿名 (未验证) 提交于 2019-12-03 00:36:02
一.散列表(Hash Table) 1.用来实现字典操作的一组有效数据结构 2.直接寻址表(直接寻址):数组T[0...m-1],可以存放动态集合的元素 1 class direct_address_table: 2 ‘‘‘ 直接寻址表 ‘‘‘ 3 def __init__ (self, T=[], size= 0): 4 if len(T) == 0: 5 self.T = [None for i in range(size)] 6 else : 7 self.T = T 8 self.size = size 9 ‘‘‘ 对于节点 ‘‘‘ 10 def search(self, k): 11 return self.T[k] 12 13 def insert(self, x): 14 self.T[x.key] = x 15 16 def delete(self, x): 17 self.T[x.key] = None 18 19 class Node: 20 def __init__ (self, key): 21 self.key = key 22 23 T= [] 24 dat=direct_address_table(T,10 ) 25 x=Node(2 ) 26 print (dat.insert(x)) 直接寻址表 3.散列表:利用散列函数(hash function

连接池模板

匿名 (未验证) 提交于 2019-12-03 00:34:01
/*************************************************************** function: connect pool template for mysql, redis, memcached ... author: liuyi date: 2016.04.13 version: 1.0 ***************************************************************/ #ifndef CONNECT_POOL_H #define COMMECT_POOL_H #include <stdlib.h> #include <iostream> #include <vector> #include <pthread.h> using namespace std; template<class T> class connect_pool { public: static connect_pool<T> * get_instance() { static connect_pool<T> s_instance; return &s_instance; } bool init(vector<T*> connect_ptrs) { if(connect_ptrs.empty()) return

NSTimer设置引导页自动轮播

匿名 (未验证) 提交于 2019-12-03 00:22:01
通过UIScrollView实现 签协议 < UIScrollViewDelegate > 定义属性 @property ( nonatomic , strong ) UIScrollView *yyScrollView; @property ( nonatomic , assign ) int conut; 代码如下: - (void)viewDidLoad { [super viewDidLoad] ; self .conut = 0 ; // 创建滚动视图,并设置其相关的属性 _yyScrollView = [[UIScrollView alloc] initWithFrame:self .view .frame ] ; [self .view addSubview:_yyScrollView] ; _yyScrollView .delegate = self ; _yyScrollView .pagingEnabled = YES ; _yyScrollView .bounces = NO ; _yyScrollView .contentSize = CGSizeMake(self .view .frame .size .width * 3 , 0 ) ; _yyScrollView .showsVerticalScrollIndicator = NO ; __weak

OpenCV笔记:滤波器

匿名 (未验证) 提交于 2019-12-03 00:19:01
void boxFilter( InputArray src, OutputArray dst, int ddepth, Size ksize, Point anchor=Point(- 1 ,- 1 ), bool normalize = true , int borderType=BORDER_DEFAULT ); static void on_box_filter( int , void *) { if (box_filter_size < 3 ) box_filter_size = 3 ; boxFilter(lena_bmp, box_filter_bmp, - 1 , Size(box_filter_size, box_filter_size)); imshow( "Box Filter" , box_filter_bmp); } int main() { lena_bmp = imread( "../lena.bmp" ); namedWindow( "Box Filter" , 1 ); createTrackbar( "Size" , "Box Filter" , &box_filter_size, 40 , on_box_filter); imshow( "Box Filter" , lena_bmp); waitKey( 0 ); } void blur(

Count, size, length…too many choices in Ruby?

走远了吗. 提交于 2019-12-03 00:18:09
问题 I can't seem to find a definitive answer on this and I want to make sure I understand this to the "n'th level" :-) a = { "a" => "Hello", "b" => "World" } a.count # 2 a.size # 2 a.length # 2 a = [ 10, 20 ] a.count # 2 a.size # 2 a.length # 2 So which to use? If I want to know if a has more than one element then it doesn't seem to matter but I want to make sure I understand the real difference. This applies to arrays too. I get the same results. Also, I realize that count/size/length have

【Codeforces Round #589 (Div. 2) D】Complete Tripartite

匿名 (未验证) 提交于 2019-12-03 00:13:02
【链接】 我是链接,点我呀:) 【题意】 题意 【题解】 其实这道题感觉有点狗。 思路大概是这样 先让所有的点都在1集合中。 然后随便选一个点x,访问它的出度y 显然tag[y]=2 因为和他相连了嘛 然后其他没有和x相连的点显然 只能和x在同一个集合中 所以其他1集合的点你会发现你想改也没法改,就算他们有可能连在一起也没用,因为你不可能再把其他的1改成2了,因为会和你之前选的A冲突(和这个你想 改的2没有边相连) 这就是这题的主要ideal,就是抓住这一点做文章。 然后接着,我们仍然是随便找一个2号集合里面的点a,遍历它的出度b 显然b只能放在3集合里了。 然后仍然是,你会发现你也不能去动3号集合里的元素了。 就这么锁死了。。。 然后去验证形成的集合是否满足题中给的关系就好。 要记得先判断|set1 set2|+|set1 set3|+|set2 set3|是不是等于m 不然直接暴力判断的话 如果这3个和加起来很大的话(因为你肯定就得这样暴力判断的),会超时的. (如果等于m的话,你看题中m是比较小的<=3 10^5,所以暴力判断没问题) 【代码】 #include < bits / stdc ++. h > using namespace std ; const int N = 1e5 ; int n , m ; int ans [ N + 10 ]; vector <int>

【R】调整ggplot图例大小

匿名 (未验证) 提交于 2019-12-02 23:57:01
图例太多时,会挤压正图,显得正图展示区域很小,这时有必要缩小图例。 ################# # 减小ggplot图例 ################# library ( ggplot2 ) p <- ggplot ( mtcars , aes ( drat , mpg , color = factor ( gear ), shape = factor ( vs ))) + geom_point ( size = 2 ) + theme_classic () + theme ( legend . position = c ( 0.1 , 0.7 )) p # Overwrite given size (2) to 0.5 (super small) p <- p + guides ( shape = guide_legend ( override . aes = list ( size = 0.5 ))) p p <- p + guides ( color = guide_legend ( override . aes = list ( size = 0.5 ))) p p <- p + theme ( legend . title = element_text ( size = 3 ), legend . text = element_text ( size = 3

iOS 视图渲染数据转CVPixelBuffer

匿名 (未验证) 提交于 2019-12-02 23:55:01
void *pxdata = CVPixelBufferGetBaseAddress(pxbuffer); - ( CVPixelBufferRef ) CVPixelBufferRef { CGSize size = self . frame . size ; NSDictionary * options = @{( NSString *) kCVPixelBufferCGImageCompatibilityKey : @YES , ( NSString *) kCVPixelBufferCGBitmapContextCompatibilityKey : @YES , ( NSString *) kCVPixelBufferIOSurfacePropertiesKey : [ NSDictionary dictionary ]}; CVPixelBufferRef pxbuffer = NULL ; CGFloat frameWidth = size . width ; CGFloat frameHeight = size . height ; CVReturn status = CVPixelBufferCreate ( kCFAllocatorDefault , frameWidth , frameHeight , kCVPixelFormatType_32ARGB , (

函数指针数组的最佳实践

匿名 (未验证) 提交于 2019-12-02 23:54:01
1 #include<iostream> 2 #include<fstream> 3 #include<string.h> 4 using namespace std; 5 6 class Student; 7 8 typedef void(CALL)(Student*,int); 9 10 class Student 11 { 12 public: 13 string name; 14 int age; 15 char sex; 16 public: 17 Student(){} 18 ~Student(){} 19 }; 20 21 void write_object(Student *students,int size) 22 { 23 ofstream ofs("text.bat"); 24 if(ofs) 25 { 26 for(int i=0;i<size;i++) 27 { 28 cin>>students[i].name>>students[i].age>>students[i].sex; 29 ofs.write(reinterpret_cast<const char*>(&students[i]),sizeof(students[i])); 30 } 31 } 32 else 33 { 34 cout<<"write failed"<<endl; 35 } 36