Clear Filters
Clear Filters

Need to set all channels(RGB) into 0 of a particular pixel in a RGB image

2 views (last 30 days)
How I set all channels(RGB) into zero of a particular pixel in a RGB image ?

Answers (1)

Jan
Jan on 5 Mar 2017
Edited: Jan on 5 Mar 2017
img = 0.6 + 0.4 * rand(30, 20, 3); % Test image with light colors
pixel = [12, 17];
img(pixel(1), pixel(2), :) = 0;
figure;
image(img);
Not the pixel at position (12, 17) is black.
  2 Comments
Piyum Rangana
Piyum Rangana on 5 Mar 2017
Edited: Piyum Rangana on 5 Mar 2017
Hi Jan
Although I set zero like that, the uint8 array values does not get 0. in my case it is a '16×35×3 uint8 array'.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!