Filter löschen
Filter löschen

how can i run multiple mfile over an image?

3 Ansichten (letzte 30 Tage)
sara
sara am 25 Sep. 2014
Kommentiert: sara am 25 Sep. 2014
I have 4 mfile,first I used im2bw and threshold the image,then I used the image result of im2bw in another mifle which labeled regions,then I save the result as jPG and used it in another mfile and find regions under 50000 area,then I used the result image which I saved as jpg in harris corner detection and find some corners,now can I do all these in one program,i mean first read the image,then find area under forexample 50000 and then lable it again and find corners,.?forexample here when I use first mfile which is im2bw in the second mfile which finds area<5000 it gives me this error: (i=imread('...'); I = im2bw(i,.64) m=rgb2gray(I); figure, imshow(m) BW = im2bw(m, graythresh(m)); CC = bwconncomp(BW); L = labelmatrix(CC);....) ERROR:(Error using rgb2gray>parse_inputs (line 80) MAP must be a m x 3 array.)

Akzeptierte Antwort

Image Analyst
Image Analyst am 25 Sep. 2014
Try calling rgb2gray after imread() but before im2bw().
originalImage = imread('...');
[rows, columns, numberOfColorChannels] = size(originalImage)
if numberOfColorChannels > 1
originalImage = rgb2gray(originalImage );
end
binaryImage = im2bw(originalImage, .64)
m=rgb2gray(binaryImage);
  1 Kommentar
sara
sara am 25 Sep. 2014
thank you so much,.i should read it,.and work on it,.thanx,.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by