title: How to provide region of interest (ROI) for edge detection and corner detection in Matlab?
body: <p>I have a movie file, in which I am interested in recording the movement of a point; center of a circular feature to be specific. I am trying to perform this using edge detection and corner detection techniques in Matlab.</p>
  
  <p>To perform this, how do I specify a region of interest in the video? Is subplot a good idea?</p>
  
  <p>I was trying to perform this using the binary masks as below,</p>
  
  <pre><code>hVideoSrc = vision.VideoFileReader('video.avi','ImageColorSpace', 'Intensity');
  hEdge = vision.EdgeDetector('Method', 'Prewitt','ThresholdSource', 'Property','Threshold', 15/256, 'EdgeThinning', true);
  hAB = vision.AlphaBlender('Operation', 'Highlight selected pixels');
  WindowSize = [190 150];
  hVideoOrig = vision.VideoPlayer('Name', 'Original');
  hVideoOrig.Position = [10 hVideoOrig.Position(2) WindowSize];
  
  hVideoEdges = vision.VideoPlayer('Name', 'Edges');
  hVideoEdges.Position = [210 hVideoOrig.Position(2) WindowSize];
  
  hVideoOverlay = vision.VideoPlayer('Name', 'Overlay');
  hVideoOverlay.Position = [410 hVideoOrig.Position(2) WindowSize];
  
  c = [123 123 170 170]; 
  r = [160 210 210 160];
  m = 480;  % height of pout image
  n = 720;  % width of pout image
  BW = ~poly2mask(c,r,m,n);
  
  while ~isDone(hVideoSrc)
      dummy_frame = step(hVideoSrc) &gt; 0.5;                % Read input video
      frame = dummy_frame-BW;
      edges = step(hEdge, frame);
      composite = step(hAB, frame, edges);        % AlphaBlender
  
      step(hVideoOrig, frame);                    % Display original
      step(hVideoEdges, edges);                   % Display edges
      step(hVideoOverlay, composite);             % Display edges overlayed
  end
  release(hVideoSrc);
  </code></pre>
  
  <p>but it turns out that the mask applied on frame is good only for the original video. The edge detection algorithm detects the edges those are masked by binary mask. How can I mask other features permanently and perform edge detection?</p>