本文主要是介绍基于imcrop,裁剪人脸视频,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
识别人脸并裁剪视频。
裁剪视频通过imcrop实现,bbox通过人脸识别自动获取
function [outfilename,fr] = FirstFrameFaceDet(infilename,handles)
%第一步:检测参考帧
% Create a cascade detector object.
addpath(genpath('.'));
global infilename;infilename='cdd.avi'
faceDetector = vision.CascadeObjectDetector();
% Read a video frame and run the detector. data\cdd.mp4
vidFile = fullfile('data', infilename);
outfilename = [infilename(1:end-4),'_1st.avi'];
% result\cdd_1st.avi
outName = fullfile('result',outfilename);
vid = VideoReader(vidFile);
fr = round(vid.FrameRate);
len = vid.NumberOfFrames;
% temp = struct('cdata', zeros(vidHeight, vidWidth, nChannels, 'uint8'), 'colormap', []);
% temp.cdata = read(vid, 1);
% [videoFrame,~] = frame2im(temp);
videoFileReader = vision.VideoFileReader(vidFile);
videoFrame = step(videoFileReader);
%人脸识别&#
这篇关于基于imcrop,裁剪人脸视频的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!