ดาวน์โหลดโปรแกรมฟรี
       
   สมัครสมาชิก   เข้าสู่ระบบ
 
THAIWARE.COM | ไทยแวร์ถามตอบ
 
 
Add ตั้งคำถาม

แบ่งปัน
คนดู
2,076
 
ตอบ
0

0

 โหวตให้คะแนนดี  ดี  โหวตให้คะแนนแย่  แย่

ถามว่า >

clear all;clc;close all;


fprintf('------------------------------------------------------
');


start=35;                                          


str=num2str(start);                             


str=strcat(str,'.png');                          


a=imread(str); 


figure(1);


subplot(1,2,1)


imshow(a)


title('Original Image')


[R,C,W]=size(a);


fprintf('Image size = %d x %d
',R,C);


fprintf('------------------------------------------------------
');


for i=1:R-1


    for j=1:C-1


       


          


               b(i,j)=255;    


           else


               b(i,j)=0;


           end


    end


end


x=0;


[R,C]=size(b);


for i=1:R


    for j=1:C


        if b(i,j)==0


            x=x+1;


        end


    end


    XX(i)=x;


    x=0;


end


B=b';


x=0;


[R,C]=size(B);


for i=1:R


    for j=1:C


        if B(i,j)==0


            x=x+1;


        end


    end


    XXX(i)=x;


    x=0;


end


XX;                                  %b row ก่อนทรานโพด


XXX;                                 %B column ทรานโพดแล้ว


[Max1_row,Id1]=max(XX);


XX(Id1)=0;


XX;


[Max2_row,Id2]=max(XX+1); 


Max1_row;


Max2_row;


[Max1_column,Id1]=max(XXX);


XXX(Id1)=0;


XXX;


[Max2_column,Id2]=max(XXX+1);


Max1_column;


Max2_column;


 


    if (Max1_row==Max1_column)


    if (Max2_row==Max2_column)


          if (Max1_row==Max2_row)


            if (Max1_column==Max2_column)


        fprintf('This image is identified as: Square
');


        fprintf('======================================================
');


                 subplot(1,2,2)        


                 imshow(b)  


                 title('Square')


            end


          end


    end


    end


 


    if (Max1_row)


   if (Max2_column)


        if (Max1_column)


            if (Max2_row)


                fprintf('This image is identified as: Rectangular
');


                fprintf('======================================================
');


                         subplot(1,2,2)        


                         imshow(b)  


                         title('Rectangle')


           end


        end


   end


end


 


 if (Max1_row~=Max2_row)


      if (Max1_column)


         fprintf('This image is identified as: Triangle
');


         fprintf('======================================================
');


                  subplot(1,2,2)        


                  imshow(b)  


                  title('Triangle') 


      end


 end 


 


 


 if (Max1_row==Max2_row)


      if (Max1_column==Max2_column)


            if (Max2_row~=Max2_column)


           fprintf('This image is identified as: Circle
');


           fprintf('======================================================
');


               subplot(1,2,2)        


               imshow(b)  


               title('Circle')


            end


      end


end


 


 


>>> คือผมอยากให้มันทำคำสั้งที่แสดง circle ได้ แต่ตอนนี้มีปัญหาว่าไม่รู้จะทำยังไง แต่ที่คิดคือ อยากจะให้มันทำประมาณว่าถ้าไม่ตรงตามเงือนไข้ทั้งหมดแล้วค่อยมาทำใน สวนของ circle


ถามเมื่อ 15 มีนาคม 2558 12:14:09


ตอบคำถาม 

ตอบคำถาม

 คุณจำเป็นต้องเป็นสมาชิกจึงจะสามารถตอบคำถามได้
เข้าสู่ระบบ | สมัครสมาชิก
หรือ