Measuring the Pixel Size of Objects inside Images
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am attempting to write a program that will compute a change in size of an object from one image to another image of the same object. Example being the two images of a simple square and a bigger simple square. I know that MATLAB has a toolbox that has a simple measurement tool but I'm trying to get the code to were I can simply link two images into the code have it compute a specific value. I have the code to the point that the code will read in the image find the object and impose the pixel size of the entire image but I am having troubles getting the code to compute the pixel size of a specific object inside the image. I'm sure there is MATLAB function I have overlooked that would make this easier and was wondering if anyone could point point me in the right direction. Thanks for any help or advice in advance!
clear all;
clc;
I1 = imread('http://i46.tinypic.com/xoqzya.jpg'); %first original image
I_1gs = rgb2gray(I1); %convert RGB img to grey scale img
I_1mat = im2uint8(edge(I_1gs,'canny',0)); %find the edges of the image and convert to matrix form
D1 = bwdist(I_1mat,'euclidean'); %distance transform
D1_1 = mat2gray(D1);
figure
subimage(D1_1) %convert from matrix to grey sca
I2 = imread('http://i50.tinypic.com/34nodfs.png'); %second original image
I_2gs = rgb2gray(I2); %convert RGB img to grey scale img
I_2mat = im2uint8(edge(I_2gs,'canny',0)); %find the edges of the image and convert to matrix form
D2 = bwdist(I_2mat,'euclidean'); %distance transform
D2_1 = mat2gray(D2);
figure
subimage(D2_1)
D3 = D1 - D2;
D3_1 = mat2gray(D3);
for n = 1:j1
for m = 1:k1
if D3_1(n,m) == 1
D3_1(n,m) = 0;
end
end
end
figure
subimage(mat2gray(D3_1)) %image of the difference between image one and two
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Convert Image Type finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!