-1

I am creating a robot along with my team (of which is called The Rusty Huskies) for a FIRST competition. We need to know how to convert an image to different values of rgb so that our robot can detect which switch we are looking at (the switch is where we would be placing our blocks to gain points).

So it would turn out to be something like this:

#include <color_reader.h>
#include <string>

class Robot: public frc::IterativeRobot {

std::string color = "";

colorDetector colorDet;

colorDet.readImg("image.png");

r = colorDet.r;
g = colorDet.g;
b = colorDet.b;

if (r >= 150) {

color = "red";

} else {

color = "blue";

}

};

START_ROBOT_CLASS(Robot)

Thanks for any help in advance!

  • 1
    Install OpenCV in your project. It has many real-time image processing functionalities for such robotic projects – seccpur Feb 27 '18 at 01:15

1 Answers1

1

Getting RGB values for each pixel from a raw image in C

In this post the same question is discussed, depends with camera manufacturer.

You have to search for a library to work with your camera, writing a code might be too difficult.

pb77
  • 47
  • 9