GPU calculation with regionprops.Perimeter fails

3 次查看(过去 30 天)
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.

回答(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