我是一名在细胞生物学实验室工作的本科生,有matlab的基本背景。我正在做一个在培养皿上追踪细胞轨迹(时间推移)的项目。下面是我使用分水岭功能从背景中分离出来的两个示例图像。原来的图片是绿色的霓虹灯,现在全是黑白的/


假设我有20张这样的图片,我如何将一张图片叠加在另一张图片上,使它们都具有相同的透明度?那么,如何添加表示时间的色彩映射表呢?(最下面的图片是色彩映射表的一端,最新的图片是另一端) <-这是非常有挑战性的,因为它通常是黑色的,而不是NaN
发布于 2016-06-10 07:42:01
基本思想
可能最简单的方法是获取每一层的二进制图像,然后将图像乘以获取它的时间(或它的时间索引)。然后,您可以沿第三维连接所有图像(使用cat)。可以使用max计算沿第三维的最大值。这将使较新的时间点看起来“在”较旧的时间点之上。然后可以使用imagesc显示生成的展平矩阵,它将自动映射到当前图形的色彩映射表。通常,我们将其称为最大强度投影。
创建一些数据
首先,由于您只提供了两个图像,因此我将为您为演示提供的第一个图像创建一些偏移版本。
% Create some pseudo-data in a cell array that represents the image over time
im = imread('http://i.imgur.com/xTurvfO.jpg');
im = im(:,:,1);
ims = cell(1, 5);
% Create some shifted versions of im1
shifts = round(linspace(0,1000,5));
for k = 1:numel(shifts)
ims{k} = circshift(im > 100, shifts([k k]));
end实现该方法
现在,对于我所讨论的方法的应用
% For each image, multiply the binary mask by the time
for k = 1:numel(ims)
ims{k} = ims{k} * k;
end
% Concatenate all images along the third dimension
IMS = cat(3, ims{:});
% Flatten by taking the maximum value along the third dimension
MIP = max(IMS, [], 3);
% Display the resulting flattened image using imagesc
imagesc(MIP);
% Create a custom colormap with black at the end to create our black background
colormap(cat(1, [0 0 0], parula))结果

发布于 2016-06-10 07:40:19
我使用imfuse创建复合图像,这类似于在荧光显微镜上组合多个通道。Mathworks文档是http://www.mathworks.com/help/images/ref/imfuse.html。
棘手的部分是为颜色通道选择向量。例如,2, 1,2表示为图像1选择B(lue),为图像2选择R(ed)和G(reen)。2,1,2是为色盲人士推荐的方案,并在this image的左侧给出了图形。使用1,0,2表示红色/蓝色给出了右侧的图。
fig1 = imread([basepath filesep 'fig.jpg']); %white --> black
fig2 = imread([basepath filesep 'fig2.jpg']);
fig_overlay = imfuse(fig1, fig2,'falsecolor','Scaling','joint', 'ColorChannels', [1,0,2]);
imshow(fig_overlay)https://stackoverflow.com/questions/37736558
复制相似问题