rect

Cropping an image in iOS using OpenCV face detection

匿名 (未验证) 提交于 2019-12-03 01:06:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I used the below code to crop a face from an image, in my face detection code. But I am not getting the proper face images and I am getting some part of the image saved and not the face. What's wrong in my code? _faceCascade . detectMultiScale ( mat , faces , 1.1 , 2 , kHaarOptions , cv :: Size ( 40 , 40 )); And inside the displayfaces functions am cropping with this code: CGRect cropRect = CGRectMake ( faces [ i ]. x , faces [ i ]. y , faces [ i ]. width , faces [ i ]. width ); CGImageRef cropped_img = CGImageCreateWithImageInRect

Bitmap image with rounded corners with stroke

匿名 (未验证) 提交于 2019-12-03 01:06:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a image with sharp edges. the tile_mode.xml the back.xml layout.xml I am setting the image as a background to this layout and drawing a border to it but the problem is the image is square with sharp edges and the border which I am drawing in the xml is rounded corners. So how to make the image also with rounded corners? 回答1: This is one of solution in which you have to make round to your main layout background and inside keep your imageview with your desire image: something like below: back.xml This will make your image to round

iPad UITextField ― cursor not centering when resizing frame with contentVerticalAlignment = UIControlContentVerticalAlignmentCenter

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am working on a universal iPhone/iPad app. I resize some of my UITextFields as the user types. I also have some code to move the UITextFields around so that their locations make sense as they are resized. This code is not too short, but basically it comes down to modifying the frames of the UITextFields. My UITextFields all have their content vertically centered by setting textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; The text centers just fine. But when I resize the textfield on the iPad, the cursor

树莓派DHT11温湿度传感器+BMP280大气气压传感器

匿名 (未验证) 提交于 2019-12-03 00:43:02
bmp: #ifndef _RASPI_BMP280_H_ #define _RASPI_BMP280_H_ #include <stdio.h> #include <wiringPi.h> #include <wiringPiI2C.h> unsigned short dig_t1,dig_p1; signed short dig_t2,dig_t3,dig_p2,dig_p3,dig_p4; signed short dig_p5,dig_p6,dig_p7,dig_p8,dig_p9; float temp,pres,var1,var2; int pres_int= 0 ,bmp280_flag=- 1 ; uint8_t msb,lsb,xlsb,pres_h= 0 ,pres_l= 0 ,pres_flo= 0 ; int i2c_fd; int Raspi_BMP280_Init() { wiringPiSetup(); i2c_fd=wiringPiI2CSetup( 0x76 ); if (wiringPiI2CReadReg8(i2c_fd, 0xd0 )== 0x58 ) { system ( "i2cset -y 1 0x76 0xff 0xf4" ); dig_t1=(wiringPiI2CReadReg8(i2c_fd, 0x89 )<< 8 )

Android7.0 popupwindow showAsDropDown 无效解决方法

匿名 (未验证) 提交于 2019-12-03 00:34:01
试了网上查看的很多方法。。 就这个生效了。 if ( Build . VERSION . SDK_INT < 24 ) { popupwindow . showAsDropDown ( mToolbar ); } else { Rect visibleFrame = new Rect (); mToolbar . getGlobalVisibleRect ( visibleFrame ); int height = mToolbar . getResources (). getDisplayMetrics (). heightPixels - visibleFrame . bottom ; popupwindow . setHeight ( height ); popupwindow . showAsDropDown ( mToolbar , 0 , 0 ); } 转载请标明出处: Android7.0 popupwindow showAsDropDown 无效解决方法 文章来源: Android7.0 popupwindow showAsDropDown 无效解决方法

pcm原始数据绘制

匿名 (未验证) 提交于 2019-12-03 00:33:02
最近帮别人做了个东西,这里分享一下pcm原始数据绘图的思路 1、pcm数据采样位数,根据采样位数选取适合自己绘图的采样点的数量 2、计算出最大最小的的采样点的值差 3、根据要显示pcm数据的控件宽高,根据pcm原始数据的在pcm数据的偏移计算出x坐标,根据pcm数据采样的数值大小计算出y坐标 4、绘图,依次进行相邻数据点绘图 以下是在Duilb中绘图的代码: 1 std :: vector < char > pcm_buffer ; 2 FILE * file = NULL ; 3 file = fopen ( " pcm\\20180601155322.pcm " , " rb " ); 4 5 if ( file != NULL ) { 6 // 7 pcm_buffer . clear (); 8 pcm_buffer . shrink_to_fit (); 9 10 fseek ( file , 0 , SEEK_END ); 11 unsigned int size_byte = ftell ( file ); 12 fseek ( file , 0 , SEEK_SET ); 13 pcm_buffer . resize ( size_byte ); 14 fread (& pcm_buffer [ 0 ], size_byte , 1 , file ); 15

matplotlib 快速绘图

匿名 (未验证) 提交于 2019-12-03 00:30:01
5.1 快速绘图 matplotlib的pyplot子库提供了和matlab类似的绘图API,方便用户快速绘制2D图表。让我们先来看一个简单的例子: # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt x = np . linspace ( 0 , 10 , 1000 ) y = np . sin ( x ) z = np . cos ( x ** 2 ) plt . figure ( figsize = ( 8 , 4 )) plt . plot ( x , y , label = "$sin(x)$" , color = "red" , linewidth = 2 ) plt . plot ( x , z , "b--" , label = "$cos(x^2)$" ) plt . xlabel ( "Time(s)" ) plt . ylabel ( "Volt" ) plt . title ( "PyPlot First Example" ) plt . ylim ( - 1.2 , 1.2 ) plt . legend () plt . show () ͼ5.1 matplotlib中的快速绘图的函数库可以通过如下语句载入: import matplotlib.pyplot

pygame中Rect(left, top, width, height)的参数详解

匿名 (未验证) 提交于 2019-12-03 00:29:01
Pygame 通过 Rect 对象存储和操作矩形区域。一个 Rect 对象可以由 left,top,width,height 几个值创建。Rect 也可以是由 Pygame 的对象所创建,它们拥有一个属性叫“rect”。 任何需要一个 Rect 对象作为参数的 Pygame 函数都可以使用以上值构造一个 Rect。这样使得作为参数传递的同时创建 Rect 成为可能。 常用的Rect参数有这个形式:pygame.Rect(left, top, width, height) left,top,width,height对应的具体表示如下图, 其中粉色为图片尺寸,纵横坐标值分别表示像素值,对于要显示的图像是图片中的空白区域。 具体应用如下: 1)加载图片 shoot_img = pygame.image.load(r'F:\Python STUDY\images\me11.png') 2)矩形剪切图片 hero1_rect = pygame.Rect(0, 0, 136, 168) hero2 = shoot1_img.subsurface(hero2_rect) 本人图片的格式是.png 本人的图片文件为me11.png,如下图所示 通过属性窗口查看尺寸为136*168(像素),如下图所示: 为了完整显示图片,选择定义参数为: pygame.Rect(0, 0, 136, 168)

C语言 隐藏滚动条

匿名 (未验证) 提交于 2019-12-03 00:25:02
//隐藏滚动条 #include <windows.h> #include <conio.h> SMALL_RECT SizeOfWindow(HANDLE hConsoleOutput) { CONSOLE_SCREEN_BUFFER_INFO info; GetConsoleScreenBufferInfo(hConsoleOutput, &info); return info.srWindow; } int main() { HANDLE handle_out; CONSOLE_SCREEN_BUFFER_INFO info; handle_out = GetStdHandle(STD_OUTPUT_HANDLE); GetConsoleScreenBufferInfo(handle_out, &info); SMALL_RECT rect =SizeOfWindow(handle_out); COORD size={rect.Right+1,rect.Bottom+1}; //定义缓冲区大小 SetConsoleScreenBufferSize(handle_out, size); CloseHandle(handle_out); } 文章来源: C语言 隐藏滚动条

qml实现消息图片展示

匿名 (未验证) 提交于 2019-12-03 00:22:01
本文主要介绍如何展示不同大小尺寸的图片,并加上边框。实现步骤如下。 1、实现不同尺寸的图片的展示。主要运用OpacityMask实现圆角功能。 Rectangle { width : image_area .paintedWidth height : image_area .paintedHeight radius : 5 property alias url : image_area .source property int size : 200 Image { id : image_area sourceSize : Qt .size( size , size ) smooth : true visible : false } Rectangle { id : mask_area anchors.fill : image_area radius : 5 visible : false } OpacityMask { anchors.fill : image_area source : image_area maskSource : mask_area } } 2、实现边框。边框通过RectangularGlow实现。 Item { width : rect .width height : rect .height property alias url : rect .url