Getting the matrix of Mat type image
I m doing an image processing using opencv java. I threshold the image to detect red colour and now I want to get the matrix of destination as a printed value. My codes can be presented as follows.
Mat source = Imgcodecs.imread("C:\\Users\\My Kindom\\Desktop\\hsv.jpg",Imgcodecs.CV_LOAD_IMAGE_COLOR);
Mat destination = new Mat(source.rows(),source.cols(),source.type());
destination = source;
Scalar lowerb=new Scalar (170,50,50);
Scalar upperb=new Scalar (180,255,255);
Core.inRange(source, lowerb, upperb, destination);
Imgcodecs.imwrite("C:\\Users\\My Kindom\\Desktop\\ThreshZero.jpg", destination);
for(int i=0;i<destination.rows();i++){
for(int j=0;j<destination.cols();j++){
System.out.println(destination.row(),destination.cols());
}
}