• Remix
  • Share
  • New Entry

  • Adam Danz

  • /
  • The making of a mini hack image

on 29 Oct 2022
  • 8
  • 109
  • 0
  • 0
  • 280
% Create moon image in 3D
% https://www.mathworks.com/matlabcentral/fileexchange/101649
rng default
craters(demo='m')
c=[.2 .2 .2];
set(gcf,Color=c)
% Flatten moon image to 2D
F=getframe(gca);
close
% Show office scene
imshow(tonemap(hdrread('office.hdr')));
hold on
% Set portion of monitor to dark
% I used [x,y]=ginput(4) to capture the corners of the monitor
x=[403 405 249 247];
y=[363 476 490 373];
fill(x,y,c);
% Add flattened moon to monitor
% Maintain x and y ratio from original image.
p=[260,375]; % (x,y) position of upper left corner
w=125; % width
h=w*(height(F.cdata)/width(F.cdata)); % height
image(p(1)+[0,w],p(2)+[0,h],F.cdata);
title('MiniHack 2022')
Remix Tree