How to start working - Estia-1a/projetGenieInfo_public GitHub Wiki

Let's start working

2. Helloworld example

The following example is given in main.c.

if ( strncmp( configuration.command, "helloworld", 10 ) == 0 ) {
    /* helloworld() function is defined in feature.h and implemented in feature.c */
    helloWorld();
}

This condition is verified when "helloworld" is placed after "-c" when freud.exe is launched. Please note that you always have to specify path of an input image after "-f".

./freud.exe --debug -f images/input/image.jpeg -c helloworld

The following structure is used to store the different arguments of command launch.

#define MAX_FILE_COUNT 10 /* Maximum number of files */
#define MAX_LENGTH_COMMAND 25 /* Maximum length of a command */
#define MAX_ARGUMENT_COUNT 5 /* Maximum number of arguments */

typedef struct _config {
    int debug_mode ; /* Debug mode flag --debug */
    char command[MAX_LENGTH_COMMAND] ; /* Command called. Example: helloworld */
    char* filenames[MAX_FILE_COUNT] ; /* Images path. Example: ./images/input/image.jpeg */
    char* arguments[MAX_ARGUMENT_COUNT] ; /* Other arguments. */
} Config ;

In main.c, to access the specified command you must use Config struct like this: configuration.command. In main.c, to access the path of input file you must use Config struct like this: configuration.filenames.

Definition of helloworld() function can be found in src/features.h. You have to define prototypes of the other features here.

#ifndef FEATURES_H
#define FEATURES_H


void helloWorld();

#endif

Implementation of helloworld() function can be found in src/features.c. You have to implement the other features here.

void helloWorld() {
    printf("Hello World !");
}

When you finished the implementation of a feature, skip a line and add the name of the relative function in freud.manifest. For example, when dimension() is defined and implemented, you must add dimension in the next line in freud.manifest like this:

helloworld
dimension

2. Features

You have to begin with Tutorial issues (see tutorial issues), Statistics issues (see statistics issues), then Colors issues (see colors issues. Implementing these issues is the minimum work to get the minimum grade (see Evaluation - Final Evaluation).
Please refer to the wiki for writing/reading images relative question.

2.1 Test your features

You may want to launch your project to test your implemented features. In order to do this, you have two options.
Before launching don't forget to build and install your project (here for more details).

2.1.1 Launch in command line

Open VS Code integrated terminal. Type the command:

./freud.exe --debug -f <input file name> -c <command name>

Replace <input file name> by the path of input image. Example: ./images/input/image.jpeg
Replace <command name>by the name of the implemented command you want to test. Example: helloworld

2.1.2 Launch with VS Code UI

Open .vscode/settings.json.
Replace images/input/image.jpeg by the path of the input image you want.
Replace helloworld by the implemented command you want to test.

Before After
{
    "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
    "cmake.debugConfig": {
        "args": [
            "--debug",
            "-f",
            "images/input/image.jpeg",
            "-c",
            "helloworld"
        ],
        "cwd": "${workspaceFolder}"
    },
    "files.associations": {
        "unistd.h": "c"
    },
} 
{
    "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
    "cmake.debugConfig": {
        "args": [
            "--debug",
            "-f",
            "images/input/another_image.bmp",
            "-c",
            "dimension"
        ],
        "cwd": "${workspaceFolder}"
    },
    "files.associations": {
        "unistd.h": "c"
    },
}

Click on run .

⚠️ **GitHub.com Fallback** ⚠️