When thresholding the image, the result should be 0 or 255, but why are there many intermediate values?（Read images as an array with pycharm）
Maybe add a bit more information. The image you provide doesn’t look like FIJI or ImageJ1; I guess your image is a screenshot of a python debugger? Upload ‘the image’ you mention and the recorded the steps you performed ‘When thresholding the image’ or provide a snippet of that python code. That would make it easier to answer your question.
Thank you for your help!
Steps on ImageJ: 1. Image->Adjust->Threshold 2.save the image as 13.jpeg
codes on pycharm:
from keras.preprocessing.image import ImageDataGenerator, img_to_array, load_img label= load_img('/lable/13.jpg') x_label = img_to_array(label) x_label=x_label[:,:,0]
so why the result x_label have so many intermediate values?
This is because the image has been saved as JPEG. JPEG is a lossy format, losing some accuracy to reduce file size. If you save as TIFF, and try again, you should only see values 0 & 255.
Unless you have a compelling reason to, I would always use a lossless format (such as TIFF) for any image analysis, which will preserve the “true” pixel values.
Hope this helps!
The problem is solved.
Thank you very much for your help