why i am getting Undefined variable error?
Ältere Kommentare anzeigen
I have a graduation project on matlab related with a bio engineering and computer engineering project. The bio engineers when make some experiments they get some images related with bacteria and they wants to me I'm writing a program in matlab and when they are loading the image from this program they are getting automatically bacteria on the image. So my project advisor said me I was need to use circle detection method, gaussian image filtering, and sharpening filtering and get the blue colored cicrcles on the image and I'm writing one demo program but it gives an error now I share you a program codes please tell me what i make a mistake or mistakes.
This is my program its name is Demo.m:
I = imread(C_Users_GOZDE_Demo.m,'images ov cells.jpg');
I = rgb2gray(I);
b = imsharpen(I);
figure, imshow(b)
title('Sharpened Image');
[centersBlue, radiiBlue] = imfindcircles(I,[20 25],'Object Polarity','blue');
h = fspecial('gaussian');
%/h = fspecial('sobel');
I2 = imfilter(I, h);
imshow(I), title('Original images ov cells');
figure, imshow(I2), title('Filtered iimages ov cells');
9 Kommentare
It would be useful, if you post the complete error message. Then the readers do not have to guess which variable is missing.
This line is strange:
I = imread(C_Users_GOZDE_Demo.m, 'images ov cells.jpg');
Maybe you mean:
I = imread('C:\Users\GOZDE\Demo\images ov cells.jpg');
???
CEM GÖKDEL
am 30 Dez. 2017
Walter Roberson
am 30 Dez. 2017
I am going to guess
I = imread('C:\Users\GOZDE\Demo\images\ov\cells.jpg');
CEM GÖKDEL
am 31 Dez. 2017
Walter Roberson
am 31 Dez. 2017
What is the exact location of your image file?
CEM GÖKDEL
am 31 Dez. 2017
Walter Roberson
am 31 Dez. 2017
Do you have a C: drive?
Do you have a folder named Users at the top level of the C drive?
Do you have a folder named GOZDE inside C:\Users?
Do you have a folder named Demo inside C:\Users\GOZDE ?
Do you have a folder named images inside C:\Users\GOZDE\Demo ?
Do you have a folder named ov inside C:\Users\GOZDE\Demo\images ?
Do you have an image file named cells.jpg inside C:\Users\GOZDE\Demo\images\ov ?
You need to tell us the complete path of the image you are trying to read. And then you need to change the line of code to read from that complete path.
Do not put data into the folder that MATLAB is installed into.
CEM GÖKDEL
am 1 Jan. 2018
CEM GÖKDEL
am 2 Jan. 2018
Antworten (1)
KALYAN ACHARJYA
am 30 Dez. 2017
Bearbeitet: KALYAN ACHARJYA
am 30 Dez. 2017
I have run it, now there is no error, Please Note there is no space between Object & Polarity, No comma in [centreBlue rediiblue], In the same line I have to change it from blue to 'dark'. Previously It showed no 'blue defined' in Matlab context, that's why I have to changed it.
I=imread('image.jpg'); % Change Image Name as per your image
I=rgb2gray(I);
b=imsharpen(I);
figure, imshow(b); title('Sharpened Image');
[centersBlue radiiBlue]=imfindcircles(I,[20 25],'ObjectPolarity','dark');
h=fspecial('gaussian');
%/h = fspecial('sobel');
I2 = imfilter(I, h);
imshow(I),
title('Original images ov cells');
figure, imshow(I2), title('Filtered images ov cells');
2 Kommentare
CEM GÖKDEL
am 30 Dez. 2017
Jan
am 30 Dez. 2017
@CEM GÖKDEL: A copy of the complete error message would be more useful than the rough rephrasing "matlab is give me an undefined variable or class error".
Kategorien
Mehr zu Environment and Settings finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!