Skip to content

Commit

Permalink
gs-cv: DF: Pass color as a parameter to addVerticalDirs
Browse files Browse the repository at this point in the history
  • Loading branch information
fducroquet committed May 3, 2018
1 parent d2c0ac2 commit 0798bae
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -86,7 +86,7 @@ protected void fillGrid(GridPane mainGrid) {
List<Integer> patchYs = imgPartition(grayFrame, nSide, .5f, true);
// Second image displayed, showing the directions for each region.
int[][] dirs = findSecondDirection(grayFrame, bin, mag, nSide, firstBin, nBin, lambda, patchXs, patchYs);
Mat imgDirs = addDirs(grayFrame, dirs, nSide, nBin, patchXs, patchYs);
Mat imgDirs = addDirs(grayFrame, dirs, nSide, nBin, patchXs, patchYs, new Scalar(0, 0, 0));
mainGrid.add(new ImageView(Tools.mat2jfxImage(grayFrame)), 0, 0);
mainGrid.add(new ImageView(Tools.mat2jfxImage(imgDirs)), 1, 0);

Expand All @@ -98,15 +98,15 @@ protected void fillGrid(GridPane mainGrid) {
}
}

public Mat addDirs(Mat img, int[][] dirs, int nSide, int nBin, List<Integer> patchXs, List<Integer> patchYs) {
public Mat addDirs(Mat img, int[][] dirs, int nSide, int nBin, List<Integer> patchXs, List<Integer> patchYs, Scalar color) {
Mat imgDirs = new Mat();
img.copyTo(imgDirs);
imgDirs.convertTo(imgDirs, CvType.CV_8SC3);
for (int j = 0; j < patchXs.size(); j++)
for (int i = 0; i < patchYs.size(); i++) {
int centerX = patchXs.get(j) + nSide / 2;
int centerY = patchYs.get(i) + nSide / 2;
Imgproc.line(imgDirs, new Point(centerX, centerY), getLineEnd(centerX, centerY, dirs[i][j], nBin, nSide / 3), new Scalar(0, 0, 0), 2);
Imgproc.line(imgDirs, new Point(centerX, centerY), getLineEnd(centerX, centerY, dirs[i][j], nBin, nSide / 3), color, 2);
}
return imgDirs;
}
Expand Down

0 comments on commit 0798bae

Please sign in to comment.