 # Image Processing 3.1 Image Segmentation (a) Hand calculation: App...

## Question

Show transcribed text

## Transcribed Text

Image Processing 3.1 Image Segmentation (a) Hand calculation: Apply Hough transform to the following image to detect the straight line. Assumption: use polar parameterization of lines and treat the lower left pixel (0,0) so the line is xcos9 ysing d. where dis the perpendicular distance from line to the origin and 0 angle the perpendicular makes with the horizontal axis. Algorithm for hand calculation 1) Initialize matrix M(d,9) zeros. 2) For each non- zero point l(x.y)in the given image For 0 [0°. 45° 90°,135°] Compute d= xcost ysinf Update M(d, 0 M(d,0) + 1 3) (d*,0*) 4) he detected line is xcost ysin0 d' Show two results: (1) your M(d.8 (2) The detected line (expression simplified). o L1 (b) Write programs: Pixel classification clustering is powerful tool for image segmentation Use the image: duck jpg. Implement an image segmentation scheme as follows: (1) Flatten the image where each pixel is described by five features i.e. the red. green, blue, horizontal location and vertical location, denoted as F. In this case should be 50,589 by 5. (2) Cluster F by classic means algorithm given =2. Display two images in subplot: (1) The original image (2) The cluster index image. Notes: Make sure in [R.G.B.X,Y] space each column is normalized to [0,1]. Helpers: meshgrid, reshape, kmeans. 3.2 Image Representation (a)Hand Calculation: Run length coding. Give the run length coding of each row. (1)00001 110010 500000000111111 (b) Hand Calculation: Medial axis transform. Give the medial axis transform in format [x, y, r] (sorted with value) of the following image, treat the upper left corner as (1,1), horizontal andy is vertical axis. 1 (c) Write programs: Connected component analysis. Use the image: coins.png Normalize to [0,1]) Steps: (1) Threshold the image to binary with threshold 0.35. (2) Obtain the centroid, the major and minor axis length for each coin. (3) compute the radius by the arithmetic mean of the major and minor axis length for each coin. (4) Draw circles on the original image. Display the image with a circle surrounding each coin. Helpers: mat2gray, im2bw. regionprops, viscircles. 3.3 Mathematical Morphology (a) Hand calculation: Refer to HW3R, compute binary dilation and erosion for the given binary image. The kernel is 3x ones origin at the center. Treat element outside the border as "false" looooooool (a) Hand calculation: Refer to HW3R, compute gray-scale dilation and crosion for the given gray- scale image. The kernel is 3 x 3 of ones origin at the center. Treat element outside the border as negative infinity when computing dilation and positive infinity when computing crosion (c) Write programs: Basic morphology and its gradients. Use the image: cameraman. tif. Generate and display six images in subplot: (1) The original image. (2) Dilation of the image with kernel 3 x 3 of ones origin at the center. (3) Erosion of the image with the sarne kernel. (4) Basic gradient: subtract the erosion from the dilation (5) External gradient: subtract the original image from its dilation. (6) Inner gradient: subtract the crosion from the original image. Helpers: imdilate, imerode. 3.4 Distance Transform (a) Hand calculation: hand calculates the two-step algorithm in Image Representation as follows for the city-block (4-connectivity) distance transform on the image data below Treat the pixels outside the image boundary to be zeroes. Treat the value zeros in the image as the seeds. Show the two outputs data after the first step and the second step. 1 1 I 1 1 - - lo if Pes left-to-right (0)+1 if Pes top-to-bottom/ right-to-left ""(P)=min[x,'(P),x,"(Q)+1], bottom top (b) Write programs: implement the two-step algorithm for the chessboard (8-connectivity) distance transform Test on the same image data. Treat the pixels outside the image boundary to be zeroes. Treat the value zeros in the image as the seeds. Show the program and two output data after the first step and the second step by the program. Helpers: padarray 3.5 Global Thresh (a) Hand calculation: Apply the Global thresholding method on the following image. What is the best threshold value in this case? 1 1 1 2 10 11 10 11 0 1 10 12 12 11 011112121010 1 1 10 11 10 11 li (b) Write programs: Global threshold. Use the image: coins png ( Normalize to [0,1]). Implement the global threshold algorithm to determine the threshold value. what the value (answer with four digits)? Display two images in subplot: (1) The original image. (2) The binary image obtained with the original image and the computed global threshold value.

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

clear; clc; close all;
I=rot90(eye(8));
img_width=length(I(1,:));
img_height=length(I(:,1));
th=[0 pi/4 pi/2 3*pi/4];%Theta bins
nbin_th=length(th); nbin_r=10;
r=linspace(0,max(img_width,img_height),nbin_r);%For r bins, the index i shows bin r(i-1)<d<=r(i) range
M=zeros(nbin_th,nbin_r);
for i=1:img_width
for j=1:img_height
if I(i,j)~=0
x=i-1; y=img_height-j;
for k=1:nbin_th
d=x*cos(th(k))+y*sin(th(k));
idx=find(r<d,1,'last');...

By purchasing this solution you'll be able to access the following files:
Solution.docx, Solution.pdf and Solution.rar.

\$150.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Image Processing Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.