stretchdibits怎么用VC把bmp图片的数据信息还原为图片并显示

stretchdibits  时间:2021-01-10  阅读:()

StretchDIBits()函数中CONST VOID *lpBits是什么意思?

指向一个BYTE类型的数组,数组中记录了要拷贝到CBitmap对象的位值。

如何使用opencv获取已经灰度化二值化的一张黑色图片中的一个亮点的具体像素坐标

OpenCV 整个项目的结构图: 编写DetectFaceDemo.java,代码如下: [java] view plaincopyprint? .njupt.zhb.test; .opencv.core.Core; .opencv.core.Mat; .opencv.core.MatOfRect; .opencv.core.Point; .opencv.core.Rect; .opencv.core.Scalar; .opencv.highgui.Highgui; .opencv.objdetect.CascadeClassifier; // // Detects faces in an image, draws boxes around them, and writes the results // to "faceDetection.png". // public class DetectFaceDemo { public void run() { System.out.println(" Running DetectFaceDemo"); System.out.println(getClass().getResource("lbpcascade_frontalface.xml").getPath()); // Create a face detector from the cascade file in the resources // directory. //CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath()); //Mat image = Highgui.imread(getClass().getResource("lena.png").getPath()); //注意:源程序的路径会多打印一个‘/’,因此总是出现如下错误 /* * Detected 0 faces Writing faceDetection.png libpng warning: Image * width is zero in IHDR libpng warning: Image height is zero in IHDR * libpng error: Invalid IHDR data */ //因此,我们将第一个字符去掉 String xmlfilePath=getClass().getResource("lbpcascade_frontalface.xml").getPath().substring(1); CascadeClassifier faceDetector = new CascadeClassifier(xmlfilePath); Mat image = Highgui.imread(getClass().getResource("we.jpg").getPath().substring(1)); // Detect faces in the image. // MatOfRect is a special container class for Rect. MatOfRect faceDetections = new MatOfRect(); faceDetector.detectMultiScale(image, faceDetections); System.out.println(String.format("Detected %s faces", faceDetections.toArray().length)); // Draw a bounding box around each face. for (Rect rect : faceDetections.toArray()) { Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0)); } // Save the visualized detection. String filename = "faceDetection.png"; System.out.println(String.format("Writing %s", filename)); Highgui.imwrite(filename, image); } } .njupt.zhb.test; .opencv.core.Core; .opencv.core.Mat; .opencv.core.MatOfRect; .opencv.core.Point; .opencv.core.Rect; .opencv.core.Scalar; .opencv.highgui.Highgui; .opencv.objdetect.CascadeClassifier; // // Detects faces in an image, draws boxes around them, and writes the results // to "faceDetection.png". // public class DetectFaceDemo { public void run() { System.out.println(" Running DetectFaceDemo"); System.out.println(getClass().getResource("lbpcascade_frontalface.xml").getPath()); // Create a face detector from the cascade file in the resources // directory. //CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath()); //Mat image = Highgui.imread(getClass().getResource("lena.png").getPath()); //注意:源程序的路径会多打印一个‘/’,因此总是出现如下错误 /* * Detected 0 faces Writing faceDetection.png libpng warning: Image * width is zero in IHDR libpng warning: Image height is zero in IHDR * libpng error: Invalid IHDR data */ //因此,我们将第一个字符去掉 String xmlfilePath=getClass().getResource("lbpcascade_frontalface.xml").getPath().substring(1); CascadeClassifier faceDetector = new CascadeClassifier(xmlfilePath); Mat image = Highgui.imread(getClass().getResource("we.jpg").getPath().substring(1)); // Detect faces in the image. // MatOfRect is a special container class for Rect. MatOfRect faceDetections = new MatOfRect(); faceDetector.detectMultiScale(image, faceDetections); System.out.println(String.format("Detected %s faces", faceDetections.toArray().length)); // Draw a bounding box around each face. for (Rect rect : faceDetections.toArray()) { Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0)); } // Save the visualized detection. String filename = "faceDetection.png"; System.out.println(String.format("Writing %s", filename)); Highgui.imwrite(filename, image); } } 3.编写测试类: [java] view plaincopyprint? .njupt.zhb.test; public class TestMain { public static void main(String[] args) { System.out.println("Hello, OpenCV"); // Load the native library. System.loadLibrary("opencv_java246"); new DetectFaceDemo().run(); } } //运行结果: //Hello, OpenCV // //Running DetectFaceDemo ///E:/eclipse_Jee/workspace/JavaOpenCV246//njupt/zhb/test/lbpcascade_frontalface.xml //Detected 8 faces //Writing faceDetection.png .njupt.zhb.test; public class TestMain { public static void main(String[] args) { System.out.println("Hello, OpenCV"); // Load the native library. System.loadLibrary("opencv_java246"); new DetectFaceDemo().run(); } } //运行结果: //Hello, OpenCV // //Running DetectFaceDemo ///E:/eclipse_Jee/workspace/JavaOpenCV246//njupt/zhb/test/lbpcascade_frontalface.xml //Detected 8 faces //Writing faceDetection.png

DIB是什么格式

DIB设备无关位图文件,这是一种文件格式,是为了保证用某个应用程序创建的位图图形可以被其它应用程序装载或显示一样。

DIB的与设备无关性主要体现在以下两个方面:DIB的颜色模式与设备无关。

例如,一个256色的DIB即可以在真彩色显示模式下使用,也可以在16色模式下使用。

256色以下(包括256色)的DIB拥有自己的颜色表,像素的颜色独立于系统调色板。

由于DIB不依赖于具体设备,因此可以用来永久性地保存图象。

DIB一般是以*.BMP文件的形式保存在磁盘中的,有时也会保存在*.DIB文件中。

运行在不同输出设备下的应用程序可以通过DIB来交换图象。

/view/18734.htm

怎么用VC把bmp图片的数据信息还原为图片并显示

用StretchDIBits函数。

假设你的数据存储在下面两个结构中: BITMAPINFO bmi PBYTE pbits 在视图类的OnDraw函数中添加一句: ::StretchDIBits(pDC->GetSafeHdc(), 0, 0, bmi.bmiHeader.biWidth, bmi.bmiHeader.biHeight, 0, 0, bmi.bmiHeader.biWidth, bmi.bmiHeader.biHeight, pbits, bmi, DIB_RGB_COLORS, SRCCOPY ); 即可

pacificrack:$12/年-1G内存/1核/20gSSD/500g流量/1Gbps带宽

pacificrack在最新的7月促销里面增加了2个更加便宜的,一个月付1.5美元,一个年付12美元,带宽都是1Gbps。整个系列都是PR-M,也就是魔方的后台管理。2G内存起步的支持Windows 7、10、Server 2003\2008\2012\2016\2019以及常规版本的Linux!官方网站:https://pacificrack.com支持PayPal、支付宝等方式付款7月秒杀VP...

UCloud云服务器香港临时补货,(Intel)CN2 GIA优化线路,上车绝佳时机

至今为止介绍了很多UCLOUD云服务器的促销活动,UCLOUD业者以前看不到我们的个人用户,即使有促销活动,续费也很少。现在新用户的折扣力很大,包括旧用户在内也有一部分折扣。结果,我们的用户是他们的生存动力。没有共享他们的信息的理由是比较受欢迎的香港云服务器CN2GIA线路产品缺货。这不是刚才看到邮件注意和刘先生的通知,而是补充UCLOUD香港云服务器、INTELCPU配置的服务器。如果我们需要他...

Digital-VM:服务器,$80/月;挪威/丹麦英国/Digital-VM:日本/新加坡/digital-vm:日本VPS仅$2.4/月

digital-vm怎么样?digital-vm在今年1月份就新增了日本、新加坡独立服务器业务,但是不知为何,期间终止了销售日本服务器和新加坡服务器,今天无意中在webhostingtalk论坛看到Digital-VM在发日本和新加坡独立服务器销售信息。服务器硬件是 Supermicro、采用最新一代 Intel CPU、DDR4 RAM 和 Enterprise Samsung SSD内存,默认...

stretchdibits为你推荐
手机内存卡格式化不了手机SD内存卡格式化不了是什么原因?桌面背景图片非主流哪里有比较个性的电脑桌面壁纸啊304和316不锈钢哪个好304与316用哪个好?304和316不锈钢哪个好304不锈钢和316不锈钢哪个好华为p40和mate30哪个好华为mate30和荣耀3O那个好?手机炒股软件哪个好手机炒股软件哪个好啊?清理手机垃圾软件哪个好清理手机垃圾文件的软件哪个好?视频软件哪个好安卓系统在线看视频软件哪个好空间登录器qq空间登录电脑版空间登录器qq空间登录不了怎么办
免费网站空间 云南虚拟主机 租服务器价格 科迈动态域名 2019年感恩节 kdata 搬瓦工官网 名片模板psd iis安装教程 创宇云 建站代码 网通代理服务器 网站挂马检测工具 权嘉云 炎黄盛世 宁波服务器 jsp空间 免费个人空间 789电视剧 web服务器搭建 更多