MATLAB sum of pixel between 0 and 100 intensity
1 回表示 (過去 30 日間)
古いコメントを表示
Hello. I trying to generate an image into histogram and in that image i have to calculate the sum of pixels. Then after that i have to change it to grayscale but how do i calculate sum of pixel between 0 and 100 intensity of the grayscale image? I tried adding the code y=(x<=100) but the value suddenly change to binary.
ths is my code
clc;
clear;
I=imread('image.jpg');
imhist(I);
pixelCounts=imhist(I);
numberOfPixels = sum(pixelCounts)
x=rgb2gray(I);
y=(x<=100)
0 件のコメント
回答 (1 件)
KSSV
2020 年 6 月 20 日
If I is your image.
idx = I >= 0 & I <= 100 ; % this gives logical indices of the pixels present
N1 = nnz(idx(:)) ; % this gives total
N2 = sum(idx(:)) ; % this gives total
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Histograms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!