How to use regionprops in matlab?

2 views (last 30 days)
I have writen a code like this to calculate the mean intensity of my masked image, but it keeps having errors saying that 'regionprops' require Image Process Toolbox.
May I ask what went wrong with this code?
  8 Comments
Walter Roberson
Walter Roberson on 24 Nov 2019
This is what it should look like if you have the software installed:
>> ver('images')
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.7.0.1216025 (R2019b) Update 1
MATLAB License Number: XXXXXXX
Operating System: Mac OS X Version: 10.13.6 Build: 17G9016
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
Image Processing Toolbox Version 11.0 (R2019b)
If you do not see the Image Processing Toolbox line then you do not have the software installed.
In the command window click on Add-Ons -> Get Add-Ons . In the window that comes up ask to search for Image Processing Toolbox. Click on the first result. In the detailed page that comes up, over to the right hand side near the top, click on Install .
Note: you will be required to shut down MATLAB for the install to proceed.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 24 Nov 2019
Try this:
% Check that user has the specified Toolbox installed and licensed.
hasLicenseForToolbox = license('test', 'image_toolbox'); % Check for Image Processing Toolbox.
% hasLicenseForToolbox = license('test','Statistics_toolbox'); % Check for Statistics and Machine Learning Toolbox.
% hasLicenseForToolbox = license('test','Signal_toolbox'); % Check for Signal Processing Toolbox.
% hasLicenseForToolbox = license('test', 'video_and_image_blockset'); % Check for Computer Vision System Toolbox.
if ~hasLicenseForToolbox
% User does not have the toolbox installed, or if it is, there is no available license for it.
% For example, there is a pool of 10 licenses and all 10 have been checked out by other people already.
ver % List what toolboxes the user has licenses available for.
message = sprintf('Sorry, but you do not seem to have the Image Processing Toolbox.\nDo you want to try to continue anyway?');
reply = questdlg(message, 'Toolbox missing', 'Yes', 'No', 'Yes');
if strcmpi(reply, 'No')
% User said No, so exit.
return;
end
end

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing 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!