0% found this document useful (0 votes)
12 views10 pages

21ucs164 Cvfa

Uploaded by

dhruvdascbi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views10 pages

21ucs164 Cvfa

Uploaded by

dhruvdascbi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

% name : RAJA THAKUR SODANI

% roll no : 21UCS164

% Color Detection
image = imread('temp.png'); % Load your image
imshow(image);
title('Original Image');

% Convert to HSV color space for better color detection


hsvImage = rgb2hsv(image);

% Define the color range for detection (e.g., red color)


lowerBound = [0.9, 0.5, 0.5]; % Adjust for your color range
upperBound = [1, 1, 1];

% Create a binary mask


colorMask = (hsvImage(:,:,1) >= lowerBound(1)) & (hsvImage(:,:,1) <=
upperBound(1)) & ...
(hsvImage(:,:,2) >= lowerBound(2)) & (hsvImage(:,:,2) <=
upperBound(2)) & ...
(hsvImage(:,:,3) >= lowerBound(3)) & (hsvImage(:,:,3) <=
upperBound(3));

% Display the detected color region


figure;
imshow(colorMask);
title('Detected Color Region');

1
Published with MATLAB® R2024b

2
% name : RAJA THAKUR SODANI
% roll no : 21UCS164

% Basic Tom and Jerry Animation (simplified visualization)


figure;
axis([0 10 0 10]);
hold on;

for t = 0:0.1:10
clf;
rectangle('Position', [mod(t, 10), 5, 1, 1], 'FaceColor', 'blue'); % Jerry
rectangle('Position', [mod(t+3, 10), 7, 1.5, 1], 'FaceColor', '#808080');
% Tom (gray color)

title(['Animation Frame at t = ', num2str(t)]);


pause(0.1);
end

1
Published with MATLAB® R2024b

2
% name : RAJA THAKUR SODANI
% roll no : 21UCS164

% Image Enhancement using Histogram Equalization


image = imread('temp.png');
grayImage = rgb2gray(image);

% Display original image


figure;
subplot(1, 2, 1);
imshow(grayImage);
title('Original Grayscale Image');

% Apply histogram equalization


enhancedImage = histeq(grayImage);

% Display enhanced image


subplot(1, 2, 2);
imshow(enhancedImage);
title('Enhanced Image');

1
Published with MATLAB® R2024b

2
% name : RAJA THAKUR SODANI
% roll no : 21UCS164

image = imread('temp.png');
grayImage = rgb2gray(image);
image = double(grayImage);

maskRadius = 3; % Adjust for different results


threshold = 27; % Threshold value for corner detection

corners = susan_corner_detector(image, maskRadius, threshold);

% Plot detected corners


figure;
imshow(grayImage);
hold on;
if ~isempty(corners)
figure;
imshow(grayImage);
hold on;
plot(corners(:, 2), corners(:, 1), 'r*'); % Plot the detected corners
title('SUSAN Corner Detection');
else
disp('No corners detected. Try adjusting maskRadius or threshold.');
end

title('SUSAN Corner Detection');

No corners detected. Try adjusting maskRadius or threshold.

1
Published with MATLAB® R2024b

2
% name : RAJA THAKUR SODANI
% roll no : 21UCS164

% Moravec Corner Detector Implementation


image = imread('temp.png'); % Load your image
grayImage = rgb2gray(image); % Convert to grayscale if necessary
image = double(grayImage); % Convert to double for computation

% Parameters
windowSize = 3; % Window size for corner detection
threshold = 10000; % Adjust this based on your image

% Detect corners using the Moravec corner detector


corners = moravec_corner_detector(image, windowSize, threshold);

% Plot detected corners


figure;
imshow(grayImage);
hold on;
plot(corners(:, 2), corners(:, 1), 'r*'); % Plot corners as red stars
title('Moravec Corner Detection');

1
Published with MATLAB® R2024b

You might also like