finding white pixel regions
조회 수: 1 (최근 30일)
이전 댓글 표시
I have an image,i want to split that image vertically and find which side has more white pixels,my image is binary type
댓글 수: 0
채택된 답변
Image Analyst
2012년 1월 25일
% Get the dimensions of the image.
[rows columns] = size(binaryImage);
% Find the middle column
middleColumn = columns/2;
% Count the number of 1's in each half.
leftHalfOnes = nnz(binaryImage(:,1:middleColumn))
rightHalfOnes = nnz(binaryImage(:,middleColumn+1:end))
댓글 수: 4
Image Analyst
2012년 1월 25일
Did you look for it? Did you look up near the top of this page? There are blue letters that say "File Exchange" If you can't see it, then here it is: http://www.mathworks.com/matlabcentral/fileexchange/
추가 답변 (1개)
Andrew
2012년 1월 24일
If your image is logical, then you could easily do this using the function "nnz", which gives you the number of non-zeros a matrix. Alternatively, you could just sum each side of the image if the "white pixels" are 1's.
Andrew
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!