this is my code
s1 = serial('COM3');
fopen(s1)
fprintf(s1, '*IDN?');
idn = fscanf(s1);
fclose(s1);
if idn == 'a'
vid = videoinput('winvideo',1);
src = getselectedsource(vid);
vid.FramesPerTrigger = 1;
preview(vid);
vid.ReturnedColorspace = 'rgb';
im1=getsnapshot(vid);
preview(vid);
closepreview(vid);
stop(vid);
e=imshow(im1);
else
f = errordlg('The phone was not used', 'Recorded status');
end
imwrite(im1, fullFileName);
grayImage = rgb2gray(im1);
meanGL = meann2(grayImage);
if meanGL < 20 % or whatever.
warningMessage = sprintf('Something is wrong.\nThe image is too dark.\nThe
mean intensity is only %.1f gray levels', meanGL);
uiwait(warndlg(warningMessage));
end
inwrite(im1,fullFileName) ;
this is my code ..but it give an error in the line of
and in line of meann2(grayimage)
the error is
Undefined function 'meann2' for input arguments of type 'uint8'.
Error in InProcessing (line 21)
meanGL = meann2(grayImage);
------------------------------------------
Warning: Image is too big to fit on screen; displaying at 67%
> In imuitools\private\initSize at 72
In imshow at 259 In InProcessing at 16 Undefined function or variable 'fullFileName'.
Error in InProcessing (line 19)
imwrite(im1, fullFileName);

 채택된 답변

Mischa Kim
Mischa Kim 2014년 2월 16일

0 개 추천

Suryakanth, in the code you are showing the variable fullFileName is not defined, which is why you get an error for the command imwrite(im1, fullFileName);. So either define the variable
fullFileName = 'my_filename.jpg'; % assuming you want to save as .jpg
imwrite(im1,fullFileName);
or hard-code it:
imwrite(im1,'my_filename.jpg');

댓글 수: 3

suryakanth
suryakanth 2014년 2월 16일
but after declaring the varaible it throws an error:
-----------------------------------
Error using imwrite (line 459)
Can't open file "my_filename.jpg" for writing.
You may not have write permission.
Error in InProcessing (line 21)
imwrite(im1,fullFileName);
Mischa Kim
Mischa Kim 2014년 2월 16일
It seems like you do not have write permissions to the folder you are trying to write to. Make sure you do, otherwise, choose another folder that you have permissions for.
suryakanth
suryakanth 2014년 2월 16일
sorry !!
i dont know the which folder has that permission.
how to find it

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

태그

질문:

2014년 2월 16일

댓글:

2014년 2월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by