GPU calculation with regionprops.Perimeter fails
3 views (last 30 days)
Show older comments
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 Comments
Answers (4)
Yuebin Zhou
on 25 May 2017
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
on 17 Aug 2018
Edited: Walter Roberson
on 25 Aug 2018
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{:});
0 Comments
Image Analyst
on 25 Aug 2018
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.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!