行人检测根据检测结果标注框图

clc;  
clear;  
%imgpath='D:\dd\tu\ff\';%图像存放文件夹  
imgpath='E:\..\fasterrcnn\testing\image_2\';%图像存放文件夹  
txtpath='D:\dd\1.txt';%txt文件  
fidin=fopen(txtpath,'r');  
  
while ~feof(fidin)  %文件指针到达文件末尾时 该表达式值为“假”;否则为“真”  
     tline=fgetl(fidin);  %fget1:从文件中读取一行数据  
     str = regexp(tline, ',','split');  %分割,str:待分割的字符串,' ':分隔符的字符,S:分割结果 
     if( str2double(str{6})>0.5)
     t=str2double(str{1})-1;
     %filepath=sprintf('tu\\ff\\%06d.png',t);
     filepath=sprintf('E:\\备份\\mscnn\\testing\\image_2\\%06d.png',t);
     %filepath=[imgpath,str{1},'.png'];  %filepath:拼接的文件名  
     img=imread(filepath);  %读取图片  
     imshow(img);  
     title(str(1));
     %rectangle('Position',[x,y,w,h]),LineWidth:线条粗细4,EdgeColor:边框颜色是红色  
     rectangle('Position',[str2double(str{2}),str2double(str{3}),str2double(str{4}),str2double(str{5})],'LineWidth',4,'EdgeColor','r');  
     pause(0.3);   %pause(n):程序暂停n秒后继续  
     end
end  
fclose(fidin);



同时显示:


clc;
clear all;
%imgpath='D:\dd\tu\ff\';%图像存放文件夹
%imgpath='E:\备份\mscnn\data\testing\image_2\';%图像存放文件夹

imgpath='D:\2012b\dd\ee\';%图像存放文件夹
txtpath='D:\2012b\dd\detections\kitti_8s_768_35k_test_ped.txt';%txt文件

%txtpath='D:\dd\p.txt';%txt文件

fidin=fopen(txtpath,'r');     
temp =-1;

while ~feof(fidin)  %文件指针到达文件末尾时 该表达式值为“假”;否则为“真”
    tline=fgetl(fidin);  %fget1:从文件中读取一行数据
    str = regexp(tline, ',','split');  %分割,str:待分割的字符串,' ':分隔符的字符,S:分割结果
    if( str2double(str{6})>0.6)
        t=str2double(str{1})-1;
        %filepath=sprintf('tu\\ff\\%06d.png',t);
        filepath=sprintf('E:\\备份\\ssss\\data\\testing\\image_2\\%06d.png',t);
       
        %filepath=[imgpath,str{1},'.png'];  %filepath:拼接的文件名
        if temp ~= t
            img=imread(filepath);  %读取图片
            imshow(img);
        end
        temp =t;
        
        %rectangle('Position',[x,y,w,h]),LineWidth:线条粗细4,EdgeColor:边框颜色是红色
        rectangle('Position',[str2double(str{2}),str2double(str{3}),str2double(str{4}),str2double(str{5})],'LineWidth',4,'EdgeColor','r');
        title(t);
        pause(.2);   %pause(n):程序暂停n秒后继续
        
    end
end
fclose(fidin);




  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值