Range from image

I am trying to remove a specific range of colors, but whatever i try, i get a black mask…

cv::inRange(img, low, high, mask);

Even if i swap the colors, still all black is the output, which doens’t make any sence cause i took the colors from the same image.

Another problem is how to extract a range of colors from the image, i want to select a specific part of image, get the range of colors and get ride of them, now i did it manually, but it can’t be like that.

inRange returns a binary image (values of 0 or 1). If you display it, you will see black (as images are considered 0…255, so the value of 1 is very close to black).
To check the result, do:

cv::imShow("Mask",mask*255);

Nothing changed, still all black. Maybe you know the answer for the 2 question, how do i get the range, from a specific part of image i crop?

Easiest solution is to take samples using an image editor like GIMP.

Otherwise you can do a segmentation program yourself. Untested code, so might need some modifications:

Mat image = imread("myimage.jpg");
namedWindow("Control", CV_WINDOW_NORMAL);
imshow("Control",image);

//inRange thresholds
int iLowR = 0,iHighR = 255;
int iLowG = 0,iHighG = 255;
int iLowB = 0,iHighB = 255;

//Create trackbars in "Control" window**
createTrackbar("LowR", "Control", &iLowR, 179);
createTrackbar("HighR", "Control", &iHighR, 179);
createTrackbar("LowG", "Control", &iLowG, 255);
createTrackbar("HighG", "Control", &iHighG, 255);
createTrackbar("LowB", "Control", &iLowB, 255);
createTrackbar("HighB", "Control", &iHighB, 255);
int ch=0;
while(ch!=27){ //break with ESC
    Mat segmented,result;
    inRange(image, Scalar(iLowB, iLowG, iLowR), Scalar(iHighB, iHighG, iHighR), segmented);
    image.copyTo(result,segmnted);
    imshow("Control",segmented);
    ch=waitKey(30);
}