How to assign a column of pixels a zero value?
1 view (last 30 days)
Show older comments
I have a grayscale image.
I want to assign pixels of the first 30 columns in this image a value of zero. How can this be done?
Thanks.
0 Comments
Accepted Answer
Adam
on 9 Sep 2014
Edited: Adam
on 9 Sep 2014
data(:,1:30) = 0;
2 Comments
Adam
on 10 Sep 2014
Edited: Adam
on 10 Sep 2014
Assuming you mean a rectangular area and you know the indices within which you want the single value something like the following will work:
newImage = zeros( size( oldImage ) );
newImage( xMin:xMax, yMin:yMax ) = value;
where value is whatever value you wish to give to the region. Obviously here your original image is irrelevant to the process other than to provide the size, but that seems to be what you were asking?
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!