[英]Channel in Digital Image Processing [closed]
I don't have very knowledge about digital image processing.我对数字图像处理知之甚少。 I tried myself.
我自己试过。 If you help me, i will be very happy.
如果你帮助我,我会很高兴。
%tried 3
rgbImage = imread('C:\Users\metec\Desktop\608918.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)
This script uses the saturn.png
image which is included in MATLAB.此脚本使用 MATLAB 中包含的
saturn.png
图像。 To get you started below are the for-loop constructs.为了让您开始,下面是 for 循环结构。 The
+16
in the for-loops indicate the increment value upon each iteration of a given for-loop. for 循环中的
+16
表示给定 for 循环每次迭代时的增量值。 I would suggest storing the sub-images in a struct
(structure).我建议将子图像存储在
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");
Below is an image that indicates the divisions that need to be made.下图显示了需要进行的划分。 To plot where the divisions need to be made the
line()
function was used.对于需要进行分区的 plot,使用了
line()
function。
Ran using MATLAB R2019b使用 MATLAB R2019b 运行
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.