From: Nehal on 9 Jul 2010 10:49 "Steven Lord" <slord(a)mathworks.com> wrote in message <i179rv$2up$1(a)fred.mathworks.com>... > > You have to determine that on your own; I don't know the specific details of > the procedure you're using. > > I've given you as much help as I can -- you will need to take the debugging > information I gave you and determine how to correct those problems in your > code. > > -- > Steve Lord > slord(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ > To contact Technical Support use the Contact Us link on > http://www.mathworks.com > I am not using numberOfColorBands anymore... my function is: function cropimage tifFiles = dir('Samples\*.tif'); %takes all the images from the folder Sample for k = 1:length(tifFiles) %the loop will continue for the number of images filename = tifFiles(k).name; data1 = imread(filename); % converting the grb images to gray grayImage = rgb2gray(filename); % converts gray to binary binaryImage = grayImage == 255; horizontal = any(binaryImage, 1); vertical = any(binaryImage, 2); column1 = find(horizontal, 1, 'first'); column2 = find(horizontal, 1, 'last'); row1 = find(vertical, 1, 'first'); row2 = find(vertical, 1, 'last'); xBox = [column1 column2 column2 column1 column1]; yBox = [row1 row1 row2 row2 row1]; croppedImage = binaryImage(row1:row2, column1:column2); imwrite(croppedImage,['Cropped\' filename]); end end and it is showing error: ??? Error using ==> rgb2gray>parse_inputs at 82 MAP must be a m x 3 array. Error in ==> rgb2gray at 35 X = parse_inputs(varargin{:}); Error in ==> cropimage at 10 grayImage = rgb2gray(filename); Now, what is the problem...? can u plz help me..?
From: Mark Hayworth on 9 Jul 2010 11:51 SAME problem. Same solution. Like I said before, filename is not your numerical image array, "data1" is. So, use the same fix: grayImage = rgb2gray(data1);
From: Nehal on 9 Jul 2010 12:45 "Image Analyst" <imageanalyst(a)mailinator.com> wrote in message <i17arc$4a8$1(a)fred.mathworks.com>... > "Nehal " <arnab620(a)yahoo.com> wrote in message <i1781c$7to$1(a)fred.mathworks.com>... > > how can i put the size of the image instead of the size of the filename in that place of the code...? > > and what can i do to handle numberOfColorBands equals 1 ? > > > > could u plz help me..? > ------------------------------------------------------------------------------------------ > You called your image "data1" so the correct line would be > [rows columns numberOfColorBands] = size(data1); thank you... I was so stressed that I could not notice this simple mistake... thank you once again... :)
First
|
Prev
|
Pages: 1 2 Prev: how to ignore some sampling points Next: Setting A Minimum Figure Size |