Created
November 13, 2018 02:13
-
-
Save jiachengx/d986d227e8947a4064672615d556ed42 to your computer and use it in GitHub Desktop.
heat map source code for ThinkSpeak IoT analysis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Enter your MATLAB code below | |
strength = thingSpeakRead(CHANNEL_ID, '{CHANNEL ID}',READ_API_KEY,'{READ_API_KEY}',1,'fields',[1]); | |
% Indoor position | |
X = [10 550 550 10 50 234 393 129 237 328 448 225 344 457 477]'; | |
Y = [10 10 410 410 293 210 202 132 130 142 141 272 268 274 200]'; | |
strengthPercent = 2*(strength+100)/100; | |
picture = imread('https://{}.png'); | |
[height,width,depth] = size(picture); | |
OverlayImage=[]; | |
F = scatteredInterpolant(Y, X, strengthPercent,'linear'); | |
for i = 1:height-1 | |
for j = 1:width-1 | |
OverlayImage(i,j) = F(i,j); | |
end | |
end | |
alpha = (~isnan(OverlayImage))*0.6; | |
imshow(picture); | |
hold on | |
OverlayImage = imshow( OverlayImage ); | |
caxis auto | |
colormap( OverlayImage.Parent, jet ); | |
colorbar( OverlayImage.Parent ); | |
set( OverlayImage, 'AlphaData', alpha ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment