how can I change Location values in a MSERRegions object?

조회 수: 1 (최근 30일)
Gerard
Gerard 2015년 4월 13일
답변: Dima Lisin 2015년 4월 16일
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

답변 (3개)

Philip Caplan
Philip Caplan 2015년 4월 15일
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 2015년 4월 16일
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 2015년 4월 16일
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.

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by