1

Given this image:

enter image description here

How can I extract the 'rectangle' my arm is holding up? I know about closing, dilation and erosion etc but I still manage to get artefacts of my hand included after filtering.

The size of that rectangle can vary due to varying distance if the camera.

I am using emgucv:

CvInvoke.Threshold(MyImage, MyImage, 10d, 255, ThresholdType.Binary);
var element = CvInvoke.GetStructuringElement( ElementShape.Cross, new Size( 3, 3 ), new Point( -1, -1 ) );     
CvInvoke.Erode( Threshold, Threshold, element, new Point( -1, -1 ), 1, BorderType.Reflect, default(MCvScalar) );

... and I would like image to 'roughly' look like this:

enter image description here

Any ideas?

Andrew Simpson
  • 263
  • 4
  • 15
  • 1
    Can you define which rectangle you actually would like to get? (because I honestly don't know which) – Marcus Müller Feb 12 '19 at 12:55
  • @m +1 for helping me to improve my question – Andrew Simpson Feb 12 '19 at 13:29
  • ah nice; hm, in that case, maybe try finding corners, e.g. through Hough transforms on the edges? – Marcus Müller Feb 12 '19 at 13:33
  • yes, that was where my mind was going to. I could iterate through each point of contours and then see the pattern of alignment and of width. I was concerned I was taking the long way round (my biggest bad habit) so, wanted to see if there was a better way through morphological functions. I will post back if I solve for other people. Off to gym :) – Andrew Simpson Feb 12 '19 at 13:36

0 Answers0