MATLAB Answers

Cutting an image through its boundaries

2 views (last 30 days)
Carlos Correia
Carlos Correia on 21 Mar 2020
Answered: Prabhan Purwar on 27 Mar 2020
Hello, I'm a student working on my first image processing project and there is one question that has bugged me for a while.
I have this image that I'm suposed to process (https://imgur.com/a/c6k6yr3), and at first, I want to extract the elements to individual figures/images. I can do it easily using bwlabel ans regionprops.BoundingBox / imcrop in a for cicle for each N elements (https://imgur.com/a/ivkentP).
But with this methodology the rotaded elements are not extrated the way I want them to...I've tried also define the boundaries by using bwboudaries in a similar element-by-element analisys in a for cycle (https://imgur.com/a/aHaKtJZ) but then I can't find any way to 'cut' the image through those boundaries. Does anyone has some tips that can help me?
PS: I'm new here, so I'm not sure if I've given you enough information, but if I didn't please correct me.
Best regards,
Carlos M. Correia

  0 Comments

Sign in to comment.

Answers (1)

Prabhan Purwar
Prabhan Purwar on 27 Mar 2020
Hi,
After definning the boundaries using bwboudaries() try making use of poly2mask() under the for loop to crop out the interested region in image. In order to rotate the image make use of imrotate(). Get the edge points in resulted image using max and min value of the boundary and calculate the angle between the x-axis and line connecting the mid-points of the bounding box (as shown).
Hope it helps!!
Following links may help:

  0 Comments

Sign in to comment.

Categories


Translated by