how to deal unsupporeted function in matlab??

2 次查看(过去 30 天)
... imshow inseershape imopen
  2 个评论
Geoff Hayes
Geoff Hayes 2014-11-19
Yogesh - please provide some context/details on what you are attempting to do. What are you doing when the error (?) is being generated? If there is an error, then include the full error message in your question.
yogesh nandurkar
yogesh nandurkar 2014-11-20
i am using code generation for motion detction programm.. when i used code generation ,there is error of unsupported function like "imopen"..sir how i solve this error.below is my programm
vidDevice = imaq.VideoDevice('winvideo', 1, 'YUY2_640x480', ...
'ROI', [1 1 640 480], ...
'ReturnedColorSpace', 'rgb', ...
'DeviceProperties.Brightness', 90, ...
'DeviceProperties.Sharpness', 90);
foregroundDetector = vision.ForegroundDetector('NumGaussians', 3, ...
'NumTrainingFrames', 50);
for i = 1:150 frame = step(vidDevice); % read the next video frame foreground = step(foregroundDetector, frame);
end
se = strel('square', 3);
filteredForeground = imopen(foreground, se);
blobAnalysis = vision.BlobAnalysis('BoundingBoxOutputPort', true, ... 'AreaOutputPort', false, 'CentroidOutputPort', false, ... 'MinimumBlobArea', 150);
bbox = step(blobAnalysis, filteredForeground);
result = insertShape(frame, 'Rectangle', bbox, 'Color', 'green');
numCars = size(bbox, 1);
videoPlayer = vision.VideoPlayer('Name', 'Detected Cars');
videoPlayer.Position(3:4) = [650,400]; % window size: [width, height]
se = strel('square', 3); % morphological filter for noise removal
nFrames = 0;
while (nFrames<100)
nframe = step(vidDevice); % read the next video frame
% Detect the foreground in the current video frame
foreground = step(foregroundDetector, nframe);
% Use morphological opening to remove noise in the foreground
filteredForeground = imopen(foreground, se);
% Detect the connected components with the specified minimum area, and
% compute their bounding boxes
bbox = step(blobAnalysis, filteredForeground);
% Draw bounding boxes around the detected cars
result = insertShape(frame, 'Rectangle', bbox, 'Color', 'green');
% Display the number of cars found in the video frame
numCars = size(bbox, 1);
step(videoPlayer, result); % display the results
nFrames = nFrames + 1;
end
thanks sir....

请先登录,再进行评论。

采纳的回答

Adam
Adam 2014-11-19
编辑:Adam 2014-11-19
I assume from your tag (which ideally should just be a list of simple tags!) you are trying to use Matlab Coder.
What would you expect Matlab Coder to do with something like imshow though?
It requires graphics handling which is not part of porting code into C++ as far as I am aware. Matlab Coder is generally used for converting algorithmic code to C or C++ in order to run faster.
Matlab Compiler would allow you to build a standalone executable of your Matlab program if that is what you are wanting to do.
  2 个评论
yogesh nandurkar
yogesh nandurkar 2014-11-20
below is my programm...i have problem with imopen function .. thanks sir..
vidDevice = imaq.VideoDevice('winvideo', 1, 'YUY2_640x480', ... 'ROI', [1 1 640 480], ... 'ReturnedColorSpace', 'rgb', ... 'DeviceProperties.Brightness', 90, ... 'DeviceProperties.Sharpness', 90);
foregroundDetector = vision.ForegroundDetector('NumGaussians', 3, ... 'NumTrainingFrames', 50);
for i = 1:150 frame = step(vidDevice); % read the next video frame foreground = step(foregroundDetector, frame);
end
se = strel('square', 3);
filteredForeground = imopen(foreground, se);
blobAnalysis = vision.BlobAnalysis('BoundingBoxOutputPort', true, ... 'AreaOutputPort', false, 'CentroidOutputPort', false, ... 'MinimumBlobArea', 150);
bbox = step(blobAnalysis, filteredForeground);
result = insertShape(frame, 'Rectangle', bbox, 'Color', 'green');
numCars = size(bbox, 1);
videoPlayer = vision.VideoPlayer('Name', 'Detected Cars');
videoPlayer.Position(3:4) = [650,400]; % window size: [width, height]
se = strel('square', 3); % morphological filter for noise removal
nFrames = 0; while (nFrames<100)
nframe = step(vidDevice); % read the next video frame
% Detect the foreground in the current video frame
foreground = step(foregroundDetector, nframe);
% Use morphological opening to remove noise in the foreground
filteredForeground = imopen(foreground, se);
% Detect the connected components with the specified minimum area, and
% compute their bounding boxes
bbox = step(blobAnalysis, filteredForeground);
% Draw bounding boxes around the detected cars
result = insertShape(frame, 'Rectangle', bbox, 'Color', 'green');
% Display the number of cars found in the video frame
numCars = size(bbox, 1);
step(videoPlayer, result); % display the results
nFrames = nFrames + 1;
end
Adam
Adam 2014-11-20
imopen is listed on
as supported by Matlab Coder. I don't use the Coder yet myself although we are currently trialling it in our team so I don't really know what type of errors get thrown up or how to deal with them specifically yet.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Computer Vision with Simulink 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by