Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 353

Cropping a portion from a Mat image.

$
0
0
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:![image description](/upfiles/1481091710337959.png) Please tell where I'm going wrong?? Thanks in advance.

Viewing all articles
Browse latest Browse all 353

Latest Images

Trending Articles



Latest Images