Ask Your Question
0

How to get the size or area of a contour upon touch

asked 2013-07-29 10:13:24 -0600

brianmuks gravatar image

updated 2013-07-31 19:46:11 -0600

I am new to openCV functionality , I need help on how I can get the size of the contour and if possible crop the touched part and save.I have checked for the solution on Google as well as StackOverFlow. Any link to a tutorial will be highly appreciated.

UPDATE: I am using the color-blob detector sample code,Please help.I have tried this:

  List<MatOfPoint> con = mDetector.getContours();
  double size = Imgproc.contourArea((Mat) con);

  String Stringsize =Double.toString(size);
  Toast.makeText(this, Stringsize, Toast.LENGTH_SHORT).show();
edit retag flag offensive close merge delete

Comments

2

describing, how far you are, and what you tried would be very helpful, (mentioning, you did not find a readymade anywhere is NOT)

berak gravatar imageberak ( 2013-07-29 10:49:35 -0600 )edit

Like @berak said, there won't be a ready to use solution on the net available. You will have to reason and think for yourself. If I was you I would start by looking how to capture mouse activity with openCV. Just a simple search on this forum will already give you the answer.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-01 02:33:39 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
3

answered 2013-08-01 03:11:26 -0600

berak gravatar image

ah, if you're starting from the colorblob sample, you're actually pretty close already ;)

you just take the boundingRect from your contour, extract the submat from your image, and imwrite that to sdcard.

don't forget the write permission!

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-07-29 10:13:24 -0600

Seen: 1,143 times

Last updated: Aug 01 '13