首页 > 编程知识 正文

京东金融滞纳金诈骗,京东金融逾期协商

时间:2023-05-06 16:27:02 阅读:195353 作者:3646

2017年11月的京东金融大数据竞赛参与人数最多的是猪脸识别的算法比赛,参加整个大数据比赛的有四千多人,而猪脸识别算法组就有一千多人。可见,搞图像识别的的人很多啊。想要提升自己价值的小伙伴们,向语音、文本、机器人等领域进发吧,有了机器学习的基础,入门这些领域应该都不是太难。
比赛给的数据是30头猪的视频,做识别的第一步还是从视频中去图像吧。本想用以前写过的视频取帧程序。看Matlab示例的时候发现用Matlab取帧更简便易行,那就用它吧。这样又省了很多时间。代码如下:

%exam1.m extract frame from videoclc; close all; imtool close all; clear; %30段视频在本代码同级目录video文件夹下,格式为mp4fpath = [pwd,'video*.mp4'];fname = dir(fpath);fnum = numel(fname);vidpath = [pwd,'video'];try for i=1:fnum videoname = fullfile(vidpath,fname(i).name); %读取视频数据 videoObject = VideoReader(videoname); % 获取视频中帧数. numberOfFrames = videoObject.NumberOfFrames; vidHeight = videoObject.Height; vidWidth = videoObject.Width; numberOfFramesWritten = 0; figure; writeToDisk = true; %对视频文件全路径进行分离. [folder, baseFileName, extentions] = fileparts(videoname); %获取当前路径 folder = pwd; %在当前路径下建立子文件夹image,并在image下为各视频建立以文件名命名的子文件夹,用以存放该视频提取的帧 outputFolder = sprintf('%s/image/%s', folder, baseFileName); if ~exist(outputFolder, 'dir') mkdir(outputFolder); end %每分钟约为30帧图像,每隔15帧取一帧 for frame = 1 :15: numberOfFrames %读取帧数据 thisFrame = read(videoObject, frame); image(thisFrame); caption = sprintf('Frame %4d of %d.', frame, numberOfFrames); title(caption, 'FontSize', fontSize); drawnow; % Force it to refresh the window. %将图像帧数据写入文件 if writeToDisk % 创建图像名,格式为“视频名-帧序号” imgName = sprintf('%s-%04d.jpg',baseFileName, frame); outputFullFileName = fullfile(outputFolder, imgName); text(5, 15, imgName, 'FontSize', 20); % Extract the image with the text "burned into" it. frameWithText = getframe(gca); . imwrite(frameWithText.cdata, outputFullFileName, 'jpg'); end % 输出提取信息. if writeToDisk progressIndication = sprintf('Wrote frame %4d of %d.', frame, numberOfFrames); else progressIndication = sprintf('Processed frame %4d of %d.', frame, numberOfFrames); end disp(progressIndication); numberOfFramesWritten = numberOfFramesWritten + 1; end endcatch warning('Problem using function. Assigning a value of 0.'); a = 0;end

该程序运行完后,就得到了30头猪的图像信息。若需增加数据量,可将提取帧的间隔减小。

转载于:https://blog.51cto.com/8764888/2085918

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。