Question

1. For this problem, you will use any image . Pick two specific colors of the image in the image. (a) Load the image, co...

1. For this problem, you will use any image . Pick two specific colors of the image in the image.

(a) Load the image, convert to HSV, and display the hue component as a grayscale image. Use this

image to identify the hue of each of the colors you chose and record in your homework.

(b) For each color, use the color hue to perform image segmentation to isolate the specific color in the

chalk. The pixels that are not found to be of this color should be set to a neutral gray color RGB =

[0.5,0.5,0.5].

(c) Include the result for each color. Describe each result in 2-3 sentences. If portions of the image are

included that are not pieces of chalk, explain why they were included.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

close all,
clear all,
clc,

ProjectPath = pwd;
ROW = 128; COL=128;

ImagePath = strcat(ProjectPath,'\Leena.jpg');
Orig = imread(ImagePath);
HSVimg = rgb2hsv(Orig);
subplot(1,3,1); imshow(Orig); title('Original Image');
subplot(1,3,2); imshow(HSVimg); title('HSV Image');
[row col] = size(Orig);
Row = uint16(rand*row);
Col = uint16(rand*col);

Phsv_1 = impixel(HSVimg,Col,Row);
Prgb_1 = impixel(Orig,Col,Row);

disp(['Color-1, Pixel (',num2str(Row),' , ',num2str(Col),') RGB Value = ',num2str(Prgb_1)]);
disp(['Color-1, Pixel (',num2str(Row),' , ',num2str(Col),') HSV Comp. = ',num2str(Phsv_1)]);

Row = uint16(rand*row);
Col = uint16(rand*col);

Phsv_2 = impixel(HSVimg,Col,Row);
Prgb_2 = impixel(Orig,Col,Row);

disp(['Color-2, Pixel (',num2str(Row),' , ',num2str(Col),') RGB Value = ',num2str(Prgb_2)]);
disp(['Color-2, Pixel (',num2str(Row),' , ',num2str(Col),') HSV Comp. = ',num2str(Phsv_2)]);
[row col] = size(HSVimg);

for r=1:row
for c=1:col
P = impixel(HSVimg,c,r);
if(P(1)~=Phsv_1(1) && P(1)~=Phsv_2(1) && P(2)~=Phsv_1(2) && P(2)~=Phsv_2(2) && P(3)~=Phsv_1(3) && P(3)~=Phsv_2(3)),
HSVimg(r,c,1)=0.5;
HSVimg(r,c,2)=0.5;
HSVimg(r,c,3)=0.5;
end
end
end
subplot(1,3,3); imshow(HSVimg); title('HSV Image');

Add a comment
Know the answer?
Add Answer to:
1. For this problem, you will use any image . Pick two specific colors of the image in the image. (a) Load the image, co...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The ACME Manufacturing Company has hired you to help automate their production assembly line. Cameras have...

    The ACME Manufacturing Company has hired you to help automate their production assembly line. Cameras have been placed above a conveyer belt to enables parts on the belt to be photographed and analyzed. You are to augment the system that has been put in place by writing C code to detect the number of parts on the belt, and the positions of each object. The process by which you will do this is called Connected Component Labeling (CCL). These positions...

  • Mountain Paths (Part 1) Objectives 2d arrays Store Use Nested Loops Parallel data structures (i.e...

    Mountain Paths (Part 1) in C++ Objectives 2d arrays Store Use Nested Loops Parallel data structures (i.e. parallel arrays … called multiple arrays in the zyBook) Transform data Read from files Write to files structs Code Requirements Start with this code: mtnpathstart.zip Do not modify the function signatures provided. Do not #include or #include Program Flow Read the data into a 2D array Find min and max elevation to correspond to darkest and brightest color, respectively Compute the shade of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT