I have drawn a star on a image and i want to crop that star region alone. How to do it?
Use max() and min() to find the extremes of the coordinates you drew. Then you can create a box and use imcrop(). You know that cropping gives you a matrix which is a rectangular shape, right?
poly2mask() and use the resulting mask to extract pixels from the image. You will probably also want to calculate the bounding box of the mask and create a rectangular area that size to store the extracted pixels in (as it is not possible to have a matrix which is an irregular shape.)