顔検出 - Siv3D/Reference-JP GitHub Wiki
# include <Siv3D.hpp>
void Main()
{
Webcam webcam(0);
if (!webcam.start())
{
return;
}
Image image;
DynamicTexture texture;
while (System::Update())
{
if (webcam.hasNewFrame())
{
webcam.getFrame(image);
for (const auto rect : Imaging::DetectFaces(image, CascadeType::Photo, 3, { 40, 40 }))
{
rect.overwriteFrame(image, 3, 3, Palette::Red);
}
texture.fill(image);
}
if (texture)
{
texture.mirror().draw();
}
}
}
イラスト提供: 古古米 さん
# include <Siv3D.hpp>
void Main()
{
Texture texture;
while (System::Update())
{
if (Dragdrop::HasItems())
{
if (Image image{ Dragdrop::GetFilePaths()[0] })
{
for (const auto rect : Imaging::DetectFaces(image, CascadeType::Anime))
{
rect.overwriteFrame(image, 3, 3, Palette::Red);
}
texture = Texture(image);
Window::Resize(texture.size);
}
}
if (texture)
{
texture.draw();
}
}
}