counting pixel of an image?

2 次查看(过去 30 天)
i have used the thresholding for image ..
the command is
length(find(abs(cw)<=50));
im(length(abs(cw)<=50))=0 ;
(1)for examble 42447 coeffients made to be zero out of 65656. my doubt is whether that remaing (23089 ) pixel only present in that image or else 0 will be presented for the whole 65536 ..
(2)how to count or calculate the number of pixels present in that image ?
(3)i apply the wavelet transform.. after that i apply this can i use this threshold for compression ?
pleased to ask reply from all ..
  1 个评论
vishnu
vishnu 2012-2-29
length(find(abs(cw)<=50));
cw(length(abs(cw)<=50))=0 ;
sir ,
(1)length is i calculated to know the how many pixels are present under 50 value
(2) can you explain what is the difference between pixel and coefficients and pixels
(3)after wavelet transform some pixels are made to zero with above code can i say this as compression ...

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2012-2-29
Responding to your comment
(1) The number of pixels under 50 is given more simply by
numPixelsLessThan50 = sum(sum(cw<50));
No need for find() and abs().
(2) A pixel contains the value of your image array at a certain location. I don't know what you are calling coefficients. I don't have the wavelet toolbox so I can't answer any questions about that.
(3)I don't understand what #3 is saying or asking. Something about wavelets, setting to zero, and compression but it's not clear. Ask someone else to reword it.
  6 个评论
Image Analyst
Image Analyst 2017-12-22
I'm attaching my RGB program for kmeans(). Generally I feel that kmeans is not a good method for segmentation of RGB images, but for whatever it's worth, it's attached. Don't say I didn't warn you if you don't like the results.
Example based discriminant analysis is better and I'm attaching a demo for that that uses the classify() function. There may be even better methods.
Madhava Teja Munagala
编辑:Madhava Teja Munagala 2018-2-23
Take input image, Then based on threshold Img divide into foreground and background, After find means for forground,and background,
if true
% code
end
After that compare pixel with means of both fg ang bg ,
These is concept,how to write program by using otsu 2d

请先登录,再进行评论。

更多回答(1 个)

Image Analyst
Image Analyst 2012-2-28
Why is length() in there? What are the coefficients? Do you mean pixels instead of coefficients? What is the difference between cw and im?
The number of pixels in an image is:
[rows columns numberOfColorChannels] = size(im);
numberOfPixels = rows*columns;
or
numberOfPixels = rows*columns*numberOfColorChannels;
depending on how you're defining pixel.

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by