NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

I = imread('shape object.jpg');
YCbCr = rgb2ycbcr(I);
Y = YCbCr(:,:,1);
Cb = YCbCr(:,:,2);
Cr = YCbCr(:,:,3);

bw = im2bw(Y,.8);
bw = imcomplement(bw);
bw = bwareaopen(bw,50);
R = I(:,:,1);
G = I(:,:,2);
B = I(:,:,3);

R(~bw) = 0;
G(~bw) = 0;
B(~bw) = 0;
RGB = cat(3,R,G,B);

disp('1: Üçgen İçin');
disp('2: Daire İçin');
disp('3: Dikdörtgen İçin');
disp('4: Yıldız İçin');
secim = input('SEÇİMİNİZ :');

switch (secim)
case 1
[B,L] = bwboundaries(bw,'noholes');
stats = regionprops(L,'All');
bw2 = zeros(size(I,1),size(I,2));
RGB2 = I;
RGB3 = I;
figure, imshow(RGB3),title('Üçgen Seçtiniz');
for k = 1:length(B)
boundary = B{k};
delta_sq = diff(boundary).^2;
perimeter = stats(k).Perimeter;
area = stats(k).Area;
metric = 4*pi*area/perimeter^2;
bbox = stats(k).BoundingBox;
eccentricity = stats(k).Eccentricity;
MajorAxisLength = stats(k).MajorAxisLength;
MinorAxisLength = stats(k).MinorAxisLength;
d = MajorAxisLength/MinorAxisLength;
position = [boundary(1,2),boundary(1,1)];
RGB2 = insertText(RGB2,position,num2str(metric),'FontSize',20,'BoxOpacity',0.8,'TextColor','white');
if metric >0.60 && metric <0.73
bw2(L==k) = 1;
RGB3 = insertObjectAnnotation(RGB3,'rectangle',bbox,'','FontSize',10,'LineWidth',3);
HSV = rgb2hsv(RGB3);
H = RGB2(:,:,1);
S = RGB2(:,:,2);
V = RGB2(:,:,3);
[d,e] = find(bw2==1);
Hue = double(H(d(k),e(k)));
if Hue == 228 || Hue == 106
Renk = 'Turuncu';
elseif Hue == 247
Renk = 'Mavi';
elseif Hue == 239
Renk = 'Koyu Mor';
elseif Hue == 105
Renk = 'Sarı';
elseif Hue == 110
Renk = 'Yeşil';
elseif Hue == 248 || Hue == 107
Renk = 'Pembe';
else
Renk = 'Mor';
end
hold on
for object = 1:length(stats)
bb = stats(k).BoundingBox;
bc = stats(k).Centroid;
rectangle('Position',bbox,'EdgeColor','r','LineWidth',2)
plot(bc(1),bc(2), 'w*')
a=text(bc(1)+15,bc(2)+10,strcat('X: ', num2str(round(bc(1))), ' Y: ', num2str(round(bc(2)))));
set(a, 'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 10, 'Color', 'black');
b=text(bc(1)+15,bc(2)-10,strcat('ÜÇGEN,',Renk));
set(b, 'FontName', 'Arial', 'FontWeight', 'Normal', 'FontSize', 10, 'Color', 'black');
end
end
end
case 2
close all;
[B,L] = bwboundaries(bw,'noholes');
stats = regionprops(L,'All');
bw2 = zeros(size(I,1),size(I,2));
RGB2 = I;
RGB3 = I;
figure, imshow(RGB3),title('Daire Seçtiniz');
for k = 1:length(B)
boundary = B{k};
delta_sq = diff(boundary).^2;
perimeter = stats(k).Perimeter;
area = stats(k).Area;
metric = 4*pi*area/perimeter^2;
bbox = stats(k).BoundingBox;
eccentricity = stats(k).Eccentricity;
MajorAxisLength = stats(k).MajorAxisLength;
MinorAxisLength = stats(k).MinorAxisLength;
d = MajorAxisLength/MinorAxisLength;
position = [boundary(1,2),boundary(1,1)];
RGB2 = insertText(RGB2,position,num2str(metric),'FontSize',20,'BoxOpacity',0.8,'TextColor','white');
if metric >0.9
bw2(L==k) = 1;
RGB3 = insertObjectAnnotation(RGB3,'rectangle',bbox,'','FontSize',10,'LineWidth',3);
HSV = rgb2hsv(RGB2);
H = RGB2(:,:,1);
S = RGB2(:,:,2);
V = RGB2(:,:,3);
[d,e] = find(bw2==1);
Hue = double(H(d(k),e(k)));
if Hue == 254
Renk = 'Koyu Mor';
elseif Hue == 251 || Hue == 255
Renk = 'Mor';
elseif Hue == 250
Renk = 'Pembe';
elseif Hue == 253
Renk = 'Turuncu';
elseif Hue == 251 || Hue == 249
Renk = 'Sarı';
elseif Hue == 252
Renk = 'Yeşil';
else
Renk = 'Mavi';
end
hold on
for object = 1:length(stats)
bb = stats(k).BoundingBox;
bc = stats(k).Centroid;
rectangle('Position',bbox,'EdgeColor','r','LineWidth',2)
plot(bc(1),bc(2), 'w*')
a=text(bc(1)+15,bc(2)+10,strcat('X: ', num2str(round(bc(1))), ' Y: ', num2str(round(bc(2)))));
set(a, 'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 10, 'Color', 'black');
b=text(bc(1)+15,bc(2)-10,strcat('DAİRE,',Renk));
set(b, 'FontName', 'Arial', 'FontWeight', 'Normal', 'FontSize', 10, 'Color', 'black');
end
end
end
case 3
[B,L] = bwboundaries(bw,'noholes');
stats = regionprops(L,'All');
bw2 = zeros(size(I,1),size(I,2));
RGB2 = I;
RGB3 = I;
figure, imshow(RGB3),title('Dikdörtgen Seçtiniz');
for k = 1:length(B)
boundary = B{k};
delta_sq = diff(boundary).^2;
perimeter = stats(k).Perimeter;
area = stats(k).Area;
metric = 4*pi*area/perimeter^2;
bbox = stats(k).BoundingBox;
eccentricity = stats(k).Eccentricity;
MajorAxisLength = stats(k).MajorAxisLength;
MinorAxisLength = stats(k).MinorAxisLength;
d = MajorAxisLength/MinorAxisLength;
position = [boundary(1,2),boundary(1,1)];
RGB2 = insertText(RGB2,position,num2str(metric),'FontSize',20,'BoxOpacity',0.8,'TextColor','white');
if (metric >0.76 && metric <0.92) || ( metric >0.5 && metric <0.6)
bw2(L==k) = 1;
RGB3 = insertObjectAnnotation(RGB3,'rectangle',bbox,'','FontSize',10,'LineWidth',3);
HSV = rgb2hsv(RGB2);
H = RGB2(:,:,1);
S = RGB2(:,:,2);
V = RGB2(:,:,3);
[d,e] = find(bw2==1);
Hue = double(H(d(k),e(k)));
if Hue == 240
Renk = 'Turuncu';
elseif Hue == 254
Renk = 'Mavi';
elseif Hue == 250
Renk = 'Pembe';
elseif Hue == 253
Renk = 'Koyu Mor';
elseif Hue == 255
Renk = 'Sarı';
elseif Hue == 235
Renk = 'Yeşil';
else
Renk = 'Mor';
end
hold on
for object = 1:length(stats)
bb = stats(k).BoundingBox;
bc = stats(k).Centroid;
rectangle('Position',bbox,'EdgeColor','r','LineWidth',2)
plot(bc(1),bc(2), 'w*')
a=text(bc(1)+15,bc(2)+10,strcat('X: ', num2str(round(bc(1))), ' Y: ', num2str(round(bc(2)))));
set(a, 'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 10, 'Color', 'black');
b=text(bc(1)+15,bc(2)-10,strcat('DİKDÖRTGEN,',Renk));
set(b, 'FontName', 'Arial', 'FontWeight', 'Normal', 'FontSize', 10, 'Color', 'black');
end
end
end
case 4
[B,L] = bwboundaries(bw,'noholes');
stats = regionprops(L,'All');
bw2 = zeros(size(I,1),size(I,2));
RGB2 = I;
RGB3 = I;
figure, imshow(RGB3),title('Yıldız Seçtiniz');
for k = 1:length(B)
boundary = B{k};
delta_sq = diff(boundary).^2;
perimeter = stats(k).Perimeter;
area = stats(k).Area;
metric = 4*pi*area/perimeter^2;
bbox = stats(k).BoundingBox;
eccentricity = stats(k).Eccentricity;
MajorAxisLength = stats(k).MajorAxisLength;
MinorAxisLength = stats(k).MinorAxisLength;
d = MajorAxisLength/MinorAxisLength;
position = [boundary(1,2),boundary(1,1)];
RGB2 = insertText(RGB2,position,num2str(metric),'FontSize',20,'BoxOpacity',0.8,'TextColor','white');
if metric >0.1 && metric <0.5
bw2(L==k) = 1;
RGB3 = insertObjectAnnotation(RGB3,'rectangle',bbox,'','FontSize',12,'LineWidth',3);
HSV = rgb2hsv(RGB2);
H = RGB2(:,:,1);
S = RGB2(:,:,2);
V = RGB2(:,:,3);
[d,e] = find(bw2==1);
Hue = double(H(d(k),e(k)));
if Hue == 253
Renk = 'Yeşil';
elseif Hue == 248
Renk = 'Mor';
elseif Hue == 242
Renk = 'Koyu Mor';
elseif Hue == 243
Renk = 'Sarı';
elseif Hue == 247
Renk = 'Turuncu';
elseif Hue == 255
Renk = 'Pembe';
else
Renk = 'Sarı';
end
hold on
for object = 1:length(stats)
bb = stats(k).BoundingBox;
bc = stats(k).Centroid;
rectangle('Position',bbox,'EdgeColor','r','LineWidth',2)
plot(bc(1),bc(2), 'w*')
a=text(bc(1)+15,bc(2)+10,strcat('X: ', num2str(round(bc(1))), ' Y: ', num2str(round(bc(2)))));
set(a, 'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 10, 'Color', 'black');
b=text(bc(1)+15,bc(2)-10,strcat('YILDIZ,',Renk));
set(b, 'FontName', 'Arial', 'FontWeight', 'Normal', 'FontSize', 10, 'Color', 'black');
end
end
end
otherwise
disp('Hatalı bir rakam girdiniz.');
end

     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.