www.i4info.org

i4info Provides the best hacking Material. Latest hacking tutorials and tools are available here. It is the best place for hackers.

Latest topics

» Facebook Account Hacked
Today at 10:14 am by ssameer758

» Teen Patti Gold Hack & 3 Patti Chips Code Extra Bonus 2016
Today at 8:31 am by furqansweet73

» BitCoin Wallet stealor New
Wed Dec 07, 2016 7:46 pm by Admin

» Muhammad Shahroze Rashid | Marketing Consultant
Wed Dec 07, 2016 1:48 pm by Admin

» Muhammad Shahroze Rashid | Sharp Mind, Sharp Innovations
Wed Dec 07, 2016 1:47 pm by Admin

» How to design an effective job ad
Wed Dec 07, 2016 1:45 pm by Admin

» Content Marketing | Promotional Video
Fri Dec 02, 2016 2:45 pm by Admin

» How to start an Online Business | Complete Guide
Fri Dec 02, 2016 2:30 pm by Admin

» Zeeshan Bhatti
Wed Nov 30, 2016 3:18 pm by Admin

December 2016

MonTueWedThuFriSatSun
   1234
567891011
12131415161718
19202122232425
262728293031 

Calendar Calendar

Affiliates


free forum

Forumotion on Facebook Forumotion on Twitter Forumotion on YouTubeForumotion on Google+

Visitors Counter


Flag Counter

About Author

Muhammad Shahroze Rashid
i4info
Web Developer
Web Developer & Designer,Researcher and Technical writer. An Information Security Consultant and System Auditor, a keen Security researcher.
samanabad
lahore, Punjab
54000
Pakistan
[email protected]
03064904829
DOB: 05/25/1992
Muhammad Shahroze Rashid
Muhammad Shahroze Rashid is a Web Developer and Designer, Android Developer, InfoGrapher, IT consultant and Researcher
Reviewed by Google
Google
Date published: 01/19/2016
9 / 10 stars
Muhammad Shahroze Rashid
Muhammad Shahroze Rashid Web Developer & Designer,Researcher and Technical writer. An Information Security Consultant and System Audito
samanabad
lahore
Punjab
54000
Pakistan

Color Detection on Images by Using MATLAB

Share

Admin
Admin

Posts : 455
Reputation : 5
Join date : 2014-12-10
Age : 24
Location : Pakistan

Color Detection on Images by Using MATLAB

Post by Admin on Sun Jun 05, 2016 5:06 pm

Color Detection in Image by using MATLAB


 

Hi everyone, I hope you are doing fine, Today I will share teach you how to detect images in MATLAB, in order to do so, I will share a step by step guide for Color Detection in MATLAB. I will share a project with you for better understanding and learning.
[You must be registered and logged in to see this link.]

  • So as to do the Color Recognition in Images utilizing MATLAB, first of all, we require a Picture.


 

  • Therefore, I Designed a picture in paint that has diverse shapes in various hues as appeared in beneath picture:
    [You must be registered and logged in to see this link.]

  • There are distinctive shapes and colors in the picture, we will distinguish these shapes by their colors.


 

  • Copy/Paste the give code into your m File.


 

 

   data = imread('TEP.jpg');
   diff_im = imsubtract(data(:,:,2), rgb2gray(data));
   %Use a median filter to filter out noise
   diff_im = medfilt2(diff_im, [3 3]);
   diff_im = im2bw(diff_im,0.18);
   
   diff_im = bwareaopen(diff_im,300);
   
   bw = bwlabel(diff_im, Cool;
   
   stats = regionprops(bw, 'BoundingBox', 'Centroid');
   
   % Display the image
   imshow(data)
   
   hold on

   for object = 1:length(stats)
       bb = stats(object).BoundingBox;
       bc = stats(object).Centroid;
       rectangle('Position',bb,'EdgeColor','r','LineWidth',2)
       plot(bc(1),bc(2), '-m+')
       a=text(bc(1)+15,bc(2), strcat('X: ', num2str(round(bc(1))), ' Y: ', num2str(round(bc(2)))));
       set(a, 'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 12, 'Color', 'black');
   end
   
   hold off

 

  • After implementing the code, Execute the m file, if there is no error, you will get the output.
    [You must be registered and logged in to see this link.]
    You can find in the above figure, we have just recognized the shapes with green shading.


  • The + sign demonstrates the focal point of each distinguished shape.


  • X and Y are the x,y directions of the mid point of every shape that are appeared in dark for every recognized shape.


  • Presently, We have distinguished red Shapes in the Pic, so keeping in mind the end goal to do as such what I have to do is to just change the third esteem in imsubtract capacity from 2 to 1.



Download the complete code for Color detection.

Download Full Code

  • If you run this code in MATLAB, then your output will be like that:


  • Now, it recognized the red shapes/Objectives in MATLAB.


 

  • Its x,y coordinates are in Dark Color.
    [You must be registered and logged in to see this link.]
    In the end we will identify the blue shading, to do so, you simply have to change the third parameter to 3 and it will distinguish the blue shading like this:


 

That’s all for now, I hope it will help you a lot, For any kind of help ,about Color detection on image with MATLAB, Comment Below.

    Current date/time is Sun Dec 11, 2016 10:58 am