Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV mat.get(y,x)[0] == mat2.get(y,x)[0] returns true when false

Hello, I am comparing two mats coming from the same video source. I turned them into a gray scale image and I compared the RGB values of both using the get method with parameters (y,x), where the program draws a circle at the changed parts. However, parts of the mat where there's a definite pixel change are not being recognized. The two images below illustrate what I am talking about.

OpenCV mat.get(y,x)[0] == mat2.get(y,x)[0] returns true when false

Hello, I am comparing two mats coming from the same video source. I turned them into a gray scale image and I compared the RGB values of both using the get method with parameters (y,x), where the program draws a circle at the changed parts. However, parts of the mat where there's a definite pixel change are not being recognized. The two images below illustrate what I am talking about.

image description

image description

click to hide/show revision 3
None

updated 2019-08-11 13:56:37 -0600

berak gravatar image

OpenCV mat.get(y,x)[0] == mat2.get(y,x)[0] returns true when false

Hello, I am comparing two mats coming from the same video source. I turned them into a gray scale image and I compared the RGB values of both using the get method with parameters (y,x), where the program draws a circle at the changed parts. However, parts of the mat where there's a definite pixel change are not being recognized. The two images below illustrate what I am talking about.

image description

image description

image description

OpenCV mat.get(y,x)[0] == mat2.get(y,x)[0] returns true when false

Hello, I am comparing two mats coming from the same video source. I turned them into a gray scale image and I compared the RGB values of both using the get method with parameters (y,x), where the program draws a circle at the changed parts. pixels. However, parts of the mat where there's a definite pixel change are not being recognized. The two images below illustrate what I am talking about. image description image description

OpenCV mat.get(y,x)[0] == mat2.get(y,x)[0] returns true when false

Hello, I am comparing two mats coming from the same video source. I turned them into a gray scale image and I compared the RGB values of both using the get method with parameters (y,x), where the program draws a circle at the changed pixels. However, parts of the mat where there's a definite pixel change are not being recognized. The two images below illustrate what I am talking about. image description

image description

The point of interest is at the black line on the right hand side of the video, where there is a new "arc" about to be formed, yet there is no hint of a single pixel change in that area for some reason.

Thank you in advance!

OpenCV mat.get(y,x)[0] == mat2.get(y,x)[0] returns true when false

Hello, I am comparing two mats coming from the same video source. I turned them into a gray scale image and I compared the RGB values of both using the get method with parameters (y,x), where the program draws a circle at the changed pixels. However, parts of the mat where there's a definite pixel change are not being recognized. The two images below illustrate what I am talking about.

image description

image description

The point of interest is at the black line on the right hand side of the video, where there is a new "arc" about to be formed, yet there is no hint of a single pixel change in that area for some reason.

Thank you in advance!

OpenCV mat.get(y,x)[0] == mat2.get(y,x)[0] returns true when false

Hello, I am comparing two mats coming from the same video source. I turned them into a gray scale image and I compared the RGB values of both using the get method with parameters (y,x), where the program draws a circle at the changed pixels. However, parts of the mat where there's a definite pixel change are not being recognized. The two images below illustrate what I am talking about.

image description

image description

The point of interest is at the black line on the right hand side of the video, where there is a new "arc" about to be formed, yet there is no hint of a single pixel change in that area for some reason.

Here is a snippet of my code which shows what I am doing:

Mat previousSource = getFrame(displayPointer - 1).submat((int) dopplerPoint1.y, (int) dopplerPoint2.y, (int) dopplerPoint1.x, (int) dopplerPoint2.x);

Mat matSource = getFrame(displayPointer).submat((int) dopplerPoint1.y, (int) dopplerPoint2.y, (int) dopplerPoint1.x,(int) dopplerPoint2.x);

Imgproc.cvtColor(matSource, matSource, Imgproc.COLOR_BGR2GRAY);
Imgproc.cvtColor(previousSource, previousSource, Imgproc.COLOR_BGR2GRAY);

double[][][] previousArray = new double[previousSource.width()][previousSource.height()][3];
double[][][] nextArray = new double[matSource.width()][matSource.height()][3];

outerLoop2: for (int x = 0; x < previousArray.length; x++) {
            innerLoop2: for (int y = 0; y < previousArray[0].length; y++) {
                previousArray[x][y] = previousSource.get(y, x);
                nextArray[x][y] = matSource.get(y, x);
            }
        }

outerLoop: for (int x = 0; x < previousArray.length; x++) {
            double[] columnArray = new double[(int) matSource.height()];
            for (int filler = 0; filler < columnArray.length; filler++) {
                columnArray[filler] = new Point(x, filler).y;
            }

innerLoop: for (int y = 0; y < previousArray[0].length; y++) {
boolean compare = Arrays.equals(previousArray[x][y], nextArray[x][y]);

if (!compare) {
<- Saves the point and draws a circle at it ->
}

}

Thank you in advance!

OpenCV mat.get(y,x)[0] == mat2.get(y,x)[0] returns true when false

Hello, I am comparing two mats coming from the same video source. I turned them into a gray scale image and I compared the RGB values of both using the get method with parameters (y,x), where the program draws a circle at the changed pixels. However, parts of the mat where there's a definite pixel change are not being recognized. The two images below illustrate what I am talking about.

image description

image description

The point of interest is at the black line on the right hand side of the video, where there is a new "arc" about to be formed, yet there is no hint of a single pixel change in that area for some reason.

Here is a snippet of my code which shows what I am doing:

//From a method called read doppler which takes the submat of a video then analyzes it according to the previous frame and current frame Mat previousSource = getFrame(displayPointer - 1).submat((int) dopplerPoint1.y, (int) dopplerPoint2.y, (int) dopplerPoint1.x, (int) dopplerPoint2.x); dopplerPoint2.x);

Mat matSource = getFrame(displayPointer).submat((int) dopplerPoint1.y, (int) dopplerPoint2.y, (int) dopplerPoint1.x,(int) dopplerPoint2.x);

Imgproc.cvtColor(matSource, matSource, Imgproc.COLOR_BGR2GRAY);
Imgproc.cvtColor(previousSource, previousSource, Imgproc.COLOR_BGR2GRAY);

double[][][] previousArray = new double[previousSource.width()][previousSource.height()][3];
double[][][] nextArray = new double[matSource.width()][matSource.height()][3];

outerLoop2: for (int x = 0; x < previousArray.length; x++) {
            innerLoop2: for (int y = 0; y < previousArray[0].length; y++) {
                previousArray[x][y] = previousSource.get(y, x);
                nextArray[x][y] = matSource.get(y, x);
            }
        }

outerLoop: for (int x = 0; x < previousArray.length; x++) {
            double[] columnArray = new double[(int) matSource.height()];
            for (int filler = 0; filler < columnArray.length; filler++) {
                columnArray[filler] = new Point(x, filler).y;
            }

innerLoop: for (int y = 0; y < previousArray[0].length; y++) {
boolean compare = Arrays.equals(previousArray[x][y], nextArray[x][y]);

if (!compare) {
<- Saves the point and draws a circle at it ->
}

}

Point point = new Point(x,y); Imgproc.circle(matSource, point, 5,new Scalar(255, 255, 0), 1); }

//Code then applies the submat onto the original video with the drawn points }

Thank you in advance!

click to hide/show revision 9
None

updated 2019-08-12 09:36:25 -0600

berak gravatar image

OpenCV mat.get(y,x)[0] == mat2.get(y,x)[0] returns true when false

Hello, I am comparing two mats coming from the same video source. I turned them into a gray scale image and I compared the RGB values of both using the get method with parameters (y,x), where the program draws a circle at the changed pixels. However, parts of the mat where there's a definite pixel change are not being recognized. The two images below illustrate what I am talking about.

image description

image description

The point of interest is at the black line on the right hand side of the video, where there is a new "arc" about to be formed, yet there is no hint of a single pixel change in that area for some reason.

Here is a snippet of my code which shows what I am doing:

//From a method called read doppler which takes the submat of a video then analyzes it according to the previous frame and current frame 
    Mat previousSource = getFrame(displayPointer - 1).submat((int) dopplerPoint1.y, (int) dopplerPoint2.y, (int) dopplerPoint1.x, (int) dopplerPoint2.x);

dopplerPoint2.x);

    Mat matSource = getFrame(displayPointer).submat((int) dopplerPoint1.y, (int) dopplerPoint2.y, (int) dopplerPoint1.x,(int) dopplerPoint2.x);

 Imgproc.cvtColor(matSource, matSource, Imgproc.COLOR_BGR2GRAY);
 Imgproc.cvtColor(previousSource, previousSource, Imgproc.COLOR_BGR2GRAY);

 double[][][] previousArray = new double[previousSource.width()][previousSource.height()][3];
 double[][][] nextArray = new double[matSource.width()][matSource.height()][3];

 outerLoop2: for (int x = 0; x < previousArray.length; x++) {
             innerLoop2: for (int y = 0; y < previousArray[0].length; y++) {
                 previousArray[x][y] = previousSource.get(y, x);
                 nextArray[x][y] = matSource.get(y, x);
             }
         }

 outerLoop: for (int x = 0; x < previousArray.length; x++) {
             double[] columnArray = new double[(int) matSource.height()];
             for (int filler = 0; filler < columnArray.length; filler++) {
                 columnArray[filler] = new Point(x, filler).y;
             }

 innerLoop: for (int y = 0; y < previousArray[0].length; y++) {
 boolean compare = Arrays.equals(previousArray[x][y], nextArray[x][y]);

 if (!compare) {

Point point = new Point(x,y); Imgproc.circle(matSource, point, 5,new Scalar(255, 255, 0), 1); }

} //Code then applies the submat onto the original video with the drawn points }

}

Thank you in advance!

OpenCV mat.get(y,x)[0] == mat2.get(y,x)[0] returns true when false

Hello, I am comparing two mats coming from the same video source. I turned them into a gray scale image and I compared the RGB values of both using the get method with parameters (y,x), where the program draws a circle at the changed pixels. However, parts of the mat where there's a definite pixel change are not being recognized. The two images below illustrate what I am talking about.

image description

image description

The point of interest is at the black line on the right hand side of the video, where there is a new "arc" about to be formed, yet there is no hint of a single pixel change in that area for some reason.

Here is a snippet of my code which shows what I am doing:

//From a method called read doppler which takes the submat of a video then analyzes it according to the previous frame and current frame 
    Mat previousSource = getFrame(displayPointer - 1).submat((int) dopplerPoint1.y, (int) dopplerPoint2.y, (int) dopplerPoint1.x, (int) dopplerPoint2.x);

    Mat matSource = getFrame(displayPointer).submat((int) dopplerPoint1.y, (int) dopplerPoint2.y, (int) dopplerPoint1.x,(int) dopplerPoint2.x);

    Imgproc.cvtColor(matSource, matSource, Imgproc.COLOR_BGR2GRAY);
    Imgproc.cvtColor(previousSource, previousSource, Imgproc.COLOR_BGR2GRAY);

    double[][][] previousArray = new double[previousSource.width()][previousSource.height()][3];
    double[][][] nextArray = new double[matSource.width()][matSource.height()][3];

    outerLoop2: for (int x = 0; x < previousArray.length; x++) {
                innerLoop2: for (int y = 0; y < previousArray[0].length; y++) {
                    previousArray[x][y] = previousSource.get(y, x);
                    nextArray[x][y] = matSource.get(y, x);
                }
            }

    outerLoop: for (int x = 0; x < previousArray.length; x++) {
                double[] columnArray = new double[(int) matSource.height()];
                for (int filler = 0; filler < columnArray.length; filler++) {
                    columnArray[filler] = new Point(x, filler).y;
                }

    innerLoop: for (int y = 0; y < previousArray[0].length; y++) {
    boolean compare = Arrays.equals(previousArray[x][y], nextArray[x][y]);

    if (!compare) {
   Point point = new Point(x,y);
   Imgproc.circle(matSource, point, 5,new Scalar(255, 255, 0), 1);
    }

//Code then applies the submat onto the original video with the drawn points
    }

Thank you in advance!