如何使用以下公式估计彩色图像的亮度通道先验(将空间域的图像转换为亮度域):enter image description here有人知道如何在Matlab中做到这一点吗?
发布于 2019-03-12 08:32:05
人们需要更多地了解Omega(x)是什么,但我猜它是一个本地窗口。下面这样的代码是一个开始(用你的窗口替换1:2和4:6 ):
[bright, bright_channel_idx] = max( image(1:2,4:6,:), [], 3 ); % take the max along the 3rd dimension, color
发布于 2019-03-14 01:04:30
这里有一段代码可以帮助您入门。您可以使用两个for循环来遍历行(r)和列(c)。必须有更快的方法来做到这一点,但这足以让你开始。另一个提示:当for循环接近行和/或列的末尾时要小心。
block_r = img( r:r+kernel_h, c:c+kernel_w, 1 ); % get a region
block_g = img( r:r+kernel_h, c:c+kernel_w, 2 );
block_b = img( r:r+kernel_h, c:c+kernel_w, 3 );
max_r = max( block_r(:) ); % max within each region
max_g = max( block_g(:) );
max_b = max( block_b(:) );
bright_img(r,c) = max( [max_r,max_g,max_b] ); % max across all channelshttps://stackoverflow.com/questions/55109344
复制相似问题