title: Find mean of pixels within a contour/patch matlab
body: <p>I am trying to get a significance map based on saliency, for which I have to segment image based on graph cut and find the average saliency with each patch. I was able to segment the image, and obtain contours and the saliency of the original image. The contours show the map of the segmented image. The images are shown below.</p>
  
  <p><img src="https://i.stack.imgur.com/Yz4h5.png" alt="The saliency map"></p>
  
  <p><img src="https://i.stack.imgur.com/wVzil.png" alt="The contour"></p>
  
  <p>I am trying to get the values of the saliency within each patch or contour and get its average. After coming this far, am sllightly stumped, as am not able to think of a clear and easy way of doing this. I checked about activecontour in matlab, but that function seems to do something different. Basically, I would require reference of each patch. Please help me in solving this. : How do I get the average saliency values from the original image (1st one), within the contour maps specified by image 2?</p>
  
  <p>Thanks in advance.</p>
  
  <p>Edit : </p>
  
  <p>By patch, I mean each closed contour region.</p>