You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: harris.m
    path of file: ./repos/iptutorials/TB_IPR/TUT.IMG.harris_detector/matlab
    
    the code of the file until where you have to start completion: function [C, pts] = harris(I, K, sigma, t)
%HARRIS corner detector
%     I     : original grayscale image
%     K     : coefficient
%     sigma : scale of observation (gaussian filter size)
%     t     : threshold value
%
% return values
%     C     : Cornerness measure
%     pts   : coordinates of the points


    
function [C, pts] = harris(I, K, sigma, t)
%HARRIS corner detector
%     I     : original grayscale image
%     K     : coefficient
%     sigma : scale of observation (gaussian filter size)
%     t     : threshold value
%
% return values
%     C     : Cornerness measure
%     pts   : coordinates of the points


% first of all, compute gradient in x and y directions
% hx = [-1  0 1; -2 0 2; -1 0 1];
% Ix = conv2(I, hx,  'same');
% Iy = conv2(I, hx', 'same');
[Ix, Iy] = imgradientxy(I);

% compute the different coefficients of the Harris detector
M1 = Ix.^2;
M2 = Ix.*Iy;
M4 = Iy.^2;

% apply scale
M1 = imgaussfilt(M1, sigma);
M2 = imgaussfilt(M2, sigma);
M4 = imgaussfilt(M4, sigma);

% cornerness measure evaluation and display
C = (M1.*M4 - M2.^2) - K *(M1+M4).^2;

% keep only highest values
C2 = C;
C2(C2<t)=0;

% find local maxima
corners = imextend