DELPHI 截屏

屏幕截图完美解决方案 --- LYSoft Liu Yang 可以截取layered窗口(包括透明窗口)的代码:procedure CaptureScreen(AFileName: string);const  CAPTUREBLT = $40000000;var  hdcScreen: HDC;  hdcCompatible: HDC;  bmp: TBitmap;  hbmScreen: HBITMAP;begin  hdcScreen := Cre 阅读详情

unit mainunit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls,Clipbrd;

type
  TForm1 = class(TForm)
    Image1: TImage;
    procedure FormCreate(Sender: TObject);
    procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);


  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  H,W: integer;
  pt,Endpt: TPoint;
  rect_: TRect;
  dragging_: boolean;

 

implementation

{$R *.dfm}
procedure GetScreen(var bmp: TBitMap); //截取全屏
var
  DC: HDC;
  MyCanvas: TCanvas;
  MyRect: TRect;
begin
  DC:= GetWindowDC(0);
  MyCanvas:= TCanvas.Create;
  try
  MyCanvas.Handle:= DC;
  MyRect:= Rect(0, 0, Screen.Width, Screen.Height);
  bmp:= TBitMap.Create;
  bmp.PixelFormat:= pf24bit;
  bmp.Width:= MyRect.Right;
  bmp.Height:= MyRect.Bottom;
  bmp.PixelFormat:= pf32bit;
  bmp.Canvas.CopyRect(MyRect, MyCanvas, MyRect);
  finally
  MyCanvas.Handle:= 0;
  MyCanvas.Free;
  releaseDC(0, DC);
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  bmp: TBitMap;
begin
  bmp:= TBitMap.Create;
  GetScreen(bmp);
  image1.Picture:= TPicture(bmp);


end;

procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Dragging_:= true;
  pt:= Point(X, Y);
  Endpt:= pt;
  rect_.left:= pt.x;
  rect_.top:= pt.y;
  rect_.right:= pt.x;
  rect_.bottom:= pt.y;
  Canvas.DrawFocusRect(rect_);

end;

procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
       if (Dragging_) then
  begin
  Endpt:= Point(X, Y);
  H:= abs(pt.y - Endpt.y);
  W:= abs(pt.x - Endpt.x);
  Canvas.DrawFocusRect(rect_);
  if (pt.x < Endpt.x) and(pt.y < Endpt.y) then
  begin
  rect_.Left:= pt.x;
  rect_.top:= pt.y;
  end
  else if (pt.x < Endpt.x) and(pt.y > Endpt.y) then
  begin
  rect_.Left:= pt.x;
  rect_.top:= Endpt.y;
  end
  else if(pt.x > Endpt.x) and(pt.y > Endpt.y) then
  begin
  rect_.Left:= Endpt.x;
  rect_.top:= Endpt.y;
  end
  else if(pt.x > Endpt.x) and(pt.y < Endpt.y) then
  begin
  rect_.Left:= Endpt.x;
  rect_.top:= pt.y;
  end; 
  rect_.right:= rect_.left + W;
  rect_.bottom:= rect_.top + H;
  Canvas.DrawFocusRect(rect_);
  end;
end;


procedure TForm1.Image1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
  bmp: TBitMap;
  MyRect: TRect;
begin
  if (Dragging_) then
  begin
  Dragging_:= false;
  Endpt:= Point(X, Y);
  Canvas.DrawFocusRect(rect_);
  bmp:= TBitMap.Create;
  bmp.Width:= Rect_.Right - Rect_.Left;
  bmp.Height:= Rect_.Bottom - Rect_.Top;
  MyRect:= Rect(0, 0, bmp.Width, bmp.Height);
  bmp.Canvas.CopyRect(MyRect, Canvas, Rect_);
  ClipBoard.Assign(bmp);
  end;

 

end;

end.

 

附:

 

以下是实现delphi中截指定区域的图,我截取的是image中的图片,实现了LED显示屏二次开发的一个功能,记下来

procedure TForm1.snapscreen(a, b, c, d: Integer);
var
bmpscreen:Tbitmap;
jpegscreen:Tjpegimage;
FullscreenCanvas:TCanvas;
dc:HDC;
sourceRect, destRect: TRect;
begin
try
dc:=getdc(0);
fullscreencanvas:=Tcanvas.Create;
fullscreencanvas.Handle:=dc;
bmpscreen:=Tbitmap.create;
bmpscreen.Width :=c-a;
bmpscreen.Height :=d-b;
sourcerect:=rect(0,0,c-a ,d-b );
destrect:= rect(a,b,c,d);
bmpscreen.Canvas.CopyRect(sourcerect,fullscreenCanvas,destrect);
jpegscreen:=Tjpegimage.Create ;
jpegscreen.Assign (bmpscreen);
jpegscreen.CompressionQuality:=100;
jpegscreen.SaveToFile(ExtractFilePath(ParamStr(0))+'tmp.bmp');
FullscreenCanvas.Free;
bmpscreen.Free;
jpegscreen.Free ;
ReleaseDC(0, DC);
except
end;


end;

procedure TForm1.BitBtn1Click(Sender: TObject);
var
bw:integer;
tw:integer;
begin
  // snapscreen(self.Left,self.Top,Self.Left+self.Width,Self.Top+self.Height);
 bw:=self.Width-self.ClientWidth;       //边框
 tw:=self.Height-self.ClientHeight-(bw div 2);     //标题栏

 edit1.Text:=inttostr(bw div 2);
 edit2.Text:=inttostr(tw);
 snapscreen(self.Left+image1.left+(bw div 2),
            self.Top+image1.top+tw,
            Self.Left+image1.Width+image1.left+(bw div 2),
            image1.Height+image1.top+self.top+tw);
end;

 

Delphi技术实现的高效截屏软件:全屏与热键功能详解 在当今信息技术高度发展的社会,截屏软件已经成为我们日常工作中不可或缺的工具之一。它不仅适用于需要进行屏幕内容分享的专业人士,同时也为个人用户提供极大的便利。Delphi作为一种高效快速的编程语言,它在开发截屏软件方面具有独特的优势。本章将概述Delphi截屏软件的核心概念、功能需求以及其在市场上的应用前景。我们将深入探讨Delphi如何助力开发者打造功能强大、操作简便的截屏工具,同时分析Delphi开发环境为截屏软件提供的各种便捷功能与组件。这将为接下来章节中深入的技术实现和应用案例分析打下坚实的基础。 阅读详情

相关推荐

Delphi 全屏抓图、截屏,区域截图代码,支持滚屏

内容索引:Delphi源码,图形处理,Capture.rar  Delphi 全屏抓图、常规截屏,区域截图,活动窗口抓图代码,支持滚屏截图功能。截屏完毕,可打印,可保存为指定格式,可显示图片信息,代码可在delphi7中直接编译成功。源代码完整,程序功能虽然还有不完善的地方,但如果对抓图截屏功能不熟悉的朋友,本源码可作为你一个很好的范例参考。

Delphi 调用一截图工具进行截图的方法《LceMeaning》

以下代码经本人在Delphi XE2下编写并通过。 procedure TForm5.img1Click(Sender: TObject); var i : Integer; begin try if img1.Picture.Graphic = nil then begin if MessageBox(Handle, ...

weixin_30709061的博客 317

Delphi 超强截图工具(支持区域、滚屏等截图)

Delphi 超强截图工具(支持区域、滚屏等截图,支持DELPHI 7.欢迎大家下载。

一个delphi的截图工具

截图

全粘工程师 1175

delphi超级漂亮的仿QQ屏幕截屏程序

delphi编写的超级漂亮的仿QQ屏幕截屏DLL源码,可以区域截图,调整大小,窗口截图和全屏截图

DELPHI全屏截图、区域截屏程序.rar

DELPHI全屏截图、区域截屏程序,同时还包括绘图工具、按比例缩放、图像剪裁、图像旋转、自定义形状抓图(圆形、椭圆形、正方形等),还有多种画笔工具,整个截屏软件在界面上的设计也是很棒,下边是TAB式窗口,功能相当丰富。   作者寄语:这是我大二下学期的暑假做的,虽然还是只学了一学期DELPHI,但我还是自己学了一学期.所以做得还可以,看得过去,我是模仿一个外国软件HprSnap6.exe,因为对我很有用所以我也学做了一下,也开始有面向对象的方法,定义一些接口(单元,类),代码也规范了.但还没做完,就没做了,用时:20天。主要功能:全屏截图,区域截图,简单的修改图片,   扩展:   (1)远程截图.(先有客户端截图,图片-->数据流-->图片   (2)远程控制.(这是我看到QQ控制,我觉得,她并不是真正的远程控件,而是虚拟的.因为我发现并不能在远程里打字,所以我的分析:(1)实时的 客户端截图,图片-->数据流-->图片(2)在服务台里,虚拟一个远程桌面(3)实时的转送服务台里的坐标,和单击事件,并发送给客户端(4)客户端实时的监控服务器发过来的信息,然后在用客户端进行具体操作. 这是我的分析方法不知道对不对,但我想应该是对的。

delphi调用edge的截图功能

一、设置edge中截图的快捷键。

Winfredzhang的博客 371

Delphi实现局部图像拷贝

摘要:Delphi源码,图形处理,图像拷贝,图片拷贝  Delphi实现局部的图像拷贝,图片拷贝,还可剪切,编辑图像区域,选择区域,然后点击下边对应的按钮功能,就可以实现局部的图片拷贝或剪切。

Delphi6控件内容完整截屏

由于用户那套旧系统需要截取Form中控件的内容,但经常因内容超长而截屏不完整(又被踢下坑了)。 经搜索,网上有不少关于这方面的资料(感谢他们的分享),再自己琢磨了一下,得到了以下代码。 值得注意的是,以下代码在Win8下可正常截图,但在Win7下超出屏幕部分的截取就会黑屏。由于程序只是简单的调用了user32.dll的方法,所以问题还是出在user32.dll(真心没闹懂微软想干嘛) 后来针

zhaogang的专栏 2186

FIFO Generate IP核使用——FIFO写操作详解及Status Flags页配置

本文介绍了FIFO的写操作及Status Flags页的配置信息。

u011565038的博客 2289

深度学习暑期科研项目(两个月发EI论文)

对本科生而言,越早接触系统的科研训练开始上手科研项目,就越能在未来的升学求职中占据很大的优势。暑假是提升个人简历、丰富科研经历的最佳时期!哈尔滨工业大学博士师兄也会在8月1日开始带大家上手科研项目,并撰写发表EI会议论文。

Magnolia_He的博客 1450

DELPHI全屏截图与区域截屏程序

DELPHI全屏截图与区域截屏程序 去发现同类优质开源项目:https://gitcode.com/ 欢迎使用DELPHI全屏截图与区域截屏程序!这是一个功能丰富的屏幕捕捉工具,支持全屏截图、区域截屏以及多种图像编辑功能。以下是该程序的详细介绍。 功能特性 屏幕捕捉:支持全屏截图和自定义区域截图。 图像编辑:提供绘图工具、按比例缩放、图像剪裁、图像旋转等功能。 自定义形状抓图:可以捕捉圆形、椭圆...

gitblog_06705的博客 718

Mixer-First Receiver适用于宽带阵列应用的接收机技术1

Mixer-First Receiver适用于宽带阵列应用的接收机技术1技术的背景单元级数字化阵列传统链路到Mixer-First链路的逻辑考虑三种场景小结 技术的背景 在文章《吊打全球的顶级毫米波数字阵列项目-MIDAS》中提到了DARPA在MIDAS项目中在毫米波实现宽带单元级数字化阵列用到了一个关键的叫做N-Path filter的技术,而这个技术同样出现在了《让微波射频工程师颤抖的芯片-MATRICs》的MATRICs芯片中。 为什么DARPA的各个合作研究机构选择这种技术?这篇来自Universi

ICONO的博客 2175

Delphi实现简单的区域截屏

Delphi实现简单的区域截屏 去发现同类优质开源项目:https://gitcode.com/ 此仓库包含了一个使用Delphi 7开发的简单截屏功能,能够截取屏幕上指定的区域。此工具易于使用,提供了便捷的屏幕截取解决方案。 功能介绍 支持指定截取屏幕区域 操作简便,易于集成 使用说明 将代码导入Delphi 7环境中,根据需要调整截屏参数,编译运行即可使用。 注意事项 请确保您已安装De...

gitblog_06710的博客 472

加湿器方案-DLT8M04TS-杰力科创

基本组成: 一个触摸按键、一组RGB灯、一个雾化片、一个充电IC。 产品功能: 第一次上电光机状态,RGB红/绿/红灯依次闪烁灭; 2、按键功能:短按开关机和三档喷雾工作模式,第一次短按持续喷雾,短按第二次喷3S,停3S,短按第三次关闭喷雾模式,依次循环; 在喷雾或是不喷雾的状态下长按1.5S RGB灯渐变,一直循环,第二次长按当前灯光闪烁一下常亮,第三次长按关机; 3、持续喷雾定时5小时自动断电,间歇喷雾定时10小时自动断电,若在间歇工作时有切换为持续喷雾,那间歇喷雾的...

JLKCsz的博客 518

SAP 销售订单及发票 利润中心替代 Userexit出口 配置及程序

在跨公司销售业务中,跨公司销售订单的发票时无法从销售订单中将利润中心带到发票中,所以在跨公司的发票创建过程中需要配置出口来获取对应销售订单行项目的利润中心。 事务代码: 0KEM 配置步骤: 1、创建一个新的替代 2、创建一个步骤 3、维护一个先决条件,比如针对于特定工厂 PCASUB-VKBUR = '0001' 4、选择替代程序FORM,FORM必须为指定程序中存在的FORM名 5、编辑替代程序FORM 实现效果: 在程序FORM中打上断点 ...

李威威wiwi的博客 5074

Delphi实现简单的区域截屏:开源截屏工具的全新选择

Delphi实现简单的区域截屏:开源截屏工具的全新选择 去发现同类优质开源项目:https://gitcode.com/ 在当今数字化时代,截屏功能成为许多开发者和用户日常工作的必需品。今天,我要向大家推荐一款使用Delphi 7开发的简单区域截屏工具,它不仅具备强大的截屏功能,还易于集成和使用。 项目介绍 Delphi实现简单的区域截屏是一款开源的屏幕截取工具,它支持用户指定截取屏幕上任意区域的...

gitblog_06770的博客 812

cesium自定义指南针

项目需要一个指南针,用鼠标按住旋转指针,会让3d地图旋转,点击中心点重置方位。当然可以使用插件cesium-navigation-es6,但是样式不好修改,所以我自定义了一个指南针。

weixin_47017648的博客 753

DELPHI全屏截图与区域截屏程序:一款实用的屏幕捕捉工具

DELPHI全屏截图与区域截屏程序:一款实用的屏幕捕捉工具 去发现同类优质开源项目:https://gitcode.com/ 项目介绍 DELPHI全屏截图与区域截屏程序是一款开源的屏幕捕捉工具,旨在为用户提供方便快捷的屏幕截图和图像编辑功能。无论是全屏截图还是指定区域截图,该程序都能满足您的需求,同时提供多种图像编辑功能,让用户能够轻松处理截图。 项目技术分析 DELPHI全屏截图与区域截屏程序...

gitblog_06709的博客 575

STM32Cube高效开发教程<高级篇><FreeRTOS>(十八)-----软件定时器

一、 软件定时器概述声明:本人水平有限,博客可能存在部分错误的地方,请广大读者谅解并向本人反馈错误。本专栏博客参考《STM32Cube高效开发教程(高级篇)》,有意向的读者可以购买正版书籍辅助学习,本书籍由王维波老师、鄢志丹老师、王钊老师倾力打造,书籍内容干货满满。在FreeRTOS中,自动创建的任务有空闲任务和定时器服务任务。FreeRTOS可以通过定时器服务任务提供软件定时器功能。在某些对定时精度要求不太高,无须使用硬件定时器的情况下,我们可以使用FreeRTOS的软件定时器。

我的博客 161

YOLO26改进策略【YOLO和Mamba】| MLLA:Mamba-Like Linear Attention,融合Mamba设计优势的注意力机制

本文记录的是利用模块优化的目标检测网络模型。模块具有独特优势。它不同于传统模块,能同时兼顾局部特征高效建模与长距离交互学习。常见模块要么在局部特征处理上有优势但长距离交互能力弱,要么反之,而模块克服了此问题。它融合了Mamba模型和线性注意力机制的优势,通过独特的结构设计,能够在保持计算效率的同时,精准地建模局部特征并学习长距离交互信息。本文将其用于的模型改进和二次创新,能够更加关注图像中的重要特征区域,抑制背景等无关信息的干扰,从而突出目标物体的关键特征。Demystify Mamba in Vision

Limiiiing的博客 222

Delphi全屏抓图与截屏功能源代码:捕获屏幕的艺术

Delphi全屏抓图与截屏功能源代码:捕获屏幕的艺术 去发现同类优质开源项目:https://gitcode.com/ 在软件开发领域,图像捕获技术一直备受关注,特别是在UI设计、游戏开发、教学演示等方面。今天,我将向您推荐一个开源项目——Delphi全屏抓图与截屏功能源代码,它将大大简化屏幕图像捕获的过程。 项目介绍 Delphi全屏抓图与截屏功能源代码提供了一种在Delphi环境下捕获屏幕图像...

gitblog_06749的博客 818

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

Delphi 全屏抓图与截屏功能源代码

Delphi 全屏抓图与截屏功能源代码 去发现同类优质开源项目:https://gitcode.com/ 此仓库包含了Delphi环境下实现全屏抓图、截屏、区域截图及活动窗口抓图的源代码,同时支持滚屏截图功能。通过使用本源码,您不仅可以捕获屏幕图像,还能够进行打印、保存为特定格式以及显示图片信息等操作。 功能特点 支持全屏抓图 支持常规截屏 支持区域截图 支持活动窗口抓图 支持滚屏截图 截屏后可...

gitblog_06752的博客 275

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

delphi android 截屏,Delphi实现截屏存盘的方法

本文实例讲述了Delphi实现截屏存盘的方法。分享给大家供大家参考。具体分析如下:该实例可实现截取屏幕,并保存为JPEG文件格式的功能。procedure TForm1.ScreenCap(LeftPos,TopPos,RightPos,BottomPos:integer);varRectWidth,RectHeight:integer;SourceDC,DestDC,Bhandle:intege...

weixin_31968639的博客 400

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

delphi截屏

procedure ScreenCap(); const WW=256; HH=256; var BmpBits:Pointer; FDeskHWnd:Hwnd; SourceDC,DestDC,originHandel:integer; i:Integer; ABitmap:HBitmap; s:TBitmap; BmpInfHead:TBitmapInfoHeader;

LzwGlory的专栏 1209
上一篇: 在Delphi中安装SPCOMM
下一篇: VC屏幕截图(将屏幕指定区域存成图片)
keepAction
博客等级 码龄15年 28粉丝 6原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址