Hello All...I am building an application (in Android using OpenCV library) in which cropping a portion from a Mat type image is required. When I'm running the application it's getting crashed by throwing NullPointerException. My code is as follows:
nim = Highgui.imread(fpath+"/new/frame" +i+ ".jpg");
Rect roi = new Rect(x, y, width, height);
Mat cropped = new Mat(nim, roi);
Imgproc.cvtColor(cropped, gray, Imgproc.COLOR_RGB2GRAY);
Here x=120, y=120, height=351, width=481; The correspoding logcat is shown below:
Please tell where I'm going wrong??
Thanks in advance.
↧