フィルターのクリア

How I can change the certain pixel values in gray scale image?

4 ビュー (過去 30 日間)
TURI
TURI 2012 年 10 月 26 日
コメント済み: Mebiame 2017 年 7 月 14 日
%I have gray image X having values between 0 and 0 to 1, I want to change the values of certain pixel to 1 that are closer to 1 and want to change values to 0 that are near to 0. Can anyone write a code for that as I am new to matlab. Thanks

採用された回答

Sachin Ganjare
Sachin Ganjare 2012 年 10 月 26 日
X=imread('1.jpg') % My image was color so was MxNxP
Xc=X(:,:,1) % crateda grayscale image MxN
Xc(14,20) % here my output was ans=129
Xc(14,20)=1 % changed the value of (14,20) to 1
Xc(14,20) % here my output was ans=1
  3 件のコメント
TURI
TURI 2012 年 10 月 26 日
Thanks Sachin, but how i can do this for more pixels .. e.g more that 100 pix.
Mebiame
Mebiame 2017 年 7 月 14 日
Hello,
I was wondering if there was a way to use the above but for 3D CT images (images with slices) and only change the colour of a certain pixel on that certain slice.
Thanks

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2012 年 10 月 26 日
Well, you shouldn't have accepted that answer so quickly if it didn't do what you asked. Here's how to " change the values of certain pixel to 1 that are closer to 1 and want to change values to 0 that are near to 0":
yourImage = yourImage >= 0.5;

Community Treasure Hunt

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

Start Hunting!

Translated by