Skip to content

Commit

Permalink
Match OpenCV to grayscale algorithm, deepjavalibrary#964
Browse files Browse the repository at this point in the history
Change-Id: I3e7ae2731d4ad36e3cbe27ec4a2ebd0bc3749ccd
  • Loading branch information
frankfliu committed May 18, 2021
1 parent c17c15a commit 48d9fbf
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public NDArray toNDArray(NDManager manager, Flag flag) {
int blue = rgb & 0xFF;

if (flag == Flag.GRAYSCALE) {
int gray = (red + green + blue) / 3;
int gray = Math.round(0.299f * red + 0.587f * green + 0.114f * blue);
bb.put((byte) gray);
} else {
bb.put((byte) red);
Expand Down

0 comments on commit 48d9fbf

Please sign in to comment.