Trying to count the number of pixels in an image over a specific RBG value
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to count the number of pixels in an image over a specific RBG value by going pixel by pixel and sorting the desired pixels in a varaibale (z). My goal is to then print the number of pixels in the image.
My main issue, however, seems to be that sorting all 1.92 million pixels in a JPG image is too much for my computer to handle.
I am wondering if there is a better way to do / think about his problem / something I'm missing that would make this code work.
function results = darkArea(im)
im = rgb2gray(im);
imstd = stdfilt(im,ones(27));
z = zeros(1,numel(imstd));
for i = 1:numel(imstd)
if im(i) <= 90
z(i) = [];
end
area = numel(z);
results.area = area;
end
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!