Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
image processing, pixel dimension

Subject: image processing, pixel dimension

From: sonia

Date: 14 Feb, 2011 11:59:05

Message: 1 of 4

hello,

Can any one help me to do the sum of two images with the same size (256,256).
The problem tha the dimension of their pixel is différent.
the matlab code is below:
%%%%

%% On charge l'image
load image1;
load image2;
image1=double(image1);
image2=double(image2);
%% Variables
Z1=image1;
Z2=image2;
%%%%%%%
Coeff=2;
N=128;
M=N*Coeff;% taille expansée
delta_x = 5e-6
dx=delta_x/Coeff;%resolution dans le plan d'entree : fixe par le modulateur
%on suppose que le pixel est carré


L0 = 550e-9;
c=2.9e8; %celerité de la lumière
sortie_glob=zeros(M,M);

Lc=3e-6;
Tc=Lc/c;
aa=1/Tc;
deltalambda=(L0^2)/Lc;
sigma0=1/L0;
f=150e-2;
p=5;
pas=deltalambda/10;
for i=-p:1:p
L(i+p+1)=L0-(deltalambda/2)+i*pas;
sigma(i+p+1)=1/L(i+p+1);
f2(i+p+1)=f*L0/L(i+p+1);%/sigma0;
du(i+p+1)=L0*f2(i+p+1)/(M*dx);%resolution fréquentielle
S2(:,:,(i+p+1))=[0:du(i+p+1):(M-1)*du(i+p+1)];%taille reelle
MFT=fftshift(fft2(Z1))*dx*dx;% multiplier par dx*dx
iMFT=(fft2(MFT))*du(i+p+1)*du(i+p+1);
sortie(:,:,i+p+1)= 20*abs(iMFT)/max(max(abs(iMFT))); %le 20 c'est pour comparer

mage(S2(:,:,i+p+1),S2(:,:,i+p+1),sortie(:,:,i+p+1))
 hold on
end
%%%%%%%%%%%%%%

I want to hold on all image in the same plane..
to have aberration in the output plane,
thanks..
Sonia

Subject: image processing, pixel dimension

From: ImageAnalyst

Date: 14 Feb, 2011 12:55:03

Message: 2 of 4

Sonia:
Why didn't you give the exact error message? Guessing from your
subject line, it might be possible that one image is color and one is
monochrome, or they have different numbers of rows and columns. Put
these lines right after you read in your images:

[rows1 columns1 numberOfColorChannels1] = size(image1)
[rows2 columns2 numberOfColorChannels2] = size(image2)

Make sure that the rows, columns, and numberOfColorChannels match each
other.

I also have no idea what this means "I want to hold on all image in
the same plane..to have aberration in the output plane, " Can you try
to phrase that differently. I don't know why you call "hold on" since
you don't seem to be plotting, charting, or displaying anything. I
also don't know what a lot of these variables are or where they came
from, such as mage, S2, sortie, L, sigma, and du. And others, such as
sortie_glob seem to be defined but never used.
ImageAnalyst

Subject: image processing, pixel dimension

From: sonia

Date: 14 Feb, 2011 13:58:04

Message: 3 of 4

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <82c838bb-8344-4789-8fd2-b592aacadacb@o39g2000prb.googlegroups.com>...
> Sonia:
> Why didn't you give the exact error message? Guessing from your
> subject line, it might be possible that one image is color and one is
> monochrome, or they have different numbers of rows and columns. Put
> these lines right after you read in your images:
>
> [rows1 columns1 numberOfColorChannels1] = size(image1)
> [rows2 columns2 numberOfColorChannels2] = size(image2)
>
> Make sure that the rows, columns, and numberOfColorChannels match each
> other.
>
> I also have no idea what this means "I want to hold on all image in
> the same plane..to have aberration in the output plane, " Can you try
> to phrase that differently. I don't know why you call "hold on" since
> you don't seem to be plotting, charting, or displaying anything. I
> also don't know what a lot of these variables are or where they came
> from, such as mage, S2, sortie, L, sigma, and du. And others, such as
> sortie_glob seem to be defined but never used.
> ImageAnalyst
>
Dear ImageAnalyst,
Thanks for your reply.
in matlab code I want to image (S2,S2,sortie)
Sortie is an image (256,256)
S2(i+p+1)=[0:du(i+p+1):(M-1)*du(i+p+1)] is a vector size (1,256) but they don't have tha same lenght because
du(i+p+1) change as function of i..
So, I want to image all "sortie(i+p+1)" for different value of du(i+p+1) in tha same figure.

In this site you can see an exemple of image with achromatic aberration : http://en.wikipedia.org/wiki/Chromatic_aberration
Sonia

Subject: image processing, pixel dimension

From: ImageAnalyst

Date: 14 Feb, 2011 14:34:23

Message: 4 of 4

Can you give code that works with standard MATLAB demo images? My
French is not as good as yours, and it seems like there is a lack of
comments anyway. Plus, why didn't you answer the question I posed
earlier: "Why didn't you give the exact error message?"

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us