counting pixel of an image?

2 visualizzazioni (ultimi 30 giorni)
vishnu
vishnu il 28 Feb 2012
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 Commento
vishnu
vishnu il 29 Feb 2012
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 ...

Accedi per commentare.

Risposta accettata

Image Analyst
Image Analyst il 29 Feb 2012
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 Commenti
Image Analyst
Image Analyst il 22 Dic 2017
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 il 23 Feb 2018
Modificato: Madhava Teja Munagala il 23 Feb 2018
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

Accedi per commentare.

Più risposte (1)

Image Analyst
Image Analyst il 28 Feb 2012
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.

Categorie

Scopri di più su Denoising and Compression in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by