如何在matlab中从图像中获取部分?
我有一张512x256的图像。 我想从这个图像i中得到一些像切片的部分。如何在matlab中从图像中获取部分?,matlab,Matlab,我有一张512x256的图像。 我想从这个图像i中得到一些像切片的部分。 就像我想要大小为512x50的I1一样。要获取包含前50列和所有行的切片,请执行以下操作 sliceOfImage = originalImage(:,1:50) 要获取包含列100到149的切片,请调用 sliceOfImage = originalImage(:,100:149) 等等 x = [1:50]; % define the scope of x-axis (the "columns") for the
就像我想要大小为512x50的I1一样。要获取包含前50列和所有行的切片,请执行以下操作
sliceOfImage = originalImage(:,1:50)
要获取包含列100到149的切片,请调用
sliceOfImage = originalImage(:,100:149)
等等
x = [1:50]; % define the scope of x-axis (the "columns") for the portion of the image
y = [1:512]; %define the scope of y-axis (the "rows") for the portion of the image
I1 = I(x,y,:); % Create I1, the desired portion of the image. Assuming the original image is of RGB and you need to access all 3 colors.