Ask Your Question

codersquirrel's profile - activity

2018-11-26 05:53:53 -0600 received badge  Famous Question (source)
2018-02-28 06:13:32 -0600 received badge  Notable Question (source)
2017-09-17 07:03:58 -0600 received badge  Popular Question (source)
2016-04-05 06:35:15 -0600 commented question Camera Not Being Released

yeah it didn't

2016-04-04 14:59:01 -0600 asked a question Camera Not Being Released

Hi all I have

while (!janela->FINALIZADA ) {
camera >> frame;
  cv::imshow(janelasNome[0], frame);
 key = cv::waitKey(5) & 255;
            if (key == 99 || FIM) {
                 cv::destroyAllWindows();
                camera.release();
                break;
            }
}

but the camera is not being released. I tried to call camera.release() after the end of the while but the camera isn't being released either. I know that because it keeps with the lights on and when i try to open again the programs crashs and gives me

HIGHGUI ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV VIDIOC_STREAMON: Bad file descriptor OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /home/schirrel/Github/opencv/opencv-2.4.10/modules/highgui/src/window.cpp, line 261 terminate called after throwing an instance of 'cv::Exception' what(): /home/schirrel/Github/opencv/opencv-2.4.10/modules/highgui/src/window.cpp:261: error: (-215) size.width>0 && size.height>0 in function imshow

how can i force the camera release?

btw i tried to put an amount of camera.release() one after another and nothing changes.

2016-02-22 07:08:21 -0600 received badge  Supporter (source)
2016-02-22 07:08:02 -0600 commented answer Sorting HSV Values

Thanks Tetragramm

2016-02-21 12:43:17 -0600 asked a question Sorting HSV Values

Hi guys, i was wondering what is the best way to sort hsv values. I know that the first value to considerate is the H, but after it, should i use the S or the V value to order, e.g. a list of hsv values?

2016-02-19 17:05:02 -0600 commented question Problem with closing image window

no @LorenaGdL, it has a cv::namedWindow(src_window, CV_WINDOW_AUTOSIZE); i just didn't put here, sorry

2016-02-19 11:42:22 -0600 asked a question Problem with closing image window

I have a program wich has this part of code

while (1) {
         cap >> frame;
         COR_SELECAO = (key > 48 && key < 56) ? key : COR_SELECAO;
         cv::imshow(src_window, frame);
         cv::setMouseCallback(src_window,
 mouseHandler, 0);
         key = cv::waitKey(0) & 255;
         if (key == 99) {
             cv::destroyWindow(src_window);
             break;

         }
     }
     std::sort(Cores.begin(), Cores.end(), CompareCorHSV);

After this another image windows, processed will appear, but i need to close the first one before it. But it seems that the windows don't close. I have tried

   key = cv::waitKey(0) & 255;
    if (key == 99) {
        cv::destroyWindow(src_window);
        break;

    }
}
cv::destroyAllWindows();
cv::waitKey(1);
cv::destroyWindow(src_window);

but this hasn't work :/

2016-01-27 07:59:45 -0600 received badge  Student (source)
2016-01-12 11:40:44 -0600 received badge  Enthusiast
2016-01-08 11:44:39 -0600 commented answer bitwise_and giving Sizes of input arguments do not match

Hey man, sorry,my threshold was inverted thats why it was not working properly, now its perfect thanks

2016-01-08 11:32:32 -0600 commented answer bitwise_and giving Sizes of input arguments do not match

This worked but instead of only shown the points of the mask at the image it exclude it, how to invert?

2016-01-08 11:30:36 -0600 received badge  Scholar (source)
2016-01-07 14:28:21 -0600 asked a question bitwise_and giving Sizes of input arguments do not match

I'm trying to use bitwise in order to exclude all the rest of an image based on a threshold but when i try it gives

OpenCV Error: Sizes of input arguments do not match (The operation is neither 'array op array' (where arrays have the same size and type), nor 'array op scalar', nor 'scalar op array') in binary_op, file /home/schirrel/Github/opencv/opencv-2.4.10/modules/core/src/arithm.cpp, line 1021 terminate called after throwing an instance of 'cv::Exception' what(): /home/schirrel/Github/opencv/opencv-2.4.10/modules/core/src/arithm.cpp:1021: error: (-209) The operation is neither 'array op array' (where arrays have the same size and type), nor 'array op scalar', nor 'scalar op array' in function binary_op

My code is

Mat src, src_gray, dst;
int main() {
src = imread("robosoccer.jpg", 1);
cvtColor(src, src_gray, CV_BGR2GRAY);
threshold(src_gray, dst, 150, 255, 1);
Mat res;
bitwise_and(src, dst, res);
imshow("AND", res);
("hold", res);
waitKey(0);
return (0);

}

Can u guys help me?

2016-01-05 03:58:08 -0600 asked a question Lightness and Contrast

Hi you all. I have this image (as e.g.)image description

and i need to apply Lightness (NOT BRIGHTNESS) and Contrast as i did in gimp: Lightness Contrast

I have managed, not fully what i want but sort of, the contrast already, but i'm struggling with the Lightness. So i now that i have to put -100 lightness in all images, but how to i do lightness in opencv? And no i didn't found anything about lightness in purpose. I have tested this piece of code usign hsv and hsl as i was trying to set it at the pixel

cvtColor(img, img, CV_BGR2HSV);
Vec3b pixel;
for (int y = 0; y < img.rows; y++) {
    for (int x = 0; x < img.cols; x++) {
        pixel = img.at<cv::Vec3b>(y, x); // read current pixel
        double H = pixel.val[0];
        double S = pixel.val[1];
        double V = pixel.val[2];
        h = H;
        l = (2 - S) * V;
        s = s * V;
        s /= (l <= 1) ? (l) : 2 - (l);
        l /= 2;

        l = lightness;


        H = h;
        l *= 2;
        s *= (l <= 1) ? l : 2 - l;
        V = (l + s) / 2;
        S = (2 * s) / (l + s);

        pixel.val[0] = H;
        pixel.val[1] = S;
        pixel.val[2] = V;
        img.at<cv::Vec3b>(y, x) =  pixel;
    }
}

but the result wasn't what i need.

So, anyone can give me a little help?