- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在使用 dlib 的 face_landmark_detection_ex.cpp,它显示检测到的面部图像和原始图像上的所有面部标志。我想将包含所有 68 个面部特征的原始图像保存到我的计算机中。我知道这可以通过 dlib 的 save_png 和 draw_rectangle 函数来完成,但是 draw_rectangle 只给出检测到的面部矩形位置,连同它,我也想在原始图像并像这样保存它们:
最佳答案
参数pixel_type
用于指定用于绘制矩形的像素种类。在函数的 header 声明中定义了默认情况下要使用的像素类型是 rgb_pixel
(rgb_pixel(0,0,0)
) 类型的黑色像素
template <typename pixel_type>
void draw_rectangle (
const canvas& c,
rectangle rect,
const pixel_type& pixel = rgb_pixel(0,0,0),
const rectangle& area = rectangle(-infinity,-infinity,infinity,infinity)
);
因此,要保存图像,首先使用函数draw_rectangle
在图像上绘制矩形,然后使用save_png
保存此图像。
绘制它们的一种简单方法是绘制函数 sp(img, dets[j])
具有函数 draw_pixel
的 face_landmark_detection_ex.cpp
。
template <typename pixel_type>
void draw_pixel (
const canvas& c,
const point& p,
const pixel_type& pixel
);
/*!
requires
- pixel_traits<pixel_type> is defined
ensures
- if (c.contains(p)) then
- sets the pixel in c that represents the point p to the
given pixel color.
!*/
一旦绘制完所有地标,使用 save_png
保存图像。
为此,请使用函数:
template <typename image_type, typename pixel_type >
void draw_line (
image_type& img,
const point& p1,
const point& p2,
const pixel_type& val
);
/*!
requires
- image_type == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
ensures
- #img.nr() == img.nr() && #img.nc() == img.nc()
(i.e. the dimensions of the input image are not changed)
- for all valid r and c that are on the line between point p1 and p2:
- performs assign_pixel(img[r][c], val)
(i.e. it draws the line from p1 to p2 onto the image)
!*/
关于c++ - 如何在 dlib 中保存结果人脸特征图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36662894/
我目前正在尝试使用我存档的图像训练 DNN(OCR 上下文......每个类的输入图像是数千个固定大小的小图像的聚合图像)。 我有一些代码可以打开聚合图像并将其正确分割为小型 OpenCV cv::M
我正在尝试将 dlib 安装到 cloud9 上,但我一直收到此错误。 c++: internal compiler error: Killed (program cc1plus) Please su
我目前正在尝试构建和使用旨在将 dlib 移植到 Android 的 dlib-android 库。搭建成功;但是在相应的演示项目dlib-android-app中使用编译后的共享C++库时,应用程序
我需要一个 dlib::matrix 的 std::vector,但我在编译时不知道矩阵大小;文档告诉我: // (Note that if you don't know the dimensiona
我试图在 dlib 中移动几步的尝试在尝试复制此代码的某些部分时突然停止 http://dlib.net/face_landmark_detection_ex.cpp.html 这就是我目前所得到的
我使用 dlib 的 hog 检测器,因为它发现人脸比 opencv haarcascades 好得多。但它无法检测脸上的情绪(或者可以???)。我需要从带有面部的 dlib::rectangle 中
我在启用了 CUDA 9.1 的 Ubuntu 16.04 上使用 cmake 3.11.0 编译了 dlib 19.10。一切顺利,没有遇到任何问题! 这里是运行 cmake .. 的输出 -- T
我正在尝试为我的 django python 环境安装 dlib(机器学习库)。但是,我无法安装它。有错误并卡住。 根据这个指令,这就是我所做的 https://www.pyimagesearch.c
我无法运行Streamlight应用程序并遇到错误。我卸载了dlib并安装了cmake,然后再次安装dlib,仍然得到相同的错误
前言 人脸识别在lwf(labeled faces in the wild)数据集上人脸识别率现在已经99.7%以上,这个识别率确实非常高了,但是真实的环境中的准确率有多少呢?我没有这方面的数据,
我想绘制脸颊的轮廓,如下图所示: 我正在使用 OpenCV 和 Dlib 来检测界标,而且我不知道如何操作Dlib点。有谁知道我可以在脸颊上绘制轮廓吗? 这是我的代码: import cv2 impo
使用 dlib 库如何进行元素特定操作?例如 A = [1 2 3; 4 5 6] 我可以让它对矩阵的元素进行平方,而不是 A*A,这样答案就是 ans = [1 4 9; 16 25 36] 在 m
我刚开始尝试 dlib 库。我已经完成了编译说明,但问题仍然存在。我正在使用命令行进行编译和执行。我使用了以下命令并给了我错误。 g++ -O3 -I.. ../dlib/all/source.cpp
我正在使用 dlib 做机器学习,但我发现所有代码只能处理一维标签。 我的数据集是这样的:样本是 m 长度的 vector ,标签是 n 长度的 vector 。 (m>n) dlib 是否可以针对此
我正在为 object detection 使用 dlib ,标注和训练数据集是使用HOG+SVM完成的,能够检测到物体,但是现在 我需要从图像中提取芯片 我想在 win_overlay 上的检测区域
我想从低亮度图像中检测人脸。我正在使用 dlib 从图像中检测人脸。但是 dlib 检测器根本检测不到人脸。我有以下代码来检测图像中的人脸。 detector=dlib.get_frontal_fac
我正在使用 D-lib 提取面部的某些区域。我正在使用 opencv 裁剪使用 dlib 地标点检测器检测到的区域。但是,裁剪后的图像是蓝色的。知道为什么要改变吗?而且我发现一些图像跳过了这段代码。因
我遇到了一个奇怪的错误——每当我包含 #include 时到我的项目并声明一个变量(例如 dlib::image_window win )出现以下错误: 'DLIB_NO_GUI_SUPPORT i
我正在编写一个 dlib 代码来进行一对一的人脸识别。 我遵循 dlib samples 中的代码示例并执行了以下操作: std::vector> faces; for (auto face : de
我正在寻找使用 dlib 库来优化近似误差...假设我有点 (x,y) 和一个值 vector ,它们用于查找最小值并在本地拟合误差,所以我实现了此类: #include #include #in
我是一名优秀的程序员,十分优秀!