Azzera filtri
Azzera filtri

error to display image

8 visualizzazioni (ultimi 30 giorni)
Lidank Abiel
Lidank Abiel il 30 Giu 2013
This error message ' MAP must be a m x 3 array ' when i want to process it to gray. I got the image by capture from webcam and want to display it to axes. Can someone tell me, what should i do to fix it ?
thank you

Risposte (2)

Image Analyst
Image Analyst il 30 Giu 2013
You're passing it a colormap that is not correct. Try something like this:
snappedImage = getsnapshot(vidobj);
snappedImage = rgb2gray(snappedImage); % Convert from RGB to grayscale.
imshow(snappedImage);
colormap(gray(256));
colorbar;
  1 Commento
Lidank Abiel
Lidank Abiel il 1 Lug 2013
it still didn't work sir. error message appear again. i make 2 button function, first to capture image :
global vid capture
capture = getsnapshot(vid);
axes(handles.axes3);
axis off
imshow(capture);
second, button function to process it to gray :
global capture
global citra
if capture == 1
I = rgb2gray(capture);
else
I = rgb2gray(citra);
end
colormap(gray(256));
colorbar;
BW = tampung;
BW = im2bw(BW);
.....

Accedi per commentare.


Nitin
Nitin il 1 Lug 2013
If you are reading direclty from a video, you should probably use the step function:
For example:
filename = 'shaky_car.avi';
hVideoSrc = vision.VideoFileReader(filename, 'ImageColorSpace', 'Intensity');
imgA = step(hVideoSrc); % Read first frame into imgA
otherwise you might extract all the frames to a folder and load them using imread
  2 Commenti
Lidank Abiel
Lidank Abiel il 1 Lug 2013
No, i'm not take to a video.
Lidank Abiel
Lidank Abiel il 1 Lug 2013
sometimes, the error message like this :
??? Error using ==> regionprops>ParseInputs at 1112
Size of I doesn't match size information found in the
first input argument.
Error in ==> regionprops at 154
[I,requestedStats,officialStats] = ParseInputs(imageSize,
varargin{:});
Error in ==> tes>FinalProcess_Callback at 182
s = regionprops(BW, I,
{'Centroid','WeightedCentroid'}); %untuk
penghitungan properti objek menggunakan nilai
pixel dari gambar gray
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> tes at 17
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)tes('FinalProcess_Callback',hObject,eventdata,guidata (hObject))
??? Error while evaluating uicontrol Callback

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by