imread, reshape and zeros function syntax problems
2 views (last 30 days)
Show older comments
Commented: Manu Chaudhary on 16 Jan 2022
I am completely new to matlab. Studing some sample codes to learn matlab. I have some basic questions in the below code:
input_image_filename= './Images/Image_64x64.jpg'; % It is a 64x64 colored image
What is the return type of input_im_3D ? What I observe that it is storing some huge data in the variable input_im_3D?
x = double(reshape(input_im_3D, [n_pix 1]));
What I observe is that reshape function is putting data in the single column of a excel sheet till 12288.
I am really not able to understand the working of reshape function? Return type of reshape function ? What changes double put in the results? What does the syntax of [n_data 1] means ?
n_data= 16384 ;
x = [x; zeros(n_data - n_pix , 1)];
Please also explain me the syntax of zeros?
Walter Roberson on 16 Jan 2022
imread() returns the data type stored in the file. The most common data type stored in image files is uint8(), but there are other possibilities. For example,
basename = tempname();
fn1 = basename + "logical.png";
fn3 = basename + "uint16.png";
img1 = rand([48 64]) < 0.5;
img3 = randi([0 65535], [48 64 3], 'uint16');
back1 = imread(fn1);
back3 = imread(fn3);
whos back1 back3
True floating point images are possible, but writing one out takes more work for demonstration takes more work than I care to bother with at the moment.
More Answers (0)
Find more on Logical 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!