Filter löschen
Filter löschen

how to deal unsupporeted function in matlab??

1 Ansicht (letzte 30 Tage)
yogesh nandurkar
yogesh nandurkar am 19 Nov. 2014
Kommentiert: Adam am 20 Nov. 2014
... imshow inseershape imopen
  2 Kommentare
Geoff Hayes
Geoff Hayes am 19 Nov. 2014
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 am 20 Nov. 2014
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....

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Adam
Adam am 19 Nov. 2014
Bearbeitet: Adam am 19 Nov. 2014
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 Kommentare
yogesh nandurkar
yogesh nandurkar am 20 Nov. 2014
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 am 20 Nov. 2014
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by