how can I change Location values in a MSERRegions object?

1 view (last 30 days)
Hello,
how can I change Location values in a MSERRegions object?
When I try following: matchedPoints1.Location = bsxfun(@plus, matchedPoints1.Location, newOrigin1); (where: matchedPoints1 1819x1 9757252 MSERRegions) ... I get following error: Read-only properties of an MSERRegions object cannot be modified.
kind regards Gerard

Answers (3)

Philip Caplan
Philip Caplan on 15 Apr 2015
Unfortunately, the 'Location' property of "MSERRegions" objects is read-only. Can you explain why you need to change this property? The only reason I can think of is to subsequently plot the regions after detecting features. If this is the case, I would suggest looking at the source code for the "plot" function for "MSERREgions":
>> edit MSERRegions
and scroll down to the plot function. You can then copy this code and create your own "shiftedMSERPlot" function which can account for the shifted origin. If this is not your intention, please describe why you would like to change the 'Location' property.

Gerard
Gerard on 16 Apr 2015
hello & thank you Philip,
I was following the example in http://www.mathworks.com/examples/matlab-computer-vision/745-sparse-3-d-reconstruction-from-two-views, where I wanted to replace detectSURFFeatures by detectMSERFeatures ... and then I got the error.
Maybe I am not supposed to do so, but I am new to comp. vision., maybe you know why?
kind regards gerard

Dima Lisin
Dima Lisin on 16 Apr 2015
Hi Gerard,
For the purposes of that example all you need are the x,y locations of points. So instead of
matchedPoints1.Location = bsxfun(@plus, matchedPoints1.Location, newOrigin1);
you can simply use
newLocation = bsxfun(@plus, matchedPoints1.Location, newOrigin1);
newLocation will be an M-by-2 matrix of (x,y) coordinates.
Also, if you set the 'OutputView' parameters of undistortImage to 'same', then you will not need to adjust the coordinates at all. The undistorted image will be same size as the original image, so newOrigin will be 0. 'Full' output view is useful to avoid losing too many pixels in cases of severe distortion. If your image is not too distorted, then 'same' may be ok, and it will simplify your code.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!