"Undefined function or variable 'drawfreehand'." All ROI functions don't work.

When I try any sort of ROI(region of interest) function such as h = drawfreehand, after opening up an image like the examples I saw, it says "Undefined function or variable 'drawfreehand'." Why does it appear that I cannot use any of these functions. I have Image processing toolbox installed, and I'm using Matlab R2018a
im = imread('ex.png');
>> imshow(im)
>> h = drawassisted;
% Undefined function or variable 'drawassisted'.

更多回答(2 个)

You probably don't have the toolbox function on your matlab path. Go to the primary folder where the toolbox functions are stored, copy the path and then add that path and all subfolders to the matlab path.
For example,
addpath(genpath('C:\Users\name\Documents\MATLAB\toolboxes\ROI'))

3 个评论

I found the path that image processing toolbox is stored and I added that path using the example code you gave. The function still does not work. In this primary folder, I also can find no folder or any files (there's a lot, so I could have missed it) that have the drawfreehand or drawassisted functions or anything like these functions (i.e any ROI). I also searched it in the folder and the only draw-type files that came up were .png's, not functions. Any help would be appreciated. Maybe I could find the actual function by matlab and just create it?
Also, I can use other functions that are in the image proccessing toolbox just fine without adding the path or anything
It looks like those function are part of the Image Processing Toolbox listed here:
Are you sure you have that toolbox? Are you able to download the toolbox again?
User has r2018a. The roi enhancement was R2018b.

请先登录,再进行评论。

Try this:
>> which -all drawassisted
You should see:
C:\Program Files\MATLAB\R2019a\toolbox\images\imuitools\drawassisted.m
Then 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
What do you observe?

产品

版本

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by