This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
clickPt = [] | |
def clickDetect(event, x, y, flags, param): | |
global clickPt | |
if event == cv2.EVENT_LBUTTONDOWN: | |
clickPt = [(x, y)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
# import an image | |
image=cv2.imread("fayah.jpg") | |
# take x,y from getsector.py | |
image[x,y]=[0,0,255] | |
# Save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% first we load the MNIST dataset | |
digitDatasetPath = fullfile(matlabroot,'toolbox','nnet','nndemos', ... | |
'nndatasets','DigitDataset'); | |
imds = imageDatastore(digitDatasetPath, ... | |
'IncludeSubfolders',true,'LabelSource','foldernames'); | |
%% visualizing the image data | |
figure; | |
permute = randperm(10000,10); | |
for i = 1:10 | |
subplot(2,5,i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import matplotlib.pyplot as plt | |
# reading the smooth image and converting it into RGB color space | |
image_smooth = cv2.cvtColor(cv2.imread('smooth.jpg'),cv2.COLOR_BGR2RGB) | |
# calculating edges from the smooth image | |
edge_smooth= cv2.cvtColor(cv2.Canny(image_smooth, 100, 250),cv2.COLOR_BGR2RGB) | |
# reading a normal sharp image and converting the color space | |
image_sharp = cv2.cvtColor(cv2.imread('sharp.jpg'),cv2.COLOR_BGR2RGB) | |
# claculating the edges from the image | |
edge_sharp= cv2.cvtColor(cv2.Canny(image_sharp, 100, 250),cv2.COLOR_BGR2RGB) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grayImage = imread('cameraman.tif'); | |
subplot(2, 1, 1); | |
imshow(grayImage); | |
subplot(2, 1, 2); | |
histObject = histogram(grayImage, 256, 'Normalization', 'probability') | |
grid on; | |
xlabel('Gray Level', 'FontSize', 20); | |
ylabel('Probability', 'FontSize', 20); | |
% Extract probabililty of each gray level into a vector "p". | |
p = histObject.Values; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
offsetsEdge=[zeros(40,1)(1:40)']; | |
glcms=graycomatrix(I,'Offset',offsetsEdge); | |
stats=graycoprops(glcm) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%[m,n]= size(I) | |
% using all the statistical texture information | |
% and plotting them | |
offsetsEdge = [zeros(40,1)(1:40)]; | |
glcms = graycomatrix(I,'Offset',offsetsEdge); | |
stats = graycoprops(glcm) | |
stats.Contrast | |
stats.Correlation | |
stats.Energy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
K=rangefilt(I); | |
J=stdfilt(I); | |
Jen=entropyfilt(I); | |
% finding the correlation between the original image | |
% and the maximum available texture information | |
% alternatively use 'corrcoef' | |
R =corr2(I,max(K,J,Jen)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% plotting the power spectral density of the image available | |
% using the psd plot to obtain further information | |
psd = imagesc(log10(abs(fftshift(fft2(I))).^2)) | |
mesh(psd); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
se = strel(3,3); | |
basic_gradient = imdilate(I,se)- imerode(I,se); | |
external_gradient= I-basic_gradient; | |
peakpsnr = psnr(external_gradient,I); |
OlderNewer