def perform_query(db_name, descriptor_alias, results):
		"""
			@type results: dict
			@type descriptor_alias: str
			@type db_name: str
		"""
		PVCD_Wrapper.new_search_profile(db_name, descriptor_alias)
		PVCD_Wrapper.search()
		detections = PVCD_Wrapper.detect()
		results[db_name] = detections
def perform_query(db_name, descriptor_alias, results):
    """
			@type results: dict
			@type descriptor_alias: str
			@type db_name: str
		"""
    PVCD_Wrapper.new_search_profile(db_name, descriptor_alias)
    PVCD_Wrapper.search()
    detections = PVCD_Wrapper.detect()
    results[db_name] = detections
def search_by_video_file():
    if request.method == 'POST':
        uploaded_file = request.files['uploaded_file']
        if uploaded_file and allowed_file(uploaded_file.filename):
            db_name = 'query'
            descriptor = request.form['descriptor']
            alias = request.form['alias']
            # filename = secure_filename(uploaded_file.filename)
            file_path = save_video_file(uploaded_file)
            PVCD_Wrapper.compute_descriptors(file_path, descriptor, alias)
            PVCD_Wrapper.new_search_profile(db_name, alias)
            PVCD_Wrapper.search()
            detections = PVCD_Wrapper.detect()

            return jsonify(detections=detections)
def search_by_video_file():
	if request.method == 'POST':
		uploaded_file = request.files['uploaded_file']
		if uploaded_file and allowed_file(uploaded_file.filename):
			db_name = 'query'
			descriptor = request.form['descriptor']
			alias = request.form['alias']
			# filename = secure_filename(uploaded_file.filename)
			file_path = save_video_file(uploaded_file)
			PVCD_Wrapper.compute_descriptors(file_path, descriptor, alias)
			PVCD_Wrapper.new_search_profile(db_name, alias)
			PVCD_Wrapper.search()
			detections = PVCD_Wrapper.detect()

			return jsonify(detections=detections)
def search_by_descriptor():
    datos = request.get_json()
    detections = []
    if datos is not None:
        length = len(datos)
        app.logger.info('Length: %d', length)
        # app.logger.info(datos[0])
        db_name = 'query'
        descriptor_type = datos.get('type')
        descriptor_parser = get_descriptor_parser(descriptor_type, datos)
        app.logger.info(
            'received %s descriptors of type %s' %
            (descriptor_parser.length, descriptor_parser.get_alias()))

        PVCD_Wrapper.create_database(db_name)
        PVCD_Wrapper.create_segmentation(db_name, descriptor_parser)
        PVCD_Wrapper.write_descriptors(db_name, descriptor_parser)
        PVCD_Wrapper.new_search_profile(db_name, descriptor_parser.get_alias())
        PVCD_Wrapper.search()
        detections = PVCD_Wrapper.detect()
        # detections = []
        # detections = [{'score': 2, 'reference': 'hello'}, {'score': 3, 'reference': 'world'}]
        app.logger.info(detections)

    return jsonify(detections=detections)
def search_by_descriptor():
	datos = request.get_json()
	detections = []
	if datos is not None:
		length = len(datos)
		app.logger.info('Length: %d', length)
		# app.logger.info(datos[0])
		db_name = 'query'
		descriptor_type = datos.get('type')
		descriptor_parser = get_descriptor_parser(descriptor_type, datos)
		app.logger.info('received %s descriptors of type %s' % (descriptor_parser.length, descriptor_parser.get_alias()))

		PVCD_Wrapper.create_database(db_name)
		PVCD_Wrapper.create_segmentation(db_name, descriptor_parser)
		PVCD_Wrapper.write_descriptors(db_name, descriptor_parser)
		PVCD_Wrapper.new_search_profile(db_name, descriptor_parser.get_alias())
		PVCD_Wrapper.search()
		detections = PVCD_Wrapper.detect()
		# detections = []
		# detections = [{'score': 2, 'reference': 'hello'}, {'score': 3, 'reference': 'world'}]
		app.logger.info(detections)

	return jsonify(detections=detections)