i want to create bounding boxes for the intersection part of vertical and horizontal profile but i didn't get it how can i do it help me here is the code iam using

6 vues (au cours des 30 derniers jours)
clc;
clear;
close all;
R=imread('img_00155.bmp');
l=rgb2gray(R);
g1=imadjust(l);
V=imbinarize(l,0.7);
Im = mean(V(:));
Ima = max(V(:));
Pm = mean(Ima(:));
W1=0.25;
W2=0.5;
T1=W1.*Im;
T2=W2.*Ima;
T3=(1-W1-W2).*Pm;
T=T1+T2+T3;
T1=W1.*Im;
T2=W2.*Ima;
T3=(1-W1-W2).*Pm;
T=T1+T2+T3;
l(l < T*255) = 0;
[rows1, columns1]=size(l);
verticalProfile = sum(l, 1);
subplot(2,1,1);
plot(1:columns1, verticalProfile,'b-');
title('vertical');
s=size(verticalProfile);
horizontalProfile = sum(l, 2);
subplot(2,1,2);
plot(1:rows1, horizontalProfile,'b-');
title('horizontal');
mul1=ones(size(horizontalProfile)).*verticalProfile;
hhh=graythresh(mul1);
mul2 = horizontalProfile.*ones(size(verticalProfile));
kkk=graythresh(mul2);
fu1=imfuse(mul1,R,'blend','Scaling','none');
figure,imshow(fu1);
fu2=imfuse(mul2,R,'blend','Scaling','none');
figure,imshow(fu2);
fu3=imfuse(mul2,fu1,'blend','Scaling','none');
figure,imshow(fu3);
bboxes = regionprops(fu3,'BoundingBox');
hold on
figure,imshow(fu3);
for k = 1 : length(bboxes)
CurrBB = bboxes(k).BoundingBox;
if CurrBB(3)/CurrBB(4)>= 0.62 || CurrBB(3)/CurrBB(4)<= 0.30 ;
rectangle('Position', [CurrBB(1),CurrBB(2),CurrBB(3),CurrBB(4)],'EdgeColor', 'r', 'LineWidth', 2);
end
end
hold off
this is my original image

Réponse acceptée

KSSV
KSSV le 3 Avr 2019

Plus de réponses (0)

Catégories

En savoir plus sur Entering Commands dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by