win32 摄像头捕获系统vfw
- //win32 摄像头捕获系统vfw
- // VideoRecord.h
- /// 用于定义一些资源ID
- #include "resource.h"
- //#define EXIT 104
- #define HELP 105
- #define MINIMIZE 106
- //#define DISPLAY 107
- #define BUTTONSIZE 15
- #define PHOTO 108
- #define RECORDVIDEO 109
- // #define RESOURCE 110
- // #define FORMAT 111
- #define CONNECT 112
- #include <Windows.h>
- #include <STRING>
- #include <vfw.h>
- #include "VideoRecord.h"
- #pragma comment(lib, "vfw32.lib")
- LRESULT WINAPI MainWndProc( HWND, UINT, WPARAM, LPARAM );
- LRESULT WINAPI SelCapDrcProc( HWND, UINT, WPARAM, LPARAM );
- int EnumCapDrv();
- VOID APIENTRY HandlePopupMenu(HWND, POINT); // 右键弹出菜单回调函数
- WORD WINAPI VideoThreadProc( LPVOID lParam); // 视频捕捉线程函数
- ////////////////全局变量
- HANDLE ghInstance; // 应用程序实例
- HWND hwndMain; // 主窗口句柄
- HWND hwndVideo; // 视频捕捉窗口句柄
- HWND hwndSelCapDrvDlg; // 选择捕捉驱动对话框句柄
- HWND hwndSelCapDrvLBox; // 选择驱动对话框列举驱动名称列表框句柄
- HWND hwndExit;
- HWND hwndMin;
- HWND hwndHelp;
- HWND hwndPhoto;
- HWND hwndRecord;
- HWND hwndBtnExit;
- HWND hwndSource;
- HWND hwndFormat;
- HWND hwndConnect;
- HANDLE hVideoTread; // 视频采集线程
- HRGN hRoundRgn; // 窗口修正区域
- CAPDRIVERCAPS capDrvCaps; // 驱动性能
- bool bRecordFileOpen = false; // 录像开始标志
- bool bPhotoFileOpen = false; // 照相开始标志
- bool bRecording = false; // 判断是否正在录像
- bool bThreadEnd = false; // 判断视频线程是否终止
- char recordFile[260]; //保持录像标志
- char photoFile[260]; // 保持照相标志
- char gachBuffer[260]; // 保存错误信息
- //////////////////////////////////////////////////////////////////////////////
- // ErrorCallbackProc: 错误回调函数,过capSetCallbackOnError宏来注册回调
- // hWnd: 捕获窗口句柄
- // nErrID: 错误代码
- // lpErrorText: 关于错误的文本信息
- ///////////////////////////////////////////////////////////////////////////////
- LRESULT CALLBACK ErrorCallbackProc(HWND hWnd,int nErrID,LPSTR lpErrorText)
- {
- if(!hwndMain)
- return FALSE;
- if(nErrID==0)
- return TRUE;//清除旧的错误
- wsprintf(gachBuffer,"Error# %d",nErrID);//显示错误标识和文本
- MessageBox(hWnd, lpErrorText, gachBuffer,MB_OK | MB_ICONEXCLAMATION);
- return (LRESULT) TRUE;
- }
- /////////////////////////////////////
- int PASCAL WinMain( IN HINSTANCE hInstance,
- IN HINSTANCE hPrevInstance,
- IN LPSTR lpCmdLine,
- IN int nShowCmd )
- {
- WNDCLASS wndClass;
- MSG msg;
- char className[] = "VideoClass";
- // 如果不是前实例
- if (!hPrevInstance)
- {
- wndClass.lpszClassName = className;
- wndClass.lpfnWndProc = MainWndProc;
- wndClass.style = CS_HREDRAW|CS_VREDRAW|CS_OWNDC;
- wndClass.hInstance = hInstance;
- wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- wndClass.hbrBackground = CreateSolidBrush( RGB(200,200,100) );
- wndClass.lpszMenuName = NULL;
- wndClass.cbClsExtra = 0;
- wndClass.cbWndExtra = 0;
- RegisterClass( &wndClass );
- }
- ghInstance = hInstance;
- // 创建主窗口
- hwndMain = CreateWindow(className,
- "视频监控系统",
- WS_POPUP|WS_OVERLAPPED,
- GetSystemMetrics(SM_CXFULLSCREEN)/2 - 600/2,
- GetSystemMetrics(SM_CYFULLSCREEN)/2-600/2,
- 600, 600,
- NULL,
- NULL,
- hInstance,
- NULL);
- ShowWindow(hwndMain, nShowCmd);
- // 设定主窗口主要区域
- SetWindowRgn(hwndMain, hRoundRgn, 1);
- while( GetMessage(&msg, NULL, 0, 0))
- {
- TranslateMessage(&msg);//该函数将虚拟键消息转换为字符消息。
- //字符消息被寄送到调用线程的消息队列里,当下一次线程调用函数GetMessage或PeekMessage时被读出
- DispatchMessage(&msg);//该函数调度一个消息给窗口程序。
- //通常调度从GetMessage取得的消息。消息被调度到的窗口程序即是MainProc()函数
- }
- return msg.wParam;
- }
- LRESULT CALLBACK MainWndProc( HWND hMain, UINT msg, WPARAM wParam, LPARAM lParam )
- {
- HDC hdc = GetDC(hMain);
- RECT rc; // 客户区
- POINT pt; // 鼠标位置
- HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
- switch(msg)
- {
- case WM_LBUTTONDBLCLK:
- SetFocus(hMain);
- break;
- case WM_RBUTTONDOWN:
- GetClientRect(hMain, (LPRECT)&rc);
- pt.y = HIWORD(lParam);
- pt.x = LOWORD(lParam);
- if ( PtInRect(&rc, pt) )
- {
- HandlePopupMenu(hMain, pt);
- }
- break;
- case WM_PAINT:
- RECT helpRect, minRect, exitRect;
- HRGN helpRgn, minRgn, exitRgn;
- FrameRgn(hdc, hRoundRgn, CreateSolidBrush(RGB(0,0,0)), 2, 2);
- BringWindowToTop(hwndSelCapDrvDlg);
- return DefWindowProc(hMain, msg, wParam, lParam);
- case WM_CREATE:
- // 注册错误提示回调函数
- capSetCallbackOnError(hwndVideo, (FARPROC)ErrorCallbackProc);
- // 主窗口主要圆角矩形区域
- hRoundRgn = CreateRoundRectRgn(100, 70, 500, 460, 20, 20);
- // 捕捉视频区域s
- hwndVideo = capCreateCaptureWindow((LPSTR)"My Capture Window",
- WS_CHILD|WS_VISIBLE,
- 140, 100, 320, 280,
- (HWND)hMain,
- (int)1);
- hwndExit = CreateWindow("button", // 建立一个按钮,更多如BUTTON,COMBOBOX,LISTBOX
- "x", // button text
- WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_CENTER|BS_VCENTER,
- 470, 75, BUTTONSIZE, BUTTONSIZE,
- hMain,
- (HMENU)EXIT,
- (HINSTANCE)ghInstance,
- (LPVOID)NULL );
- hwndMin = CreateWindow("button", // 建立一个按钮,更多如BUTTON,COMBOBOX,LISTBOX
- "-", // button text
- WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_CENTER|BS_VCENTER,
- 450, 75, BUTTONSIZE, BUTTONSIZE,
- hMain,
- (HMENU)MINIMIZE,
- (HINSTANCE)ghInstance,
- (LPVOID)NULL );
- hwndHelp = CreateWindow("button", // 建立一个按钮,更多如BUTTON,COMBOBOX,LISTBOX
- "?", // button text
- WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON/*|BS_CENTER|BS_VCENTER*/,
- 430, 75, BUTTONSIZE, BUTTONSIZE,
- hMain,
- (HMENU)HELP,
- (HINSTANCE)ghInstance,
- (LPVOID)NULL );
- hwndPhoto = CreateWindow("button",
- "照 相",
- WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
- 150, 410, 50, 20,
- hMain,
- (HMENU)PHOTO,
- (HINSTANCE)ghInstance,
- (LPVOID)NULL );
- SendMessage(hwndPhoto, WM_SETFONT, (WPARAM)hFont, 1); // 设置按钮字体为系统默认字体
- hwndRecord = CreateWindow("button",
- "录 像",
- WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|BS_VCENTER|BS_CENTER,
- 220, 410, 50, 20,
- hMain,
- (HMENU)RECORDVIDEO,
- (HINSTANCE)ghInstance,
- (LPVOID)NULL );
- SendMessage(hwndRecord, WM_SETFONT, (WPARAM)hFont, 1);// 设置按钮字体为系统默认字体
- hwndBtnExit = CreateWindow("button", // 退出按钮
- "退 出",
- WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|BS_VCENTER|BS_CENTER,
- 400, 410, 50, 20,
- hMain,
- (HMENU)EXIT,
- (HINSTANCE)ghInstance,
- (LPVOID)NULL );
- SendMessage(hwndBtnExit, WM_SETFONT, (WPARAM)hFont, 1);
- // 设置按钮区域
- GetClientRect(hwndHelp, &helpRect);
- GetClientRect(hwndMin, &minRect);
- GetClientRect(hwndExit, &exitRect);
- helpRgn = CreateEllipticRgnIndirect(&helpRect);
- minRgn = CreateEllipticRgnIndirect(&minRect);
- exitRgn = CreateEllipticRgnIndirect(&exitRect);
- SetWindowRgn(hwndExit,exitRgn,1);
- SetWindowRgn(hwndMin,minRgn,1);
- SetWindowRgn(hwndHelp,helpRgn,1);
- // 创建选择驱动对话框
- hwndSelCapDrvDlg = CreateDialog((HINSTANCE)ghInstance,
- MAKEINTRESOURCE(DLG_SELCAPDRIVER),
- 0, (DLGPROC)SelCapDrcProc);
- hwndSelCapDrvLBox = GetDlgItem(hwndSelCapDrvDlg, LISTBOX_SELCAPDRIVER);
- EnumCapDrv();
- break;
- case WM_COMMAND:
- CAPSTATUS capStatus;
- switch(wParam)
- {
- case EXIT: // 退出系统
- SendMessage(hMain, WM_SYSCOMMAND, SC_CLOSE, 0);
- break;
- case MINIMIZE: // 最小化
- SendMessage(hMain, WM_SYSCOMMAND, SC_MINIMIZE, 0);
- break;
- case HELP: // 帮助按钮
- SendMessage(hMain, WM_SYSCOMMAND, SC_CONTEXTHELP, 0);
- break;
- case RESOURCE: // 视频源选项
- if (capDrvCaps.fHasDlgVideoSource)
- {
- capDlgVideoSource(hwndVideo);
- }
- break;
- case FORMAT: // 视频格式选项
- if (capDrvCaps.fHasDlgVideoFormat)
- {
- capDlgVideoFormat(hwndVideo);
- }
- break;
- case CONNECT:
- break;
- case DISPLAY: // 视频显示选项
- if (capDrvCaps.fHasDlgVideoDisplay)
- {
- capDlgVideoDisplay(hMain);
- capGetStatus(hwndVideo, &capStatus, sizeof(CAPSTATUS));// 得到当前捕获窗口的状态
- SetWindowPos(hwndVideo, NULL, 0, 0, capStatus.uiImageWidth, capStatus.uiImageHeight, SWP_NOZORDER|SWP_NOMOVE);
- }
- break;
- case PHOTO: // 抓取图片
- if ( capFileSaveDIB(hwndVideo, "test.bmp") ){
- MessageBox(hMain, "Save Bmp File Succeeded!", "photo save", MB_OK|MB_ICONINFORMATION);
- }
- else break;
- if (!bPhotoFileOpen)
- {
- OPENFILENAME ofnp; // open file name structure
- ZeroMemory(&ofnp, sizeof(OPENFILENAME));
- ofnp.lStructSize = sizeof(OPENFILENAME);
- ofnp.hwndOwner = hMain;
- ofnp.lpstrFile = photoFile;
- ofnp.lpstrFilter = "*.bmp";
- ofnp.nMaxFile = sizeof(photoFile);
- ofnp.nFilterIndex = 1;
- ofnp.nMaxFileTitle = 0;
- ofnp.lpstrInitialDir = NULL;
- ofnp.Flags = OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST;
- // 显示保存文件对话框
- if (GetSaveFileName(&ofnp) == TRUE)
- {
- bPhotoFileOpen = TRUE;
- strcpy(photoFile, ofnp.lpstrFile);
- strcat(photoFile, ".bmp");
- capDriverConnect(hwndPhoto, 0); // 与驱动连接
- capOverlay(hwndPhoto, TRUE); // //使用 hardware overlay
- //使 video input directlyinto framebuffer,使不用 CPU
- capPreview(hwndVideo, TRUE); // 抓取图像显示在视窗
- capPreviewScale(hwndVideo, TRUE); // 使图像延伸到所设定的视窗大小
- capPreviewRate(hwndVideo, 1000/30); // 每秒图像变化张数
- capPreview(hwndVideo, TRUE); // 预览图像显示
- capGrabFrameNoStop(hwndVideo);
- capEditCopy(hwndVideo);
- if (capFileSaveDIB(hwndVideo, photoFile)){
- MessageBox(hMain, "Save Bmp File Succeeded!", "photo save", MB_OK|MB_ICONINFORMATION);
- }
- break;
- }
- }
- break;
- case RECORDVIDEO: // 录制视频
- if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == hwndRecord)
- {
- OPENFILENAME ofnp;
- if (!bRecordFileOpen)
- {
- ZeroMemory(&ofnp, sizeof(OPENFILENAME));
- ofnp.lStructSize = sizeof(OPENFILENAME);
- ofnp.nMaxFile = sizeof(recordFile);
- ofnp.hwndOwner = hMain;
- ofnp.lpstrFile = recordFile;
- ofnp.lpstrFilter = "*.avi";
- ofnp.lpstrInitialDir = NULL;
- ofnp.nFilterIndex = 1;
- ofnp.lpstrFileTitle = NULL;
- ofnp.nMaxFileTitle = 0;
- ofnp.Flags = OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST;
- // 显示保存文件对话框
- if (GetSaveFileName(&ofnp) == TRUE)
- {
- strcpy(recordFile, ofnp.lpstrFile);
- strcat(recordFile, ".avi");
- bRecordFileOpen = TRUE;
- // 创建视频采集线程
- DWORD id;
- SECURITY_ATTRIBUTES sa;
- sa.nLength = sizeof(SECURITY_ATTRIBUTES);
- sa.lpSecurityDescriptor = NULL;
- sa.bInheritHandle = TRUE;
- hVideoTread = CreateThread(&sa,
- (ULONG)0,
- (LPTHREAD_START_ROUTINE)VideoThreadProc,
- (LPVOID)(ULONG)0,
- 0,
- &id);
- // 如果创建线程失败,弹出提示对话框
- if (hVideoTread == NULL)
- {
- MessageBox(NULL, "Video Thread Create Failure!", "Thread", MB_OK|MB_ICONINFORMATION);
- }
- }
- break;
- }
- if (bRecordFileOpen) // 已经打开一个选择对话框
- {
- if (bRecording) // 已经在录制视频中
- {
- bThreadEnd = true;
- // 结束录制,并保存
- if ( capFileSaveAs(hwndVideo, recordFile) ){
- MessageBox(NULL, "Save Avi File Succeeded!", "RecordVideo", MB_OK|MB_ICONINFORMATION);
- }
- SetWindowText(hwndRecord, "录 像");
- bRecording = false;
- break;
- }
- else // 没有录像但是选择了一个文件
- {
- int rt = 0;
- rt = MessageBox(hMain, "Do you want write over that file?", "系统提示", MB_YESNO|MB_ICONINFORMATION);
- if (rt == IDYES) // 继续录制,覆盖当前文件
- {
- if (capCaptureSequence(hwndRecord))
- {
- bRecording = true;
- SetWindowText(hwndRecord, "停 止");
- }
- }
- else
- {
- bRecordFileOpen = false;
- SendMessage(hMain, WM_COMMAND, MAKEWPARAM(RECORDVIDEO, BN_CLICKED), (LPARAM)hwndRecord);
- }
- break;
- }
- break;
- }
- }
- }
- break;
- case WM_DESTROY:
- capSetCallbackOnError(hwndVideo, NULL);
- capPreview(hwndVideo, FALSE); // 停止预览
- capCaptureAbort(hwndVideo); // 停止捕获
- capDriverDisconnect(hwndVideo); // 断开驱动连接
- PostQuitMessage(0);
- break;
- default:
- return DefWindowProc(hMain, msg, wParam, lParam);
- }
- return 0;
- }
- LRESULT WINAPI SelCapDrcProc( HWND hMian, UINT msg, WPARAM wParam, LPARAM lParam )
- {
- // ShowWindow(hwndSelCapDrvDlg, SW_SHOW);
- switch(msg)
- {
- case WM_INITDIALOG:
- return TRUE;
- case WM_COMMAND:
- switch(wParam)
- {
- case BTN_SEL:
- int sel = 0;
- SendMessage(hwndSelCapDrvLBox, LB_GETSELITEMS, 1, sel ); // 获取选择的驱动
- SendMessage(hwndVideo, WM_CAP_DRIVER_CONNECT, sel, 0L); // 连接驱动
- SendMessage(hwndSelCapDrvDlg, WM_CLOSE, 0, 0); // 关闭对话框
- SendMessage(hwndVideo, WM_CAP_DRIVER_GET_CAPS, sizeof(CAPDRIVERCAPS), (long)(LPVOID)&capDrvCaps); // 更新驱动的能力
- if (capDrvCaps.fHasOverlay)
- {
- capOverlay(hwndVideo, TRUE);
- }
- capPreviewRate(hwndVideo, 66); //设置视频捕获速率提高到66 miliseconds
- if ( !capPreview(hwndVideo, TRUE)) //用CapPreview启动预览功能
- {
- MessageBox(NULL, "预览启动失败", "提示", MB_OK|MB_ICONINFORMATION);
- SendMessage(hMian, WM_COMMAND, EXIT, 0);
- return FALSE;
- }
- }
- return TRUE;
- case WM_CLOSE:
- DestroyWindow(hwndSelCapDrvDlg);
- return TRUE;
- }
- return (0L);
- }
- int EnumCapDrv()
- {
- char drvName[100];
- char drvVesion[100];
- char drvStr[200];
- for (int i = 0; i < 5; i++) // 扫面获取驱动信息
- {
- if ( capGetDriverDescription(i, drvName, sizeof(drvName), drvVesion, sizeof(drvVesion)) )
- {
- strcpy(drvStr, drvName);
- strcat(drvStr, " ");
- strcat(drvStr, drvVesion);
- SendMessage(hwndSelCapDrvLBox, LB_ADDSTRING, 0, (LPARAM)drvStr); // 向列表框增加字符串
- SendMessage(hwndSelCapDrvLBox, LB_SETITEMDATA, i, (LPARAM)i);
- }
- }
- return 0;
- }
- VOID APIENTRY HandlePopupMenu( HWND hwnd, POINT pt )
- {
- HMENU hmenu;
- HMENU hPopupMenu;
- hmenu = LoadMenu((HINSTANCE)ghInstance, MAKEINTRESOURCE(IDR_POPUPMENU));
- if(hmenu == NULL) return;
- // 获取子菜单
- hPopupMenu = GetSubMenu(hmenu, 0);
- // 弹出菜单使用屏幕坐标,所以转换鼠标点击坐标到屏幕坐标
- ClientToScreen(hwnd, &pt);
- TrackPopupMenu(hPopupMenu, TPM_LEFTALIGN|TPM_LEFTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
- DestroyMenu(hmenu); // 销毁指定菜单,并释放此菜单占用的内存
- }
- WORD WINAPI VideoThreadProc( LPVOID lParam )
- {
- // 捕获视频
- if( capCaptureSequence(hwndVideo) ) //该函数调控启动流视频和音频捕获到一个文件,你能使用这个功能发送消息
- {
- SetWindowText(hwndRecord, "停 止");
- MessageBox(NULL, "Start to capture video.", "提示", MB_OK|MB_ICONINFORMATION);
- bRecording = true;
- }
- while(!bThreadEnd);
- MessageBox(NULL, "Leaving Record Thread", "Thread",NULL);
- return 0;
- }
win32 摄像头捕获系统vfw的更多相关文章
- iOS 捕获系统外异常
iOS 捕获系统外异常 太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业用途-保持一致"创作公用协议 转载请保留此句:太 ...
- 使用OpenCV通过摄像头捕获实时视频并探测人脸
在Opencv初接触,图片的基本操作这篇手记中,我介绍了一些图片的基本操作,视频可以看作是一帧一帧的图片,因此图片操作其实是视频操作的基础,这篇手记就来讲讲OpenCV中的视频操作,并实现一个用笔记本 ...
- 摄像头ISP系统原理(下)
摄像头ISP系统原理(下) l WDR(Wide Dynamic Range)------宽动态 动态范围(Dynamic Range)是指摄像机支持的最大输出信号和最小输出信号的比值,或者说图像最 ...
- 摄像头ISP系统原理(中)
摄像头ISP系统原理(中) AF(FOCUS)----自动对焦 根据光学知识,景物在传感器上成像最清晰时处于合焦平面上.通过更改 LENS 的位置,使得景物在传感器上清晰的成像,是 ISP FOCUS ...
- 摄像头ISP系统原理(上)
摄像头ISP系统原理(上) ISP(Image Signal Processor),即图像信号处理器,用于处理图像信号传感器输出的图像信号.它在相机系统中占有核心主导的地位,是构成相机的重要设备. 主 ...
- OneAPM大讲堂 | 基于图像质量分析的摄像头监控系统的实现
今天咱们要介绍的技术很简单,请看场景: 你在家里安装了几个摄像头想监视你家喵星人的一举一动,然而,就在喵星人准备对你的新包发动攻击的时候,图像突然模糊了.毕竟图像模糊了以后你就没法截图回家和喵当面对质 ...
- Unity 3D 调用摄像头捕获照片 录像
1,要想调用摄像头首先要打开摄像头驱动,如果用户允许则可以使用. 2,定义WebCamTexture的变量用于捕获单张照片. 3,连续捕获须启用线程. 实现代码: using UnityEngine; ...
- 使用ffserver实现转发实时流媒体(摄像头捕获)
本系统为ubuntu 10.04LTS 说明1:本实验在本机成功测试通过: 说明2:本实验仅仅测试了视频流,未测试音频流. 1.配置ffserver.conf -------------------- ...
- Win32汇编常用系统函数
汇编语言(assembly language)是一种用于电子计算机.微处理器.微控制器或其他可编程器件的低级语言,亦称为符号语言.在汇编语言中,用助记符(Mnemonics)代替机器指令的操作码,用地 ...
随机推荐
- uva 10617
当s[i] = s[j] dp[i][j] = 1+dp[i+1][j-1]+dp[i+1][j]+dp[i][j-1]-dp[i+1][j-1] = 1+dp[i][j-1]+dp[i+1][j ...
- Openstack Quantum project 更名为 Neuron
因为与磁带备份厂商Quantum商标冲突: The OpenStack Foundation has changed the name of its networking project from Q ...
- HDU4276 The Ghost Blows Light SPFA&&树dp
题目的介绍以及思路完全参考了下面的博客:http://blog.csdn.net/acm_cxlove/article/details/7964739 做这道题主要是为了加强自己对SPFA的代码的训练 ...
- POJ 1456 Supermarket(贪心+并查集优化)
一开始思路弄错了,刚开始想的时候误把所有截止时间为2的不一定一定要在2的时候买,而是可以在1的时候买. 举个例子: 50 2 10 1 20 2 10 1 50+20 50 2 40 ...
- java基础知识回顾之java Thread类学习(十)--线程的状态以及转化使用的方法介绍
线程的概述: 线程是程序的多个执行路径,执行调度的单位,依托于进程存在.线程不仅可以共享进程的内存,而且还拥有一个属于自己的内存空间,这段内存空间叫做线程栈,是建立线程的时候由系 ...
- C# Regex类用法
使用Regex类需要引用命名空间:using System.Text.RegularExpressions; 利用Regex类实现全部匹配输出 string str = "test43232 ...
- cojs 简单的数位DP 题解报告
首先这道题真的是个数位DP 我们考虑所有的限制: 首先第六个限制和第二个限制是重复的,保留第二个限制即可 第五个限制在转移中可以判断,不用放在状态里 对于第一个限制,我们可以增加一维表示余数即可 对于 ...
- lintcode 中等题 :Maximum Product Subarray 最大连续乘积子序列
题目 乘积最大子序列 找出一个序列中乘积最大的连续子序列(至少包含一个数). 样例 比如, 序列 [2,3,-2,4] 中乘积最大的子序列为 [2,3] ,其乘积为6. 解题 法一:直接暴力求解 时 ...
- windows下安装ubantu
首先声明我是一个linux大菜鸟,之所以学这个,一个是好玩,另外做DL的一些软件如Caffe要在这个平台上运行,所以没事就鼓捣鼓捣.linux是一种内核,市场上支持这种内核的操作系统有uban ...
- switch… case 语句的用法
switch… case 语句的用法 public class Test7 { public static void main(String[] args) { int i=5; switch(i ...