数字图像处理实验(14):PROJECT 06-01,Web-Safe Colors 标签: 图像处理MATLAB 2017-05-27 20:45 116人阅读

实验要求:

Objective:
To know what are Web-safe colors, how to generate the RGB components for a given jpeg color image, or convert an image to RGB manually?
Main requirements:
Ability of programming with C, C++, or Matlab.
Instruction manual:
In order to complete this project, it is necessary that you find a program capable of generating the RGB component images for a given jpg color image. For example, MATLAB’s Image Processing Toolbox can do this, but you can also do it with image editing programs like Adobe’s Photo-Shop or Corel’s Photo-Paint. It is acceptable for the purposes of this project to convert an image to RGB (and back) manually.
(a) Write a computer program that converts an arbitrary RGB color image to a web-safe RGB image (see Fig. 6.10 for a definition of web-safe colors).
(b) Download the image in Fig. 6.8 and convert it to a web-safe RGB color image. Figure 6.8 is given in jpg format, so convert your result back to jpg (see comments at the beginning of this project). Explain the differences between your result and Fig. 6.8.

这次实验是生成网页安全色模板,内容较简单,直接上代码。

实验代码:

%
close all;
clc;
clear all;

%
img = imread('Fig6.08.jpg');
figure;
subplot(1,2,1);
imshow(img);
title('original image');

%
img1 = fix((img/51)*51);
subplot(1,2,2);
imshow(img1);
title('web colors');

实验结果:
这里写图片描述

原文地址:https://www.cnblogs.com/xuhongbin/p/7134156.html