Image Color IPT

  • Uploaded by: hi ahi
  • Size: 864.5 KB
  • Type: PDF
  • Words: 412
  • Pages: 7
Report this file Bookmark

* The preview only shows a few pages of manuals at random. You can get the complete content by filling out the form below.

The preview is currently being created... Please pause for a moment!

Description

Image Color IPT Matlab

Write a program to convert an RGB image to CMYK format and display the 4 color channels individually (17) clear; clc; I = imread('peppers.png'); S = makecform('srgb2cmyk'); J = applycform(I, S); r = I(:,:,1); g = I(:,:,2); b = I(:,:,3); imwrite(J, 'test.tiff'); pause (5); imfinfo('test.tiff') M = imread('test.tiff'); c = M(:,:,1); m = M(:,:,2); y = M(:,:,3); k = M(:,:,4); cmy = M(:,:,1:3);

T = makecform('cmyk2srgb'); N = applycform(M, T); subplot(251), imshow(I); title('RGB'); subplot(252), imshow(r); title('R'); subplot(253), imshow(g); title('G'); subplot(254), imshow(b); title('B'); subplot(256), imshow(cmy); title('CMY'); subplot(257), imshow(c); title('C'); subplot(258), imshow(m); title('M'); subplot(259), imshow(y); title('Y'); subplot(2,5,10), imshow(k); title('K'); subplot(255), imshow(N); title('RGB recovered');

• The IPT function makecform creates a color transformation structure for color space conversion defined by the specified argument, in this case, srgb2cmyk option is used for RGB to CMYK conversion. • A reverse transformation of CMYK to RGB can be specified by the argument cmyk2srgb. The IPT function applycform converts the color values in the specified image to the specified color space defined by the color transformation structure. • The BM function pause pauses program execution for 5 seconds to allow the TIFF file to be written down to disk. • The BM function imfinfo can be used to verify that the TIFF file has a color type of CMYK. • Since MATLAB can only display a three channel color image, the first three channels are used for displaying the CMYK image

Write a program to convert an RGB image to HSV and Lab formats and display the channels individually. (18) clear; clc; rgb1 = imread('peppers.png'); r = rgb1(:,:,1); g = rgb1(:,:,2); b = rgb1(:,:,3); hsv = rgb2hsv(rgb1); h = hsv(:,:,1); s = hsv(:,:,2); v = hsv(:,:,3); lab = rgb2lab(rgb1); l = lab(:,:,1); a = lab(:,:,2); b = lab(:,:,3); rgb2 = hsv2rgb(hsv); rgb3 = lab2rgb(lab);

subplot(441), imshow(rgb1); title('RGB'); subplot(442), imshow(r, []); title('R'); subplot(443), imshow(g, []); title('G'); subplot(444), imshow(b, []); title('B'); subplot(445), imshow(hsv); title('HSV'); subplot(446), imshow(h, []); title('H'); subplot(447), imshow(s, []); title('S'); subplot(448), imshow(v, []); title('V'); subplot(449), imshow(lab); title('LAB'); subplot(4,4,10), imshow(l, []); title('L'); subplot(4,4,11), imshow(a, []); title('a'); subplot(4,4,12), imshow(b, []); title('b'); subplot(4,4,13), imshow(rgb2, []); title('rgb2'); subplot(4,4,14), imshow(rgb3, []); title('rgb3');

• The IPT functions rgb2lab and lab2rgb convert colors from RGB to L*a*b* color spaces and vice versa. • The BM functions rgb2hsv and hsv2rgb convert colors from RGB color space to HSV color space and vice versa. • The example shows an RGB image being converted to HSV and L*a*b* color spaces and displays the individual channels.

Similar documents

Image Color IPT

hi ahi - 864.5 KB

color blau

- 249.8 KB

1. COLOR-GROUP

Jhon Arip - 4.5 MB

Cuenca a1 Color

Jose López Mamani - 333.6 KB

Color Flashcards 2x3

Yeison Duban Gomez Castillo - 137.2 KB

21. CUADERNILLO FONEMA K COLOR (3)

Vanessa Montecinos Campos - 669.3 KB

Materi 2 a Color Wheel 1

Muhammad rizky fauzi nurrohman - 3.2 MB

© 2024 VDOCS.RO. Our members: VDOCS.TIPS [GLOBAL] | VDOCS.CZ [CZ] | VDOCS.MX [ES] | VDOCS.PL [PL] | VDOCS.RO [RO]