GPU calculation with regionprops.Perimeter fails

2 ビュー (過去 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.
  1 件のコメント
giuseppe vitucci
giuseppe vitucci 2017 年 5 月 31 日
I'm using the last version, 2017a.

サインインしてコメントする。


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