GPU calculation with regionprops.Perimeter fails

조회 수: 3 (최근 30일)
giuseppe vitucci
giuseppe vitucci 2017년 5월 23일
답변: giuseppe vitucci 2018년 8월 29일
I tried to calculate the perimeter and the area of an image, represented as a logical matrix, doing this:
I_merged =gpuArray(I_merged); % I_merged is the image of a circle
area= regionprops(I_merged,'Area');
perimeter = regionprops(I_merged,'Perimeter');
Apparently i do not get any error for the calculation of the area, on the contrary for the perimeter this is what i get:
------------------------------------------------------------
Error using gpuArray/regionprops>getPropsFromInput (line 784)
Expected input number 1, PROPERTIES, to match one of these values:
'Area', 'Centroid', 'BoundingBox', 'SubarrayIdx', 'MajorAxisLength', 'MinorAxisLength', 'Eccentricity',
'Orientation', 'Image', 'Extrema', 'EquivDiameter', 'Extent', 'PixelIdxList', 'PixelList', 'PixelValues',
'WeightedCentroid', 'MeanIntensity', 'MinIntensity', 'MaxIntensity'
The input, 'Perimeter', did not match any of the valid values.
Error in gpuArray/regionprops>ParseInputs (line 749)
reqStats = getPropsFromInput(startIdxForProp, ...
Error in gpuArray/regionprops (line 135)
[I,requestedStats,officialStats] = ParseInputs(imageSize, varargin{:});
Error in roundness_auto (line 14)
perimeter = regionprops(I_merged,'Perimeter');
-------------------------------------------------------------
I see from this page (" https://uk.mathworks.com/help/images/ref/regionprops.html ") that GPU support is enabled for the perimeter calculation, so I do not understand what's wrong with this.
  댓글 수: 2
Joss Knight
Joss Knight 2017년 5월 24일
What is the version of MATLAB that you are using?
giuseppe vitucci
giuseppe vitucci 2017년 5월 31일
The last one, 2017a

댓글을 달려면 로그인하십시오.

답변 (4개)

Yuebin Zhou
Yuebin Zhou 2017년 5월 25일
Documentation always shows information for the latest MATLAB. From the error message, it might be because you are using an older version which does not support perimeter.

Walter
Walter 2018년 8월 17일
편집: Walter Roberson 2018년 8월 25일
I have the same issue on 2018a
E
rror using gpuArray/regionprops>getPropsFromInput (line 788)
Expected input number 1, PROPERTIES, to match one of these values:
'Area', 'Centroid', 'BoundingBox', 'SubarrayIdx', 'MajorAxisLength',
'MinorAxisLength', 'Eccentricity', 'Orientation', 'Image', 'Extrema',
'EquivDiameter', 'Extent', 'PixelIdxList', 'PixelList', 'PixelValues',
'WeightedCentroid', 'MeanIntensity', 'MinIntensity', 'MaxIntensity'
The input, 'Perimeter', did not match any of the valid values.
Error in gpuArray/regionprops>ParseInputs (line 753)
reqStats = getPropsFromInput(startIdxForProp, ...
Error in gpuArray/regionprops (line 139)
[I,requestedStats,officialStats] = ParseInputs(imageSize, argin{:});

Image Analyst
Image Analyst 2018년 8월 25일
There are different regionprops:
>> which -all regionprops
C:\Program Files\MATLAB\R2018a\toolbox\images\images\regionprops.p
C:\Program Files\MATLAB\R2018a\toolbox\images\images\@gpuArray\regionprops.m % gpuArray method
C:\Program Files\MATLAB\R2018a\toolbox\images\images\regionprops.m % Shadowed
when I edit the one in the @gpuarray folder, it shows that it does not offer perimeter as a measurement. I don't know why.

giuseppe vitucci
giuseppe vitucci 2018년 8월 29일
Well, at this point, after one year and with the same result, I think a ticket should be open... I am going to do that.

Community Treasure Hunt

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

Start Hunting!

Translated by