lundi 20 avril 2015

Use second image to overlay image in GUI and crop (MATLAB)

Rect = imrect(gca,[200 200 35 45]); %CREATE A RECTANGLE AT POS X,Y,HEIGHT,WIDTH - FROM VISA REQUIREMENTS
setColor(Rect,'green') %RECTANGLE TO BE GREEN BOUNDARY
setFixedAspectRatioMode(Rect,1); %DISABLE RATIO CHANGE
fcn = makeConstrainToRectFcn('Rect',get(gca,'XLim'),get(gca,'YLim')); %DISABLES RECT GOING OUT OF IMAGE
setPositionConstraintFcn(Rect,fcn); %
pos = getPosition(Rect); %GETS THE VECTOR OF THE RECTANGLE
position = wait(Rect); %WAITS
I5 = ImportedImage; %IMAGE IN HANDLES.AXES1 DEFINED AS I5 USING GLOBAL VARIABLE
Crop = imcrop(I5,position); %CROP IMAGE WITH 2 INPUT ARGUMENTS

This is the code I already use to crop an image in the GUI axis. I would like to import a PNG image that I have created (Made a rule of thirds image) and use that to overlay on top of the image that is loaded into the GUI. Once loaded adjust the size of the PNG and use that to crop the image below?

I have tried reading the image in and defining that as 'Rect', but it does not show on top of the image.

Any way of getting around this? Alternatively, can MATLAB make a rule of thirds Rect? Thanks.

Aucun commentaire:

Enregistrer un commentaire