Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making Color on/off switch in SCALPR #8

Open
ramaiah-xinthe opened this issue Mar 7, 2024 · 3 comments
Open

Making Color on/off switch in SCALPR #8

ramaiah-xinthe opened this issue Mar 7, 2024 · 3 comments

Comments

@ramaiah-xinthe
Copy link

Add flag Color=ON/OFF in command line argument

@NareshG04
Copy link

#include
#include<unistd.h>
using namespace std;

void setColorOutput(bool enableColor)
{
const string colorRed = "\033[1;31m";
const string colorReset = "\033[0m";

if (enableColor) {
    cout << colorRed;
} else {
    cout << colorReset;
}

}

int main(int argc, char *argv[])
{
int opt;
bool enableColor = true;

while ((opt = getopt(argc, argv, "c:")) != -1)
{
    switch (opt)
    {
        case 'c':
            if (string(optarg) == "on")
            {
                enableColor = true;
            }
            else if (string(optarg) == "off")
            {
                enableColor = false;
            }
            break;
        default:
            cerr << "Usage: " << argv[0] << " [-c on|off]\n";
            return 1;
    }
}
setColorOutput(enableColor);

return 0;

}

@SwathiJuvvi
Copy link

#include
#include

std::string SetColor(bool color)
{
if bool{
return "RED OR GREEN choose COLOR options";
}

}
int main(int argc, char *argv[])
{
bool enable;

for(i=argc;argc != -1;i--){
    if (strcmp(argv[i], "on") == 0){
        enable=true;
        string color=SetColor(enable);
        std::cout<<color<<std::endl;
    }
    else if(strcmp(argv[i], "on")== 0){
        enable=false;
    }

}

}

@SravanthiAnnam201
Copy link

#include
#include
#include <opencv2/opencv.hpp>
#include "kalmanFilter.h"
#include "dataType.h"

using namespace cv;
using namespace std;

class BYTETracker;

//---------------------------------------------------------------------------
enum TrackState { New = 0, Tracked, Lost, Removed };
//---------------------------------------------------------------------------

// Define STrack class here...

//---------------------------------------------------------------------------

int main(int argc, char* argv[]) {
bool enableColor = true; // Default value for color processing

// Check if the "-Color" flag is provided in the command line arguments
for (int i = 1; i < argc; ++i) {
    if (string(argv[i]) == "-Color") {
        // Check if the next argument is "ON" or "OFF"
        if (i + 1 < argc) {
            string colorFlag = argv[i + 1];
            if (colorFlag == "ON")
                enableColor = true;
            else if (colorFlag == "OFF")
                enableColor = false;
        }
        break; // Stop searching once found
    }
}

// Your code continues here...

return 0;

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants