what does count pixel =0 indicates?

3 ビュー (過去 30 日間)
yasmin ismail
yasmin ismail 2023 年 7 月 13 日
移動済み: Voss 2023 年 7 月 31 日
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?

回答 (2 件)

DGM
DGM 2023 年 7 月 14 日
編集済み: DGM 2023 年 7 月 14 日
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 件のコメント
Image Analyst
Image Analyst 2023 年 7 月 14 日
DGM
DGM 2023 年 7 月 14 日
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.

サインインしてコメントする。


Image Analyst
Image Analyst 2023 年 7 月 14 日
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 件のコメント
yasmin ismail
yasmin ismail 2023 年 7 月 31 日
移動済み: Voss 2023 年 7 月 31 日
and this comment to binarize the image
stretched_Image(stretched_Image == 255) = 0;
?
Image Analyst
Image Analyst 2023 年 7 月 31 日
移動済み: Voss 2023 年 7 月 31 日
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.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by