Ask Your Question

thatc0der m8's profile - activity

2017-08-05 14:50:18 -0600 commented question Finding contours in a videoCapture Java

I am not repeating it, you keep deleting it, I am looking for help. @berak

2017-08-05 14:17:53 -0600 commented question Finding contours in a videoCapture Java

how about you stop deleting my post...

2017-08-05 12:13:49 -0600 asked a question Finding contours in a videoCapture Java

A while ago I was working on a rubiks cube solver that would use a video capture and you would have to line up the cube stickers in rectangles on the video capture that I would get the colors from and use a color distance algorithm to distinguish them. I want make it better, I was thinking of finding contours of the squares and once found following the contour if it moves slightly (So like tracking). How would I go about doing this? The things I have experience are using Mat2Image, BufferedImage, CVrect and some others. How would I approach this? If you want to look at my outline I would be glad to show it. How would I be able to find squares in the video capture?

2017-08-05 12:12:44 -0600 asked a question Finding contours in a videoCapture Java

A while ago I was working on a rubiks cube solver that would use a video capture and you would have to line up the cube stickers in rectangles on the video capture that I would get the colors from and use a color distance algorithm to distinguish them. I want make it better, I was thinking of finding contours of the squares and once found following the contour if it moves slightly (So like tracking). How would I go about doing this? The things I have experience are using Mat2Image, BufferedImage, CVrect and some others. How would I approach this? If you want to look at my outline I would be glad to show it. How would I be able to find squares in the video capture?

2017-03-06 20:58:35 -0600 received badge  Enthusiast
2017-03-06 20:58:34 -0600 received badge  Enthusiast
2017-02-24 07:14:05 -0600 commented question Is the way I calculate the the HSV color channels correct?

Even after converting the image color the values still put out are RGB and not HSV, the values should be H:132, S: 76, V: 100

2017-02-24 07:11:52 -0600 commented question Is the way I calculate the the HSV color channels correct?

I pulled a darkGreen image I am reading that now.

public void splitChannels() {

        Mat firstImage = Imgcodecs.imread("darkGreen.jpg");

        int width = 20;
        int height = 20;
        Rect roi = new Rect(120, 160, width, height);
        Mat smallImg = new Mat(firstImage, roi);
        Imgproc.cvtColor(smallImg,smallImg,Imgproc.COLOR_BGR2HSV);
        List <Mat> image = new ArrayList<>(3);

        Core.split(smallImg,image);
        Mat h = image.get(0);
        Mat s = image.get(1);
        Mat v = image.get(2);


        System.out.println("Hue: \n" + h.dump());

        System.out.println("Saturation: \n" + s.dump());

The values it gives me are H:60, S:255, V:255 @berak

2017-02-24 06:59:24 -0600 commented question Is the way I calculate the the HSV color channels correct?

I do convert the image to HSV before it is read, but when I do image.get(0) the dump values look as though they are only for BGR, the numbers it gives me don't follow HSV. @berak

2017-02-23 15:27:02 -0600 commented question Is the way I calculate the the HSV color channels correct?

@berak I did what you said and the values aren't coming out right for the channels

      List <Mat> image = new ArrayList<>(3);
        Mat firstImage = Imgcodecs.imread("firstImage.jpg");

        int width = 20;
        int height = 20;
        Rect roi = new Rect(120, 160, width, height);
        Mat smallImg = new Mat(firstImage, roi);

        Core.split(smallImg,image);
        Mat h = image.get(0);
        Mat s = image.get(1);
        Mat v = image.get(2);


        System.out.println("Hue: \n" + h.dump());
2017-02-23 13:40:01 -0600 commented question Is the way I calculate the the HSV color channels correct?

Would I still be able to determine the HSV of the area of interest?

2017-02-23 13:30:58 -0600 commented question Is the way I calculate the the HSV color channels correct?

then what would you advise? @berak

2017-02-23 11:59:59 -0600 asked a question Is the way I calculate the the HSV color channels correct?

I have an HSV image and am interested in a certain part of that image and I want to determine what the Hue Saturation and Value are of that area. I have gotten image selection to work and determine the area I am interested in but I don't think the way I calculate the channels are correct. The reason being that I the portion of the image I am looking at is white in RGB scale and I know that in HSV that white has a saturation of about (0..20) and a value(230..255) but the numbers printed out by the program don't come close in that range. I get a high 40 low 50 for S and -93 mostly. Is my calculation correct ?

public void splitChannels() {

    Mat firstImage = Imgcodecs.imread("firstImage.jpg");
    int width = 20;
    int height = 20;
    Rect roi = new Rect(120, 160, width, height);
    Mat smallImg = new Mat(firstImage, roi);
    int channels = smallImg.channels();
    System.out.println("small pixels:" + smallImg.total());
    System.out.println("channels:" + smallImg.channels());
    int totalBytes = (int)(smallImg.total() * smallImg.channels());
    byte buff[] = new byte[totalBytes];
    smallImg.get(0, 0, buff);

    for (int i=0; i< height; i++) {
        // stride is the number of bytes in a row of smallImg
        int stride = channels * width;
        for (int j=0; j<stride; j+=channels) {
        //I don't know if these channels calculations are correct.
            int h = buff[(i * stride) + j];
            int s = buff[(i * stride) + j + 1]; 
            int v = buff[(i * stride) + j + 2];

            // Do something with the hsv.
            System.out.println("s: "+ s + " v: " + v);

        } 
    }
}
2017-02-22 14:34:19 -0600 commented question Getting pixels of Mat image in Java

Could you help me fix it @berak ?

2017-02-22 14:23:58 -0600 commented question Getting pixels of Mat image in Java

There are 4 regions of the image I want to determine their HSV and I am trying to do that right here, But I can't get the pixels in that region. How do I do so?

2017-02-22 14:19:26 -0600 commented question Getting pixels of Mat image in Java

I am trying to access pixels in an image I take from a video capture to determine the HSV of parts of the image. @berak

2017-02-22 14:11:44 -0600 asked a question Getting pixels of Mat image in Java

I have an Mat image that I want to loop over pixels of a certain region of that image and I am looping through the region I want but can't get individual pixel values. I want them to determine the HSV of the specified region. I found that CV_IMAGE_ELEM is used for this job in C and other languages but It isn't showing up when I use it in Java. I assume it is different in Java? How can I fix this to access individual pixel values?

public void splitChannels() {

    Imgcodecs.imread("firstImage.png");

    CvRect topLeft = new CvRect(160,120,30,30);
    for(int i = topLeft.y(); i < topLeft.y() + topLeft.height(); i++){
        for(int j = topLeft.x(); j < topLeft.x() + topLeft.width(); j++){
        Object uchar;
        CV_IMAGE_ELEM("firstImage.png", uchar, i, (j * 3) + 1);
        }
    }
}