rect

How to divide an OpenCV Mat in rectangular sub-regions?

时光毁灭记忆、已成空白 提交于 2019-12-02 21:17:28
问题 I want to divide a simple Mat (200x200) in different regions (10x10). I make 2 loops, then I create a Rect where I indicate the variables I want in each iteration (x, y, width, height) . Finally, I save this region of the image inside a vector of Mat s. But something is wrong with my code: Mat face = Mat(200, 200, CV_8UC1); vector<Mat> regions; Mat region_frame; int width = face.cols * 0.05; int heigth = face.rows * 0.05; for(int y=0; y<=(face.rows - heigth); y+=heigth) { for(int x=0; x<=

如何获取窗口的真实边框大小

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 18:25:29
因为Windows 10在左侧,右侧和底部都有细小的看不见的边框,它用于握住鼠标以调整大小。 边框可能看起来像这样:( 7,0,7,7 左,上,右,下) 第一种方法,使用GetWindowRect() GetWindowRect(hwnd, &rect); rect.left += 7; rect.top -= 0; rect.right -= 7; rect.bottom -= 7; 第二种方法,使用DwmGetWindowAttribute() DwmGetWindowAttribute(hWnd, DWMWA_EXTENDED_FRAME_BOUNDS, (PVOID)&rect, sizeof(rect));    来源: https://www.cnblogs.com/strive-sun/p/11757635.html

How to procedurally draw rectangle / lines in swift using CGContext

孤者浪人 提交于 2019-12-02 17:15:26
I've been trawling the internet for days trying to find the simplest code examples on how to draw a rectangle or lines procedurally in Swift. I have seen how to do it by overriding the DrawRect command. I believe you can create a CGContext and then drawing into an image, but I'd love to see some simple code examples. Or is this a terrible approach? Thanks. class MenuController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. self.view.backgroundColor = UIColor.blackColor() var logoFrame = CGRectMake(0

GridCtrl使用详解

无人久伴 提交于 2019-12-02 15:29:52
GridCtrl使用详解 CGridCtrl类主要是通过grid样式显示数据,CGridCtrl的代码与demo请参考: http://www.codeproject.com/KB/miscctrl/gridctrl.aspx 在单文档中的使用方法 步骤一 初始化 在CView类的.h头文件中包含文件: #include "Gridctrl.h" 并且手写加入如下的成员函数: CGridCtrl * m_pGridCtrl; 步骤二 构造与析构 构造函数中: m_pGridCtrl = NULL; 析构函数中: if(m_pGridCtrl) delete m_pGridCtrl; 步骤三 如果需要打印功能的话添加同名打印函数代码 在CView类的OnBeginPrinting()函数中添加如下代码: if(m_pGridCtrl) m_pGridCtrl->OnBeginPrinting(pDC,pInfo); //简单吧,这就是类的好处 其它两个打印函数也一样的做法. 步骤四 在OnInitaUpdate()函数中或者你自己添加的要显示Grid的消息函数中如下初始化: //创建非模式对话框 CDlg *dlg; dlg=new CDlg(); dlg->Create(IDD_Dlg,this); //初始化GridCtrl控件 if(m_pGridCtrl!=NULL) {

Coordinate Error using GetWindowRect in different DPI

a 夏天 提交于 2019-12-02 15:03:24
问题 I want to capture the coordinate of components in my MFC program. Now I can perfectly complete this by using GetWindowRect . However, when I set my windows dpi to 150% (120 dpi), I get different coordinates from GetWindowRect . Therefore, I survey some method to convert new coordinates to that in default dpi (96 dpi). Finally, I found there was some error when I tried: Rect.top = Rect.top * (DEFAULT_DPIY / CURRENT_DPIY); Rect.left = Rect.left * (DEFAULT_DPIX / CURRENT_DPIX); The converted

LEF 格式

╄→гoц情女王★ 提交于 2019-12-02 15:01:38
LEF 文件是布局布线根据使用的cell 几何信息库的文件格式,下面是一个LEF文件的部分,右边是对他的解释。布局布线工具将根据LEF文件的信息决定怎样布局,怎么走线,怎样生成通孔。 VERSION 5.5;版本说明 NAMESCASESITIVE ON;LEF 区分格式大小写。 BUSBITCHARS "< >";  设置定义bus标志符,端口名称为X<1>,X<2>,...X<n> 将看作bus UNITS DATABASE MICRONS 100;  设置定义1微米分成100个unit,即为单位长度的值。 END UNITS LAYER metal1 设置定义层为金属1层,同时下面是对定义的金属1层的具体细节设置。   TYPE ROUTING;   定义metal1用于routing   WIDTH 0.10;  定义金属1层在作为布线金属时,默认线宽为0.1 um   SPACING 0.30;   定义金属1层的走线间距为0.3um   PITCH 1.2;  定义金属1层到通孔的距离为1.2   DIRECTION HORIZONTAL;  金属1层走线方向为水平走线。   CAPACITANCE CPERSQDIST 0.000140; 该设置定义每一个方块(1x1um)的电容大小。   RESISTANCE RPERSQ 0.04;  设置每一个金属的方块电阻。

datagridview 单元格 combox样式

帅比萌擦擦* 提交于 2019-12-02 12:16:00
datagridview控件单元格自带combox样式,即添加列时,类型选为:DataGridViewComboBoxColumn,并可在列的Items中增加下拉项。或通过语句实现: ( ( DataGridViewComboBoxColumn ) dataGridView1 . Columns [ 1 ] ) . Items . AddRange ( new object [ ] { "" , "1" , "2" , "3" , "4" } ) ; ***第一个值为空,意思是可以不做选择,这样在自增行时,也不会因为没有选择-没有对应combox的item而报错。***无论是在设计窗口设计dgv的列还是用代码写出来,这都属于先设计后赋值吧,这种情况一整列的下拉框内容都是一样的。 之前只知道把控件拖进设计窗口,直接程序写的话就没有头绪,今天猛然间意识到,我可以先把控件拖进设计窗口,然后看designer中是怎么写的,这样不就很清楚了吗!!!自己之前真是太笨了,哈哈 2. 目前我们的程序中都是dgv直接绑定数据源,dgv呢,就随着数据源变化,没有做单独的设计,当需要增加combox样式时,为了使变动尽可能最小,所以想到可以直接创建一个combox控件,然后覆盖原有的单元格。可以把combox的绘制放在dgv的CurrentCellChanged、MouseEnter等事件里

Coordinate Error using GetWindowRect in different DPI

[亡魂溺海] 提交于 2019-12-02 11:34:24
I want to capture the coordinate of components in my MFC program. Now I can perfectly complete this by using GetWindowRect . However, when I set my windows dpi to 150% (120 dpi), I get different coordinates from GetWindowRect . Therefore, I survey some method to convert new coordinates to that in default dpi (96 dpi). Finally, I found there was some error when I tried: Rect.top = Rect.top * (DEFAULT_DPIY / CURRENT_DPIY); Rect.left = Rect.left * (DEFAULT_DPIX / CURRENT_DPIX); The converted value is very close, but not equal. Is there any method to convert it without error ? Your program is

d3 rect in one group interfering with rect in another group

十年热恋 提交于 2019-12-02 10:52:27
问题 I have a group called groove which has two rects. These are not bound to the data. I also have a group called group which has many rects which are bound to the data. In the second group called group there are only three data points, but only two are displaying. Why is the first one not being rendered? I have seen this before but can't remember how to solve it. var margin = { top: 20, right: 20, bottom: 20, left: 20 }, width = 600 - margin.left - margin.right, height = 600 - margin.top -

Qiyuan-

╄→гoц情女王★ 提交于 2019-12-02 10:45:19
import pygame import time import random # loading 加载 初始化 pygame . init ( ) # 1.初始化游戏 screen = pygame . display . set_mode ( ( 600 , 500 ) ) # 设置窗口大小 pygame . display . set_caption ( "蔡旭坤大招乔碧落" ) # 设置标题 # 事件 ball_x = 300 # 小球x坐标 ball_y = 250 # 小球y左边 rect_x , rect_y , rect_w , rect_h = 300 , 460 , 120 , 40 # 接板的x,y坐标,宽度,高度 font1 = pygame . font . Font ( None , 24 ) # 设置字体参数 score = 0 lives = 3 def ball ( ball_x , ball_y ) : pygame . draw . circle ( screen , ( 255 . , 25 , 52 ) , ( ball_x , ball_y ) , 20 , 0 ) while True : # 不断循环 for event in pygame . event . get ( ) : print ( event ) if event .