Question: Using Matlab Connected Components (4 connected & 8 connected) Instructions: Read image of your choice by using imread function Convert it to grayscale if it

Using Matlab
Connected Components ("4 connected & 8 connected")
 Using Matlab Connected Components ("4 connected & 8 connected") Instructions: Read

Instructions: Read image of your choice by using imread function Convert it to grayscale if it is in RGB by using rgb2gray function Convert it to binary image by using im2bw function from matlab or take some threshold and make it to binary image Define the size of the image Take P as the center pixel and A and B as the neighboring pixels If both of the neighboring pixels are "o" give a new label to that corresponding pixel in the resulting image If A:0 and B= 1 assign the label of B to P If A= 1 and B:0 assign the label of A to P If A= 1 and B= 1 assign the label of either A or B and make a note that A=B * * After you assign all the labels go and scan the whole image and replace all the pixels of same object L.e. all pixels with the same label as A or all the pixels with same label as B Finally count the number of different labels in the image Plot your images by using the "imagesc" function to see different objects in the image with different colors Compare your result with "bwlabel" Please try to do 8-connected if you are done with 4-connected

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!