Commit b1967d155a37fceb20eaefe67dba7d713b8494d5

Authored by Arnaud Blanchard
2 parents c7fb9683 5cdadc23

Add serial, and experimental f_filter f_point_of_interest as bapps projects

... ... @@ -7,6 +7,7 @@ subdirs(i_oscillator)
subdirs(i_keyboard)
subdirs(f_max)
subdirs(serial)
subdirs(f_point_of_interest)
subdirs(f_filter)
... ...
# Set the minimum version of cmake required to build this project
cmake_minimum_required(VERSION 2.6)
# Set the name of the project as the directory basename
project(f_filter)
find_package(blc_channel)
find_package(blc_program)
add_definitions(${BL_DEFINITIONS})
include_directories(${BL_INCLUDE_DIRS})
add_executable(f_filter f_filter.cpp)
target_link_libraries(f_filter ${BL_LIBRARIES})
... ...
# Copyright ETIS — ENSEA, Université de Cergy-Pontoise, CNRS (2011 - 2016)
# Author: Arnaud Blanchard (November 2016)
# This software is governed by the CeCILL v2.1 license under French law and abiding by the rules of distribution of free software.
# You can use, modify and/ or redistribute the software under the terms of the CeCILL v2.1 license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
# As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license,
# users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
# In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software,
# that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
# Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured  and, more generally, to use and operate it in the same conditions as regards security.
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
cd `dirname $0`
echo
echo "Checking `basename $PWD`"
echo "===================="
echo
echo "No check for now"
echo
... ...
//
// Created by Arnaud Blanchard on 22/12/15.
// Copyright ETIS 2015. All rights reserved.
//
#include "blc_channel.h"
#include "blc_program.h"
#include <unistd.h>
#include <math.h>
#define DEFAULT_OUTPUT_NAME ":point_of_interest<pid>"
#define IN(x,y) input.uchars[(x)+(y)*in_width]
int main(int argc, char **argv){
blc_channel input, output;
char const *output_name, *input_name;
int out_width, out_height, in_width, in_height;
int i, j, sobel;
blc_program_set_description("Find a points of interest on a image");
blc_program_add_option(&output_name, 'o', "output", "blc_channel-out", "channel name", DEFAULT_OUTPUT_NAME);
blc_program_add_parameter(&input_name, "blc_channel-in", 1, "image from where you want to find the points of interest", NULL);
blc_program_init(&argc, &argv, blc_quit);
if (strcmp(output_name, DEFAULT_OUTPUT_NAME)==0) SYSTEM_ERROR_CHECK(asprintf((char**)&output_name,":point_of_interest%d", getpid()), -1, NULL);
input.open(input_name, BLC_CHANNEL_READ);
blc_loop_try_add_waiting_semaphore(input.sem_new_data);
blc_loop_try_add_posting_semaphore(input.sem_ack_data);
in_width=input.dims[0].length;
in_height=input.dims[1].length;
out_width=in_width-1;
out_height=in_height-1;
output.create_or_open(output_name, BLC_CHANNEL_WRITE, input.type, 'Y800', 2, out_width, out_height);
output.publish();
blc_loop_try_add_waiting_semaphore(output.sem_ack_data);
blc_loop_try_add_posting_semaphore(output.sem_new_data);
BLC_COMMAND_LOOP(0){
FOR(j, out_height){
FOR(i, out_width){
output.uchars[i+j*out_width]=(IN(i, j)+IN(i+1, j)+IN(i+2,j)\
+ IN(i, j+1)+IN(i+1, j+1)+IN(i+2,j+1)\
+ IN(i, j+2)+IN(i+1, j+2)+IN(i+2,j+2))/9;
}
}
}
return EXIT_SUCCESS;
}
... ...
# Set the minimum version of cmake required to build this project
cmake_minimum_required(VERSION 2.6)
# Set the name of the project as the directory basename
project(f_point_of_interest)
find_package(blc_channel)
find_package(blc_program)
add_definitions(${BL_DEFINITIONS})
include_directories(${BL_INCLUDE_DIRS})
add_executable(f_point_of_interest f_point_of_interest.cpp)
target_link_libraries(f_point_of_interest ${BL_LIBRARIES})
... ...
# Copyright ETIS — ENSEA, Université de Cergy-Pontoise, CNRS (2011 - 2016)
# Author: Arnaud Blanchard (November 2016)
# This software is governed by the CeCILL v2.1 license under French law and abiding by the rules of distribution of free software.
# You can use, modify and/ or redistribute the software under the terms of the CeCILL v2.1 license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
# As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license,
# users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
# In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software,
# that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
# Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured  and, more generally, to use and operate it in the same conditions as regards security.
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
cd `dirname $0`
echo
echo "Checking `basename $PWD`"
echo "===================="
echo
echo "No check for now"
echo
... ...
//
// Created by Arnaud Blanchard on 22/12/15.
// Copyright ETIS 2015. All rights reserved.
//
#include "blc_channel.h"
#include "blc_program.h"
#include <unistd.h>
#include <math.h>
#define DEFAULT_OUTPUT_NAME ":point_of_interest<pid>"
#define GRAD(x,y) grad.uchars[(x)+(y)*grad_width]
/** See how to use Filter of Scharr
*
* -3 0 3
* -10 0 10
* -3 0 3 / 32
*
*/
int main(int argc, char **argv){
blc_channel input, output, grad;
char const *output_name, *input_name;
int out_width, out_height, in_width, in_height, grad_height, grad_width;
int i, j, sobel;
blc_program_set_description("Find a points of interest on a image");
blc_program_add_option(&output_name, 'o', "output", "blc_channel-out", "channel name", DEFAULT_OUTPUT_NAME);
blc_program_add_parameter(&input_name, "blc_channel-in", 1, "image from where you want to find the points of interest", NULL);
blc_program_init(&argc, &argv, blc_quit);
if (strcmp(output_name, DEFAULT_OUTPUT_NAME)==0) SYSTEM_ERROR_CHECK(asprintf((char**)&output_name,":point_of_interest%d", getpid()), -1, NULL);
input.open(input_name, BLC_CHANNEL_READ);
blc_loop_try_add_waiting_semaphore(input.sem_new_data);
blc_loop_try_add_posting_semaphore(input.sem_ack_data);
in_width=input.dims[0].length;
in_height=input.dims[1].length;
grad_width=in_width-1;
grad_height=in_height-1;
grad.init('UIN8', 'NDEF',2, grad_width, grad_height);
out_width=grad_width-1;
out_height=grad_height-1;
output.create_or_open(output_name, BLC_CHANNEL_WRITE, input.type, 'Y800', 2, out_width, out_height);
output.publish();
blc_loop_try_add_waiting_semaphore(output.sem_ack_data);
blc_loop_try_add_posting_semaphore(output.sem_new_data);
BLC_COMMAND_LOOP(0){
FOR(j, grad_height){
FOR(i, grad_width){
grad.uchars[i+j*grad_width]=(abs(input.uchars[i+j*in_width]-input.uchars[i+j*in_width+1])+abs(input.uchars[i+j*in_width]-input.uchars[i+(j+1)*in_width]))/2;
}
}
FOR(j, out_height){
FOR(i, out_width){
sobel=-GRAD(i, j)-GRAD(i+1, j)-GRAD(i+2, j)\
-GRAD(i, j+1)+8*GRAD(i+1, j+1)-GRAD(i+2, j+1)\
-GRAD(i, j+2)-GRAD(i+1, j+2)- GRAD(i+2, j+2);
output.uchars[i+j*out_width]=(sobel > 0 && GRAD(i+1, j+1)>10) ? 255 : 0;
}
}
}
return EXIT_SUCCESS;
}
... ...
... ... @@ -18,7 +18,7 @@ find_package(blc_program REQUIRED)
add_definitions(${BL_DEFINITIONS})
include_directories(${BL_INCLUDE_DIRS})
add_executable(i_keyboard src/main.cpp)
add_executable(i_keyboard src/i_keyboard.cpp)
target_link_libraries(i_keyboard ${BL_LIBRARIES})
... ...
... ... @@ -222,11 +222,12 @@ static void loop_float(){
int main(int argc, char** argv){
char *default_output=NULL;
char const *extension;
char const *channel_name, *type_str, *str_quitting_key, *str_neutral_key, *max_str, *min_str, *str_neutral_value, *toggle_mode, *step_size_str, *filename;
char const *channel_name, *type_str, *str_quitting_key, *str_neutral_key, *max_str, *min_str, *str_neutral_value, *toggle_mode, *step_size_str, *filename, *file_select_name;
char const *key_nb_str;
int i;
char *pos;
uchar answer;
blc_array array_select;
asprintf(&default_output, "/%s%d", basename(argv[0]), getpid()); //This will not be free but it is only allocate once
blc_program_set_description("Get keyboard inputs");
... ... @@ -239,6 +240,7 @@ int main(int argc, char** argv){
blc_program_add_option(&str_quitting_key, 'q', "quitting_key", "string", "Define the key used to quit", "q");
blc_program_add_option(&key_nb_str, 's', "size", "integer", "Size of key vector", NULL);
blc_program_add_option(&type_str, 't', "type", "UIN8|FL32", "Define the type of the result", "UIN8");
blc_program_add_option(&file_select_name, 'F', "select", "filename", "File among which vlues will be selected", NULL);
blc_program_add_option(&max_str, 'M', "max", "real", "Define the normed max value", "1.0");
blc_program_add_option(&str_neutral_value, 'N', "neutral_value", "real", "Define the normed neutral value", "0.5");
blc_program_add_option(&step_size_str, 'S', "step", "real", "Set the normed step size", NULL);
... ... @@ -293,11 +295,20 @@ int main(int argc, char** argv){
case 'FL32':
FOR(i, keys_nb) channel.floats[i]=neutral_value;
break;
default:EXIT_ON_ARRAY_ERROR(&channel, "Type not mnaged");
default:EXIT_ON_ARRAY_ERROR(&channel, "Type not managed");
break;
}
}
if (file_select_name){
extension = blc_get_filename_extension(file_select_name);
if (strcmp(extension, "tsv")!=0) EXIT_ON_ERROR("Only .tsv files are managed, however your extension is '%s' in '%s'.", extension, file_select_name);
// array_select.updatewith_tsv_file
// SYSTEM_ERROR_CHECK(file_select=fopen(file_select_name, "r"), NULL, "Impossible to open '%s'", file_select_name);
}
if (display){
if ((channel.type!='UIN8') && (channel.type!='FL32')) EXIT_ON_ARRAY_ERROR(&channel, "This type can not be displayed. Only 'UIN8' or 'FL32' can.");
}
... ...