0
晚上好,需要一些幫助與openCV獲得rgb像素的正方形區域 我試圖從屏幕中心的50x50區域獲取像素,但我沒有得到任何成功。 如果我使用的輸出我沒有得到其他任何像素,如果使用原來的墊(圖)招收到右上角 請別人幫Android OpenCV創建矩形
@Override
public void onPreviewFrame(Mat image) {
int w = image.cols();
int h = image.rows();
Mat roi=new Mat(image, new Rect(h/2 , w/2 , 50, 50));
Mat output = roi.clone();
int rw=output.cols();
int rh=output.rows();
//double [] arrp = output.get(rh, rw);//if i use the output i dont get any pixel
double [] arrp = image.get(rh, rw);//if use original mat its getting the top corner
Log.i("",+(int)arrp[2]+" "+ (int)arrp[1]+" "+(int)arrp[0]);
}