CSS3を使用した画像のグレースケールへの変換
CSS3で画像をグレースケールに変換するには、フィルタープロパティのグレースケール値を使用します。
例
例を見てみましょう-
<!DOCTYPE html>
<html>
<head>
<style>
img.demo {
filter: brightness(120%);
filter: contrast(120%);
filter: grayscale(130%);
}
</style>
</head>
<body>
<h1>Spring Framework</h1>
<img src="https://www.tutorialspoint.com/spring/images/spring-mini-logo.jpg" alt="Spring" width="160" height="150">
<h1>Learn MySQL</h1>
<p>Below image is brighter and has more contrast than the original image above. With that the image is in grayscale:</p>
<img class="demo" src="https://www.tutorialspoint.com/spring/images/spring-mini-logo.jpg" alt="Spring" width="160" height="150">
</body>
</html> 出力
-
OpenCVを使用して画像に楕円を描画します
このプログラムでは、OpenCVライブラリを使用して画像に楕円を描画します。同じようにOpenCV関数ellipse()を使用します。 元の画像 アルゴリズム Step 1: Import cv2. Step 2: Read the image using imread(). Step 3: Set the center coordinates. Step 4: Set the axes length. Step 5: Set the angle. Step 6: Set start and end angle. Step 6: Set the color. Step 7: Set th
-
OpenCVを使用して画像をカラーからグレースケールに変換する
このプログラムでは、画像の配色をrgbからグレースケールに変更します アルゴリズム Step 1: Import OpenCV. Step 2: Read the original image using imread(). Step 3: Convert to grayscale using cv2.cvtcolor() function. サンプルコード import cv2 image = cv2.imread('colourful.jpg') cv2.imshow('Original',image) grayscale = cv2.cvtColor(im