draw colored binary file

1 view (last 30 days)
Matlabques
Matlabques on 4 Feb 2014
Answered: Image Analyst on 4 Feb 2014
I am trying to make vertical lines and my code generate white and black vertical lines. what do i have to do to change the color of white line to grey color or choose any color from 0 to 256.
number_of_rows = 1000; white_segment = ones(number_of_rows,1)*1; black_segment = zeros(number_of_rows,2); white_n_black_col = [black_segment,white_segment]; white_n_black_bars = repmat(white_n_black_col,1,(1000/3)); imwrite(white_n_black_bars,'vertical_bars2.bmp');

Accepted Answer

Image Analyst
Image Analyst on 4 Feb 2014
When you call ones, multiply by some number between 0 and 1.
white_segment = ones(number_of_rows,1)* 0.4;
Or else use uint8
white_segment = ones(number_of_rows,1, 'uint8')* 137; % Or whatever number you want.

More Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!