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

» Teen Patti Gold Hack & 3 Patti Chips Code Extra Bonus 2016
Sun Jan 15, 2017 10:13 pm by printexpk1

» SQL Dumper v.8.0
Fri Jan 13, 2017 10:18 pm by imsopickled

» Infographic Resume/CV Pack
Fri Jan 06, 2017 2:55 pm by Admin

» My Dear Love
Tue Jan 03, 2017 2:24 pm by Admin

» 2017 Calendar | One Page Calendar
Sun Jan 01, 2017 9:03 am by Admin

» Diagnosing Traffic Drops Using Google Analytics
Fri Dec 30, 2016 11:59 am by Admin

» British/UK Passport PSD
Thu Dec 29, 2016 4:03 pm by Admin

» PHP Mailer - Mass Emails All in inbox 2017
Thu Dec 29, 2016 3:55 pm by Admin

» How to Close any Facebook Account?
Wed Dec 28, 2016 10:51 am by Admin

January 2017

MonTueWedThuFriSatSun
      1
2345678
9101112131415
16171819202122
23242526272829
3031     

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
shahrozerashid007@gmail.com
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 : 469
Reputation : 6
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 Tue Jan 24, 2017 12:07 am