2017-07-20 221 views
0

我的目标是在Matlab中使用现有平面图创建热图,并手动收集RF RSSI值。Matlab中的热图:heatmap_overlay()图片中的偏移量

在建筑物的各个区域记录信号强度之后,我使用笔和纸在平面图上标记了数值(〜30至〜80)。我正在寻找将这个图绘制在原始平面图上的热图上。

我所做的是以下内容:

Google。 YouTube上。手册页。我的研究已经登陆我完成了以下内容:

  • 通过询问用户选择照片
  • 写的imread导入到Matlab的图像()函数
  • 将数组图像的大小全部归零
    • 这是目前手工完成,但不是一个问题,现在
  • 手动放置,热图(X,Y)= VAL;在位置标记在原计划
    • 我已经发现在x,y像素从Photoshops信息坐标托盘
  • 使用的高斯低通滤波器上()
    • 通过热图设定的点该过滤器参数包含在像素

图像尺寸此时,我尝试显示吨他在原始平面图上过滤了热图()。我使用相同的尺寸进行过滤,并使用由图像大小制成的阵列(以像素为单位)。但是,我没有获得热图指向覆盖的地方,我通过对它进行硬编码进行了指定。

的代码如下:

%Import an image*********************************************** 
%Ask a user to import the image they want 
%************************************************************** 

%The commented out line will not show the file type when prompted to select 
%an image 
%[fn,pn] = uigetfile({'*.TIFF,*.jpg,*.JPG,*.jpeg,*.bmp','Image files'}, 'Select an image'); 

%This line will select any file type, want to restrict in future 
[fn,pn] = uigetfile({'*.*','Image files'}, 'Select an image'); 
importedImage = imread(fullfile(pn,fn)); 

%Create size for heat map************************************** 
%Setting the size for the map, see comments below 
%************************************************************** 

%What if I wanted an arbitrary dimension 
%Or better yet, get the dimensions from the imported file 
heatMap = zeros(1512,1080); 


%Manually placing the heatmap values along a grid 
%Want to set zones for this, maybe plot out in excel and use the cells to 
%define the image size? 
heatMap(328,84) = .38; 
heatMap(385,132) = .42; 
heatMap(418,86) = .40; 
heatMap(340,405) = .60; 
heatMap(515,263) = .35; 
heatMap(627,480) = .40; 
heatMap(800,673) = .28; 
heatMap(892,598) = .38; 
heatMap(1020,540) = .33; 
heatMap(1145,684) = .38; 
heatMap(912,275) = .44; 
heatMap(798,185) = .54; 


%Generate the Map********************************************** 
%Making the density and heat map 
%************************************************************** 
gaussiankernel = fspecial('gaussian', [1512 1080], 60); 
density = imfilter(heatMap, gaussiankernel, 'replicate'); 

%imshow(density, []); 
oMask = heatmap_overlay(importedImage, density, 'summer'); 
set(figure(1), 'Position', [0 0 1512 1080]); 
imshow(oMask,[]); 
colormap(summer); 
colorbar; 

任何想法,为什么这里指定的叠加过滤器偏移,而不是?

这可以通过任何图像1512×1080
请让我知道,如果你想在原始图像中使用

回答

0

数组被关再现。
我所做的是以下几点:

  • 输出密度图仅
  • 在Matlab工作区

验证的尺寸大小我已经注意到了密度,热图,importedImage和oMask数组并不都是nxm的大小。

heatMap和importedImage是n x m,而importedImage和oMask是m x n。

我把所有尺寸换成了n×m,现在图像重叠就好了。