How can i input each pixel value intensity information into an array?
3 views (last 30 days)
Show older comments
I am trying to do my final year project and am not so great in MATLAB please help, How can i input each pixel value intensity information into an array? What mistake have i made on the code below?
Also is there a way to find the difference of intensity between a chosen pixel and its neighboring pixels - this information would be used to help me find an edge around a missing pixel and know which direction to interpolate in as not to get a fuzzy result.
function intensity()
lena=imread('lena.bmp');
size(lena)
[m n p]=size(lena)
a=rgb2gray(lena);
imshow(a);
title('Original Grayscale Image');
k=zeros(m,n);
for i=1:512;
for j=1:512;
intensityValue{i}=k(m,n);
end
intensityValue{j}=k(m,n);
end
figure, imhist(a)
0 Comments
Answers (1)
Image Analyst
on 16 Nov 2013
You already have the intensity. It's lena or a.
To find the difference between a chosen pixel and it's neighbors, you can use imfilter or conv2():
kernel = [-1 -1 -1;-1 8 -1; -1 -1 -1]/8;
differenceImage = conv2(double(a), kernel, 'same');
3 Comments
Image Analyst
on 16 Nov 2013
I don't know what a "6ax64 bit image" is. Is the a really a 4? Is it a 64 row by 64 column image of 8 bit integers? Is it a 64 bit integer image (which MATLAB can't handle)? Can you attach it?
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!