Upload New File
This commit is contained in:
35
image processing and models/hsv.m
Normal file
35
image processing and models/hsv.m
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
clc;
|
||||||
|
close all ;
|
||||||
|
clear all ;
|
||||||
|
|
||||||
|
%% reading the image
|
||||||
|
l=13;
|
||||||
|
jpgFilename = strcat('e_images_',num2str(l), '.jpg');
|
||||||
|
rgb=imread(jpgFilename);
|
||||||
|
%% gray scaling
|
||||||
|
gray = rgb2gray(rgb);
|
||||||
|
figure(1);
|
||||||
|
imshow(gray);
|
||||||
|
title('gray scaled');
|
||||||
|
|
||||||
|
%% binary thresholding
|
||||||
|
|
||||||
|
[size1,size2]=size(gray);
|
||||||
|
for i=1:size1
|
||||||
|
for j=1:size2
|
||||||
|
if gray(i,j)<60
|
||||||
|
gray(i,j)=255;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
BW=im2bw(gray,graythresh(gray));
|
||||||
|
|
||||||
|
figure(2);
|
||||||
|
imshow(BW);
|
||||||
|
|
||||||
|
%% hsv general
|
||||||
|
hsv = rgb2hsv(rgb);
|
||||||
|
figure(3);
|
||||||
|
imshow(hsv);
|
||||||
|
title('hsv')
|
||||||
Reference in New Issue
Block a user