How can I pick all RGB values inside a region of interest?
6 views (last 30 days)
Show older comments
Tweety on 8 Dec 2015
Commented: Image Analyst on 23 Sep 2018
I define the region of interest by h = imfreehand. After that I need to pick all the RGB values inside the specified region.
Arnab Sen on 28 Dec 2015
From your description my understanding is you would like to select a region of your interest and then to get the pixel value of all the points bounded by the region. You can create a binary mask for the bounded region of interest and then get all the coordinates. Finally we can get all the pixel of that region using the function 'impixel'.
The following code illustrates how to achieve this:
For more details the functions 'createMask' and 'impixel', refer to the following links:
Image Analyst on 23 Sep 2018
Get the values from your image with a mask:
[rows, columns] = size(grayImage);
mask = poly2mask(x, y, rows, columns);
imageValues = grayImage(mask);
More Answers (1)
Find more on Region and Image Properties in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!