1 | initial version |
I'm unable to figure out a proper threshold value(this is an experimental value) in order to get the co-ordinates of images on the screen multiple times. So I can't use template match/TM_SQDIFF. I guess i'll have to stick with the approach you have given.
Having said that I’m facing another issue. Consider this as my template image and source image respectively.
With your approach I’m able to identify the images on the right. That is top-right has an index 1 and bottom-right has an index 2.
The image on the left is a bit different from the others. (Was able to see the difference only when I zoomed in to 800%)!! (Highlighted the differences)
Ideally, i should be able to identify all the 3 images. Is there a way in which I can identify the image on the left as well with the current approach? I would like to know if there's some way where in we can avoid the differences before we do the matching.
2 | No.2 Revision |
I'm unable to figure out a proper threshold value(this is an experimental value) in order to get the co-ordinates of images on the screen multiple times. So I can't use template match/TM_SQDIFF. I guess i'll have to stick with the approach you have given.
Having said that I’m facing another issue. Consider this as my template image and source image respectively.
With your approach I’m able to identify the images on the right. That is top-right has an index 1 and bottom-right has an index 2.
The image on the left is a bit different from the others. (Was able to see the difference only when I zoomed in to 800%)!! (Highlighted the differences)
Ideally, i should be able to identify all the 3 images. Is there a way in which I can identify the image on the left as well with the current approach? I would like to know if there's some way where in we can avoid the differences before we do the matching.
UPDATE: Tried your suggestion .Unable to get the co-ordinates of other similar images on the screen
Imgproc.matchTemplate(sourceGrayed, templateGrayed, resultMatrix, Imgproc.TM_SQDIFF_NORMED);
// Core.normalize(resultMatrix, resultMatrix, 0, 1, Core.NORM_MINMAX,
// -1);
Imgproc.threshold(resultMatrix, resultMatrix, 0, 1, Imgproc.THRESH_TOZERO);
while (true) {
MinMaxLocResult mmr = Core.minMaxLoc(resultMatrix);
Point matchLoc;
matchLoc = mmr.minLoc;
if (mmr.minVal <= 1.0) {
Imgproc.rectangle(templateGrayed, matchLoc,
new Point(matchLoc.x + sourceGrayed.cols(), matchLoc.y + sourceGrayed.rows()),
new Scalar(0, 255, 0));
Imgproc.rectangle(resultMatrix, matchLoc,
new Point(matchLoc.x + sourceGrayed.cols(), matchLoc.y + sourceGrayed.rows()),
new Scalar(0, 255, 0), -1);
mmrList.add(mmr)
;
3 | No.3 Revision |
I'm unable to figure out a proper threshold value(this is an experimental value) in order to get the co-ordinates of images on the screen multiple times. So I can't use template match/TM_SQDIFF. I guess i'll have to stick with the approach you have given.
Having said that I’m facing another issue. Consider this as my template image and source image respectively.
With your approach I’m able to identify the images on the right. That is top-right has an index 1 and bottom-right has an index 2.
The image on the left is a bit different from the others. (Was able to see the difference only when I zoomed in to 800%)!! (Highlighted the differences)
Ideally, i should be able to identify all the 3 images. Is there a way in which I can identify the image on the left as well with the current approach? I would like to know if there's some way where in we can avoid the differences before we do the matching.
UPDATE: Tried your suggestion .Unable to get the co-ordinates of other similar images on the screen
Imgproc.matchTemplate(sourceGrayed, templateGrayed, resultMatrix, Imgproc.TM_SQDIFF_NORMED);
// Core.normalize(resultMatrix, resultMatrix, 0, 1, Core.NORM_MINMAX,
// -1);
Imgproc.threshold(resultMatrix, resultMatrix, 0, 1, Imgproc.THRESH_TOZERO);
while (true) {
MinMaxLocResult mmr = Core.minMaxLoc(resultMatrix);
Point matchLoc;
matchLoc = mmr.minLoc;
if (mmr.minVal <= 1.0) {
Imgproc.rectangle(templateGrayed, matchLoc,
new Point(matchLoc.x + sourceGrayed.cols(), matchLoc.y + sourceGrayed.rows()),
new Scalar(0, 255, 0));
Imgproc.rectangle(resultMatrix, matchLoc,
new Point(matchLoc.x + sourceGrayed.cols(), matchLoc.y + sourceGrayed.rows()),
new Scalar(0, 255, 0), -1);
mmrList.add(mmr)
mmrList.add(mmr);
;
4 | No.4 Revision |
I'm unable to figure out a proper threshold value(this is an experimental value) in order to get the co-ordinates of images on the screen multiple times. So I can't use template match/TM_SQDIFF. I guess i'll have to stick with the approach you have given.
Having said that I’m facing another issue. Consider this as my template image and source image respectively.
With your approach I’m able to identify the images on the right. That is top-right has an index 1 and bottom-right has an index 2.
The image on the left is a bit different from the others. (Was able to see the difference only when I zoomed in to 800%)!! (Highlighted the differences)
Ideally, i should be able to identify all the 3 images. Is there a way in which I can identify the image on the left as well with the current approach? I would like to know if there's some way where in we can avoid the differences before we do the matching.
UPDATE:
Tried your suggestion .Unable to get the co-ordinates of other similar images on the screenscreen. (Also tried other Thresholding methods TRUNC,BINARY)
Imgproc.matchTemplate(sourceGrayed, templateGrayed, resultMatrix, Imgproc.TM_SQDIFF_NORMED);
// Core.normalize(resultMatrix, resultMatrix, 0, 1, Core.NORM_MINMAX,
// -1);
Imgproc.threshold(resultMatrix, resultMatrix, 0, 1, Imgproc.THRESH_TOZERO);
while (true) {
MinMaxLocResult mmr = Core.minMaxLoc(resultMatrix);
Point matchLoc;
matchLoc = mmr.minLoc;
if (mmr.minVal <= 1.0) {
Imgproc.rectangle(templateGrayed, matchLoc,
new Point(matchLoc.x + sourceGrayed.cols(), matchLoc.y + sourceGrayed.rows()),
new Scalar(0, 255, 0));
Imgproc.rectangle(resultMatrix, matchLoc,
new Point(matchLoc.x + sourceGrayed.cols(), matchLoc.y + sourceGrayed.rows()),
new Scalar(0, 255, 0), -1);
mmrList.add(mmr);
5 | No.5 Revision |
I'm unable to figure out a proper threshold value(this is an experimental value) in order to get the co-ordinates of images on the screen multiple times. So I can't use template match/TM_SQDIFF. I guess i'll have to stick with the approach you have given.
Having said that I’m facing another issue. Consider this as my template image and source image respectively.
With your approach I’m able to identify the images on the right. That is top-right has an index 1 and bottom-right has an index 2.
The image on the left is a bit different from the others. (Was able to see the difference only when I zoomed in to 800%)!! (Highlighted the differences)
Ideally, i should be able to identify all the 3 images. Is there a way in which I can identify the image on the left as well with the current approach? I would like to know if there's some way where in we can avoid the differences before we do the matching.
UPDATE:
UPDATE:
Tried your suggestion .Unable to get the co-ordinates of other similar images on the screen. (Also tried other Thresholding methods TRUNC,BINARY) TRUNC,BINARY). Able to get the co-ordinates for the top-right image.
Imgproc.matchTemplate(sourceGrayed, templateGrayed, resultMatrix, Imgproc.TM_SQDIFF_NORMED);
// Core.normalize(resultMatrix, resultMatrix, 0, 1, Core.NORM_MINMAX,
// -1);
Imgproc.threshold(resultMatrix, resultMatrix, 0, 1, Imgproc.THRESH_TOZERO);
while (true) {
MinMaxLocResult mmr = Core.minMaxLoc(resultMatrix);
Point matchLoc;
matchLoc = mmr.minLoc;
if (mmr.minVal <= 1.0) {
Imgproc.rectangle(templateGrayed, matchLoc,
new Point(matchLoc.x + sourceGrayed.cols(), matchLoc.y + sourceGrayed.rows()),
new Scalar(0, 255, 0));
Imgproc.rectangle(resultMatrix, matchLoc,
new Point(matchLoc.x + sourceGrayed.cols(), matchLoc.y + sourceGrayed.rows()),
new Scalar(0, 255, 0), -1);
mmrList.add(mmr);