how can i run multiple mfile over an image?
2 views (last 30 days)
Show older comments
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.)
Accepted Answer
Image Analyst
on 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);
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!