у меня есть изображение I размером 512x256. я хочу получить часть, похожую на фрагмент этого изображения I. как я хочу I1 размером 512x50.
Чтобы взять фрагмент, который включает в себя первые 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.