Exemple #1
0
    def GET(self):
        configLoad.load_cameras()
        configLoad.load_camera_config()
        result_to_show = []
        for camera in configLoad.globalConfig['cameras']:
            frames_path = camera['frame_path']

            if camera.has_key('savedProgress'):
                cameradata = {}
                cameradata['uid'] = camera['uid']
                oneImage = camera['savedProgress']
                resimage_path = camera[
                    'result_personarea_path'] + '/' + oneImage.replace(
                        source_flag, result_flag)
                #resimage = Image.open(camera['result_personarea_path']+'/'+oneImage.replace(source_flag,result_flag))
                cameradata['image'] = resimage_path
                frames = []
                with open(camera['result_person_box_path'] + '/' +
                          oneImage.replace(source_flag, boundingbox_flag)
                          ) as fframes:
                    for line in fframes:
                        values = line.split(' ')
                        frames.append(
                            (int(values[0]), int(values[1]), int(values[2]),
                             int(values[3]), float(values[4])))
                cameradata['frames'] = frames

                result_to_show.append(cameradata)
        i = web.input(orderby="default")
        if i.orderby == 'count':
            #print len(result_to_show[0]['frames'])
            result_to_show.sort(key=lambda x: len(x['frames']), reverse=True)
        return render.mainpage(result_to_show)
    def GET(self):
        configLoad.load_cameras();
        configLoad.load_camera_config();
        result_to_show=[];
        for camera in configLoad.globalConfig['cameras']:
            frames_path=camera['frame_path'];

            if camera.has_key('savedProgress'):
                cameradata={};
                cameradata['uid']=camera['uid'];
                oneImage=camera['savedProgress'];
                resimage_path=camera['result_personarea_path']+'/'+oneImage.replace(source_flag,result_flag);
                #resimage = Image.open(camera['result_personarea_path']+'/'+oneImage.replace(source_flag,result_flag))
                cameradata['image']=resimage_path;
                frames=[];
                with open(camera['result_person_box_path']+'/'+oneImage.replace(source_flag,boundingbox_flag)) as fframes:
                    for line in fframes:
                        values=line.split(' ');
                        frames.append((int(values[0]),int(values[1]),int(values[2]),int(values[3]),float(values[4])));
                cameradata['frames']=frames;

                
                result_to_show.append(cameradata);
        i = web.input(orderby="default");
        if i.orderby=='count':
            #print len(result_to_show[0]['frames'])
            result_to_show.sort(key=lambda x:len(x['frames']),reverse=True);
        return render.mainpage(result_to_show);
Exemple #3
0
    def GET(self):
        #__init__
        picurl = ''
        taskid = ''
        name = ''
        subpage = 0
        mfiles = []
        pagenum = 1
        width = 640
        height = 480

        configLoad.load_cameras()
        configLoad.load_camera_config()
        i = web.input(subpage="0")
        subpage = int(i.subpage)

        if (subpage < 0):
            return "error"

        name = []
        output = {}
        if subpage == 0:
            for camera in configLoad.globalConfig['cameras']:
                name.append(camera['uid'])
        elif subpage == 1:
            i = web.input(taskid="none", pagenum="0")
            pagenum = int(i.pagenum)
            taskid = i.taskid
            if (taskid != 'none'):
                mCameraConfig = None
                for camera in configLoad.globalConfig['cameras']:
                    if taskid == camera['uid']:
                        mCameraConfig = camera
                        break
                if mCameraConfig is not None:
                    biaodingdir = mCameraConfig['frame_path'] + '/'
                    files = os.listdir(biaodingdir)
                    mfiles = [
                        biaodingdir + '/' + mfile for mfile in files
                        if configLoad.source_flag in mfile
                    ]
                    picurl = mfiles[pagenum]
                    print mCameraConfig['config']['config']
                    width = int(mCameraConfig['config']['config']['width'])
                    height = int(mCameraConfig['config']['config']['height'])

        output['IImagePath'] = 'static/' + picurl
        output['taskid'] = taskid
        output['name'] = name
        output['subpage'] = subpage
        output['sumpage'] = len(mfiles)
        output['pagenum'] = pagenum
        output['width'] = width
        output['height'] = height
        #return "hello"
        return render.calibration(output)
    def GET(self):
        #__init__
        picurl=''
        taskid='';
        name='';
        subpage=0;
        mfiles=[];
        pagenum=1;
        width=640;
        height=480;

        configLoad.load_cameras()
        configLoad.load_camera_config()
        i = web.input(subpage="0")
        subpage=int(i.subpage);

        if (subpage<0):
            return "error"

        name = []
        output = {}
        if subpage==0:
            for camera in configLoad.globalConfig['cameras']:
                name.append(camera['uid']);
        elif subpage==1:
            i = web.input(taskid="none", pagenum="0")
            pagenum = int(i.pagenum)
            taskid = i.taskid
            if (taskid != 'none'):
                mCameraConfig=None;
                for camera in configLoad.globalConfig['cameras']:
                    if taskid == camera['uid']:
                        mCameraConfig=camera;
                        break;
                if mCameraConfig is not None:
                    biaodingdir = mCameraConfig['frame_path'] +'/';
                    files = os.listdir(biaodingdir)
                    mfiles = [biaodingdir + '/' + mfile for mfile in files if configLoad.source_flag in mfile]
                    picurl = mfiles[pagenum]
                    print mCameraConfig['config']['config']
                    width=int(mCameraConfig['config']['config']['width']);
                    height = int(mCameraConfig['config']['config']['height']);


        output['IImagePath'] ='static/'+ picurl
        output['taskid'] = taskid
        output['name'] = name
        output['subpage'] = subpage
        output['sumpage'] = len(mfiles)
        output['pagenum'] = pagenum
        output['width'] = width
        output['height'] = height
        #return "hello"
        return render.calibration(output)
Exemple #5
0
    def GET(self):
        configLoad.load_cameras();
        configLoad.load_camera_config();
        result_to_show=[];
        for camera in configLoad.globalConfig['cameras']:
            frames_path=camera['frame_path'];

            if camera.has_key('savedProgress'):
                cameradata={};
                cameradata['uid']=camera['uid'];
                oneImage=camera['savedProgress'];
                resimage_path=camera['result_personarea_path']+'/'+oneImage.replace(source_flag,result_flag);
                #resimage = Image.open(camera['result_personarea_path']+'/'+oneImage.replace(source_flag,result_flag))
                cameradata['image']=resimage_path;
                frames=[];
                with open(camera['result_person_box_path']+'/'+oneImage.replace(source_flag,boundingbox_flag)) as fframes:
                    for line in fframes:
                        values=line.split(' ');
                        frames.append((int(values[0]),int(values[1]),int(values[2]),int(values[3]),float(values[4])));
                cameradata['frames']=frames;
                result_to_show.append(cameradata);
        return render.mainpage(result_to_show);
net = maineval_voc.initNet()

source_flag = configLoad.source_flag
result_flag = configLoad.result_flag
boundingbox_flag = configLoad.boundingbox_flag
inter_time = 0.0
clean_time = 0.0

db = MySQLdb.connect("localhost", "root", "lm2323", "people_c")
cursor = db.cursor()

while run:
    configLoad.load_count_config()
    configLoad.load_cameras()
    configLoad.load_camera_config()
    clean_flag = int(
        configLoad.globalConfig['count_config']['default']['cleanflag'])

    for camera in configLoad.globalConfig['cameras']:
        # check max number;
        # camera
        if not os.path.exists(camera['config_path'] + 'Device.ini'):
            continue
        mode_config = ConfigParser.ConfigParser()
        mode_config.read(camera['config_path'] + 'Device.ini')

        camUid = camera['uid'].strip()

        ip = mode_config.get('DEVICE', 'ip')
        ip = ip[0:(len(ip) - 2)].strip()
Exemple #7
0
    def GET(self):
        configLoad.load_count_config()
        configLoad.load_cameras()
        configLoad.load_camera_config()
        configLoad.load_mode_config()

        result_to_show = []
        cam_without_person = []
        cam_onalarm = []
        unhandled_num = 0
        clean_flag = int(
            configLoad.globalConfig['count_config']['default']['cleanflag'])
        hidenotrunning_flag = int(configLoad.globalConfig['count_config']
                                  ['default']['hidenotrunningflag'])

        for camera in configLoad.globalConfig['cameras']:

            if camera.has_key(
                    'savedProgress') and camera['savedProgress'].strip() != '':
                cameradata = {}
                cameradata['uid'] = camera['uid']
                oneImage = camera['savedProgress']
                #Cam with people
                if os.path.exists(
                        camera['result_person_box_path'] +
                        oneImage.replace(source_flag, boundingbox_flag)):
                    resimage_path = camera[
                        'result_personarea_path'] + oneImage.replace(
                            source_flag, result_flag)
                    cameradata['image'] = resimage_path

                    frames = []
                    with open(camera['result_person_box_path'] +
                              oneImage.replace(source_flag, boundingbox_flag)
                              ) as fframes:
                        for line in fframes:
                            values = line.split(' ')
                            frames.append((int(values[0]), int(values[1]),
                                           int(values[2]), int(values[3]),
                                           float(values[4])))
                    cameradata['frames'] = frames
                    result_to_show.append(cameradata)
                #Cam without people
                elif clean_flag == 0:
                    resimage_path = camera['result_personarea_path'] + oneImage
                    cameradata['image'] = resimage_path
                    cam_without_person.append(cameradata)

                #Alert pics
                alertUnhandledFolder = 'camera/Alert/unhandled/'
                files = os.listdir(alertUnhandledFolder)
                for file in files:
                    if camera['uid'] + '_' + oneImage.replace(
                            source_flag, result_flag) in file:
                        cameraAlert = {}
                        cameraAlert['uid'] = camera['uid']
                        cameraAlert['path'] = alertUnhandledFolder + file
                        cam_onalarm.append(cameraAlert)
                        break

                #Unhandled pics number
                unhandled_num = len(files)

        result = [
            result_to_show, cam_without_person, clean_flag, cam_onalarm,
            hidenotrunning_flag, unhandled_num
        ]
        return render.mainpage(result)
import time
import matplotlib.pyplot as plt
from PIL import Image
import numpy as np
import boxTu
run=True;

net=maineval_voc.initNet();

source_flag=configLoad.source_flag;
result_flag=configLoad.result_flag;
boundingbox_flag=configLoad.boundingbox_flag

while run:
    configLoad.load_cameras();
    configLoad.load_camera_config();
    for camera in configLoad.globalConfig['cameras']:
        #check max number;
        #camera
        #
        frames_path=camera['frame_path'];
        if camera.has_key('savedProgress'):
            oneImage=CheckNewImage.get_last_new_image(frames_path,filter=source_flag,saved_progress=camera['savedProgress']);
        else:
            oneImage=CheckNewImage.get_last_new_image(frames_path,filter=source_flag);
        if oneImage=='':
            continue;
        originimage = Image.open(frames_path+'/'+oneImage)
        print 'dealing:' + oneImage
        midImage=maineval_voc.processImage(net,originimage)
        #origin = np.array(originimage, dtype=np.uint8)