1 | initial version |
the fastest way is not accessing single bytes.
please use:
Mat bgr = ...; // your input
Mat gray = new Mat();
cvtColor( bgr, gray, Imgproc.COLOR_BGR2GRAY);
http://docs.opencv.org/java/org/opencv/imgproc/Imgproc.html#cvtColor(org.opencv.core.Mat,%20org.opencv.core.Mat,%20int)
2 | No.2 Revision |
the fastest way is not accessing single bytes.
please use:
Mat bgr = ...; // your input
Mat gray = new Mat();
cvtColor( Imgproc.cvtColor( bgr, gray, Imgproc.COLOR_BGR2GRAY);
http://docs.opencv.org/java/org/opencv/imgproc/Imgproc.html#cvtColor(org.opencv.core.Mat,%20org.opencv.core.Mat,%20int)
3 | No.3 Revision |
the fastest way is not accessing single bytes.bytes at all.
please use:
Mat bgr = ...; // your input
Mat gray = new Mat();
Imgproc.cvtColor( bgr, gray, Imgproc.COLOR_BGR2GRAY);
http://docs.opencv.org/java/org/opencv/imgproc/Imgproc.html#cvtColor(org.opencv.core.Mat,%20org.opencv.core.Mat,%20int)
4 | No.4 Revision |
the fastest way is not accessing single bytes at all.
please use:
Mat bgr = ...; // your input
Mat gray = new Mat();
Imgproc.cvtColor( bgr, gray, Imgproc.COLOR_BGR2GRAY);
http://docs.opencv.org/java/org/opencv/imgproc/Imgproc.html#cvtColor(org.opencv.core.Mat,%20org.opencv.core.Mat,%20int)
[edit]
if you ever must access bytes, at least put/get the whole batch:
byte[] bytes = new byte[ mat.total() * mat.elemSize() ];
mat.get(0,0, bytes);
// ...
mat.put(0,0, bytes);