数字图像处理频道

Channel in Digital Image Processing

我对数字图像处理不是很了解。我试过自己。如果你能帮助我,我会很高兴。

Question

%tried 3

rgbImage = imread('C:\Users\metec\Desktop8918.jpg');
[rows, columns, numberOfColorChannels] = size(rgbImage);
if rows >= 2048 && columns >= 1024 % check image sizes(m,n) m=rows n=columns
else
end
if rows * columns >= 2097152
else
end
[rows, columns, numberOfSubplots] = size(rgbImage);
if rows * columns >= 16 % check sub image sizes(p,p)
else
end
redChannel = rgbImage(:,:,1); % channel 1
subplot(3, 3, 2);
imshow(rgbImage);
fontSize = 10;
title('Original RGB Image', 'FontSize', fontSize)
subplot(3, 3, 4);
imshow(redChannel);
title('Red Channel', 'FontSize', fontSize)

第一步:

此脚本使用 MATLAB 中包含的 saturn.png 图像。为了让您开始,下面是 for 循环结构。 for 循环中的 +16 表示给定 for 循环每次迭代的增量值。我建议将子图像存储在 struct(结构)中。

img = imread("saturn.png");
%Grabbing channel 1 of the image%
Channel_1 = img(:,:,1);
%Resizing the test image to follow the size of the question%
Channel_1 = imresize(Channel_1,[2048 1024]);

for Row = 1: +16: 2048
   for Column = 1: +16: 1024 

   fprintf("(%d,%d)\n",Row,Column);
   %Grab sub-images here%

   %Hint: Rows: (1 to 16) and Columns: (1 to 16) is the first sub-image.
   

   

   end
end

subplot(1,2,1); imshow(Channel_1);
title("Original Image");

subplot(1,2,2);
title("Sub-Images");

下图显示了需要进行的划分。为了绘制需要进行划分的位置,使用了 line() 函数。

运行 使用 MATLAB R2019b