Filter löschen
Filter löschen

i wanted to crop the car plate region that i want.but there is some problem when i am using the regionprop.The error msg is like "??? Attempt to call constructor rectangle with incorrect letter case."somebody pls help.

2 Ansichten (letzte 30 Tage)
I1 = imread('test_pic.jpg'); %which test pic is my profile pic I=rgb2gray(I1); figure,imshow(I),title('Synthetic Image')
BW=im2bw(I); figure,imshow(BW),title('Binary Image')
s = regionprops(BW, I, {'Centroid','WeightedCentroid'});
imshow(I) title('Weighted (red) and Unweighted (blue) Centroid Locations'); hold on numObj = numel(s); for k = 1 : numObj plot(s(k).WeightedCentroid(1), s(k).WeightedCentroid(2), 'r*'); plot(s(k).Centroid(1), s(k).Centroid(2), 'bo'); end hold off
s = regionprops(BW, I, {'Centroid','PixelValues','BoundingBox'}); imshow(I); title('Standard Deviation of Regions'); hold on for k = 1 : numObj s(k).StandardDeviation = std(double(s(k).PixelValues)); text(s(k).Centroid(1),s(k).Centroid(2), ... sprintf('%2.1f', s(k).StandardDeviation), ... 'EdgeColor','b','Color','r'); end hold off
figure bar(1:numObj,[s.StandardDeviation]); xlabel('Region Label Number'); ylabel('Standard Deviation');
sStd = [s.StandardDeviation]; lowStd = find(sStd >50);
imshow(I); title('Objects Having Standard Deviation > 50'); hold on; for k = 1 : length(lowStd) rectangle('Position', s(lowStd(k)).BoundingBox, ... 'EdgeColor','y'); end hold off;

Antworten (0)

Kategorien

Mehr zu Get Started with Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by