slicing image by histogram
1 回表示 (過去 30 日間)
古いコメントを表示
Hi I have image of connected text I was trying to use histogram vlues to segment it/slice it. Basicaly im=imread('test.jpg') 1. take histogram of the test image 2. slice/segment the image wherever the value of histogram is below certain number what would be the best way to do that? thanks
0 件のコメント
回答 (2 件)
Image Analyst
2012 年 2 月 10 日
See my BlobsDemo tutorial on this topic:
Basically
binaryImage = grayImage >= lowThreshold & grayImage <= HighThreshold;
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'all');
You supply values for lowThreshold and highThreshold of course.
0 件のコメント
Tarik Razak
2012 年 2 月 10 日
1 件のコメント
Image Analyst
2012 年 2 月 11 日
regionpropos() is not a function. Try regionprops() like I suggested. ALso make sure your image is grayscale:
[rows columns numberOfColorChannels] = size(grayImage);
if numberOfColorChannels > 1
grayImage = grayImage(:,:,2); % Take green channel only
% grayImage = rgb2gray(grayImage); % Alternative, weighted average of RG&B
end
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!