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 ); 即可

注册做什么96%可以干啥,常用的7个常用的国内国外域名注册服务商_云服务器可以干什么

日前,国内知名主机服务商阿里云与国外资深服务器面板Plesk强强联合,推出 阿里云域名注册与备案、服务器ECS购买与登录使用 前言云服务器(Elastic  只需要确定cpu内存与带宽基本上就可以了,对于新手用户来说,我们在购买阿里云服务申请服务器与域名许多云服务商的云服务器配置是弹性的 三周学会小程序第三讲:服务 不过这个国外服务器有点慢,可以考虑国内的ngrokcc。 ngrokcc...

弘速云香港VPSVPS线路有CN2+BGP、CN2 GIA,KVM虚拟化架构,裸金属月付564元

弘速云怎么样?弘速云是创建于2021年的品牌,运营该品牌的公司HOSU LIMITED(中文名称弘速科技有限公司)公司成立于2021年国内公司注册于2019年。HOSU LIMITED主要从事出售香港vps、美国VPS、香港独立服务器、香港站群服务器等,目前在售VPS线路有CN2+BGP、CN2 GIA,该公司旗下产品均采用KVM虚拟化架构。可联系商家代安装iso系统。点击进入:弘速云官方网站地址...

提速啦(900元/月),杭州BGP E5-2665/89*2 32核 48G 100G防御

提速啦的来历提速啦是 网站 本着“良心 便宜 稳定”的初衷 为小白用户避免被坑提速啦的市场定位提速啦主要代理市场稳定速度的云服务器产品,避免新手购买云服务器的时候众多商家不知道如何选择,妮妮云就帮你选择好了产品,无需承担购买风险,不用担心出现被跑路 被诈骗的情况。提速啦的售后保证提速啦退款 通过于合作商的友好协商,云服务器提供3天内全额退款,超过3天不退款 物理机部分支持当天全额退款提速啦提现 充...

stretchdibits为你推荐
华为p40和mate30哪个好华为mate30和荣耀3O那个好?绝地求生加速器哪个好绝地求生的加速器哪个好用?等额本息等额本金哪个好等额本金和等额本息的区别哪个好无纺布和熔喷布口罩哪个好一次性口罩的熔喷布和KN95的熔喷布有什么不同?电动牙刷哪个好有人懂电动牙刷吗?飞利浦的好用还是欧乐B好用云盘哪个好网盘哪个好用?空间登录器用什么登录器可以登录QQ(除了QQ登录器)google广告申请谷歌广告怎么申请?360云盘企业版有什么网盘好用的?360云盘即将停止个人版转向企业版了,百度云限速太厉害不好用,微云感觉空间小了点360云安全中心360云安全中心连接不到
smartvps naning9韩国官网 华为云服务 云网数据 arvixe inmotionhosting winhost omnis debian6 圣诞节促销 ibrs 免费mysql 圣诞促销 gspeed 免费智能解析 免费的asp空间 华为云建站 电信宽带测速软件 黑科云 密钥索引 更多