Clear Filters
Clear Filters

what does count pixel =0 indicates?

1 view (last 30 days)
yasmin ismail
yasmin ismail on 13 Jul 2023
Moved: Voss on 31 Jul 2023
After I applied stretching method and try to find threshold I got zero at count pixels as shown in image , what does it means and it happens only when I used png format or tif, while jpg I got concve curve for threshold.
My model is working well even with this fixed line but I want know why it happens and what does it means?

Answers (2)

DGM
DGM on 14 Jul 2023
Edited: DGM on 14 Jul 2023
I don't know what app this is, and I don't know what the image is or how it has been processed, so I'm going to have to assume some things.
  1. I assume that the thresholding is not inclusive of the specified lower boundary (i.e. >, not >=)
  2. I assume that the image is binarized full-scale uint8
Given #2, all pixels should be either 0 or 255. There should be zero pixels which are between (but not equal to) the specified thresholds, so the result should be black.
The reason the JPG image gives results is because it has damaged the image.
Even if the image is not strictly binarized, JPG will still alter values, leading to different results.
If my assumptions are incorrect, feel free to clarify.
  2 Comments
DGM
DGM on 14 Jul 2023
Ah. Then the lower test is inclusive of 0. I didn't notice that was an empty histogram. I don't know how OP would get that, even from an improperly-scaled image.

Sign in to comment.


Image Analyst
Image Analyst on 14 Jul 2023
It looks like your input image is practically binary already, because there is no histogram shown in the plot. Is it already binary? If so, you don't want to threshold it again. What is the input image's class? Logical, uint8, or double? Regardless the histogram y axis should show something, not -1 to 1.
Please attach the image just before you pass it in to my thresholding program so I can check to make sure everything is working normally. The app should work with any class of variable, e.g. uint8, double, etc.
  12 Comments
yasmin ismail
yasmin ismail on 31 Jul 2023
Moved: Voss on 31 Jul 2023
and this comment to binarize the image
stretched_Image(stretched_Image == 255) = 0;
?
Image Analyst
Image Analyst on 31 Jul 2023
Moved: Voss on 31 Jul 2023
That creates a logical image of where stretched_Image equals 255 and then it sets all those pixel locations to a value of 0.
Again, never save images to JPG, as Walter said, because it corrupts the image and generates noisy artifacts.
Not sure what "stretched" means but if you did something like imadjust before continuing to process the image, that is almost always unneeded and just slows down the process. If you do something like binarize the image, the threshold will be found and the image will get binarized correctly regardless if you stretched the contrast or not, so might as well save time and not do it.

Sign in to comment.

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!