How can i input each pixel value intensity information into an array?

3 views (last 30 days)
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)

Answers (1)

Image Analyst
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
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?
SSZ
SSZ on 17 Nov 2013
Sorry mistype yes a 64 row x 64 column image. I have attached an image i am using a pyramid structure to down sample a 512x512 image to 64x64 to get a loss gap of 1 pixel.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!