How to get binary data from RGB images

how to get biner data if we have code like this :
what code should add so that it can get binary data from RGB ?
uint8Image = 255 * uint8('handles.image');
% binaryImage is your segmented image.
% Get base file name. Discard any extension they may have entered, like jpg.
[f, baseFileNameNoExt, ext] = fileparts(nama_file_simpan);
% Construct full file name.
fullFileName = fullfile(path_simpan, [baseFileNameNoExt, '.png']);
% NEVER use jpg for image analysis. Use PNG.
% Now do the actual save of the segmented image to disk as a PNG format image.
save('uint8Image', 'fullFileName');

3 Comments

Not all comments seem to make sense with the code and some of the code looks like you probably want to do something else:
  • handles.image is probably a variable, so converting the char array to uint8 is probably not the intention
  • save('uint8Image', 'fullFileName'); looks like you want to save the two variables, but it is going to save the second variable in uint8Image.mat. You should probably use imwrite here.
Also, if you directly take code from another post, please link to it. And don't edit code you don't understand.
okay i get it .thank u

Sign in to comment.

Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Asked:

on 18 May 2020

Commented:

on 19 May 2020

Community Treasure Hunt

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

Start Hunting!