Bitmap bitmap = (Bitmap)eventArgs.Frame.Clone();
Image<Bgr, byte> grayImage = new Image<Bgr, byte>(bitmap);
Rectangle[] rectangles = cascadeclassifier.DetectMultiScale(grayImage, 1.2, 1);
foreach(Rectangle rectangle in rectangles)
{
using (Graphics graphics = Graphics.FromImage(bitmap))
{
using (Pen pen = new Pen(Color.OrangeRed,1))
{
graphics.DrawRectangle(pen, rectangle);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我在这里的代码有问题:
Image<Bgr, byte> grayImage = new Image<Bgr, byte>(bitmap);
错误位于 (位图)
错误是:
Error CS1503 Argument 1: cannot convert from 'System.Drawing.Bitmap' to 'byte[*,*,*]'
我需要使用PCA显示前10个特征脸,用于图像特征向量矩阵.
我正在使用以下matlab代码来创建第一个特征脸,但我变得非常黑暗并且不那么正确的特征脸.eFea是240x4096的矩阵,其中每行代表64x64的图像
newData = eFea';
data = newData;
[M,N] = size(data);
mn = mean(data,2);
data = double(data) - repmat(mn,1,N);
% construct the matrix Y
Y = data' / sqrt(N-1);
% SVD
[u,S,PC] = svd(Y,0);
imshow(reshape(PC(1,:),64,64))
Run Code Online (Sandbox Code Playgroud)
关于代码中的错误的任何提示都会有所帮助.
运行时错误:
必须安装 CMake 才能构建以下扩展:dlib
为 dlib 构建轮子失败 为 dlib 运行 setup.py clean 无法构建 dlib
我在google colaboratory上练习OpenCV,因为我不知道如何在GPU上使用OpenCV,当我在我的硬件上运行OpenCV时,它需要大量CPU,所以我去了Google colaboratory。我的笔记本的链接在这里。
如果你不想看,代码如下:
import cv2
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
cap = cv2.VideoCapture(0)
while True:
_, img = cap.read()
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.1, 4)
for (x, y, w, h) in faces:
cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 2)
cv2.imshow('img', img)
k = cv2.waitKey(30) & 0xff
if k==27:
break
cap.release()
Run Code Online (Sandbox Code Playgroud)
相同的代码在我的 PC 上运行良好,但在 Google Colaboratory 上则不然。错误是:
---------------------------------------------------------------------------
error Traceback (most recent call last)
<ipython-input-5-0d9472926d8c> in <module>()
6 while True:
7 _, img = cap.read() …
Run Code Online (Sandbox Code Playgroud) 我使用 Deepface 来检测和对齐面部
from deepface import DeepFace
import cv2
align_face = DeepFace.detectFace("base/g3.jpg")
Run Code Online (Sandbox Code Playgroud)
所以我需要将图像从align_fac保存为jpg。我该怎么做?
我收到这个错误。还有更多。
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(517,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\user\AppData\Local\Temp\pip-install-ra1cvy6u\dlib_fbc984c811b2401a9d6e9de52ebc927f\build\temp.win-amd64-3.10\Release\ZERO_CHECK.vcxproj]
Checking Build System
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(517,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\user\AppData\Local\Temp\pip-install-ra1cvy6u\dlib_fbc984c811b2401a9d6e9de52ebc927f\build\temp.win-amd64-3.10\Release\dlib_build\dlib.vcxproj]
Building Custom Rule C:/Users/user/AppData/Local/Temp/pip-install-ra1cvy6u/dlib_fbc984c811b2401a9d6e9de52ebc927f/dlib/CMakeLists.txt
base64_kernel_1.cpp
bigint_kernel_1.cpp
bigint_kernel_2.cpp
bit_stream_kernel_1.cpp
entropy_decoder_kernel_1.cpp
entropy_decoder_kernel_2.cpp
entropy_encoder_kernel_1.cpp
entropy_encoder_kernel_2.cpp
md5_kernel_1.cpp
tokenizer_kernel_1.cpp
unicode.cpp
test_for_odr_violations.cpp
sockets_kernel_1.cpp
bsp.cpp …
Run Code Online (Sandbox Code Playgroud) 我如何构建一个应用程序,将奇观放在正在显示的脸上(类似于 facebook Messenger 的功能)?如果我能识别眼睛的位置,那我该如何制作自己的眼镜贴呢?