Skip to main content

DFT and Zoom

4 replies [Last post]
toufou
Offline
Joined: 2005-06-10
Points: 0

Excuse me for asking help so quickly, and excuse me for my english too, because I am french and it is quite hard to speak a good english.
So, I have got a problem with DFT...
Here is a schema of my DFTChain:

source image : img
dft (img)
split the result in 4 parts
get the corners to put them in a bigger image (4 times biggest), taking each corner and put on them a border with Border operator
add these images to obtain only one
the result is a big image, with in corners each respective part of the dft(img) and some 0 between these parts

And, when I try to invert DFT (idft) of the result image, I don't work: I can't access to pixel values nor to "filestore" it on harddrive.
I tried to do it with "magnitude" and "phase" separatly, but it doesn't work too...

Please, can someone help me?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
toufou
Offline
Joined: 2005-06-10
Points: 0

Maybe I don't explain well...
So, I am going to explain it again, clearly if it is possible...

There is a sample of my code:

PlanarImage img1Cropped = dft(img1);
PlanarImage img2Cropped = dft(img2);
img2Cropped = conjugate(img2);
PlanarImage imgMultiply = multiplyComplex (img1Cropped, img2Cropped);
imgMultiply = enlarge (imgMultiply);
PlanarImage resultImage = idft (imgMultiply);
resultImage = periodicshift (resultImage);

Ok... now it is done, there is my problem which is in "enlarge" function... Indeed, if i comment this function, the program works fine.

There is what is in my function "enlarge":

constant = constantImage (0); // Creation of a zero constant image
for (int i = 0; i < 4; i++) {

Rectangle rect = new Rectangle();
double x = (i%2)*(img.getWidth() / 2);
double y = Math.floor(i/2) * (img.getHeight() / 2);
double width = img.getWidth() / 2;
double height = img.getHeight() / 2;
rect.setRect(x, y, width, height);
PlanarImage imgCropped = crop (img, rect); // get a quarter (corner) of the original image

int[] borders = new int[4];
for (int j = 0; j < 4; j++) borders[j] = 0;
if (i%2 == 0) borders[1] = img.getWidth() * 4 - imgCropped.getWidth();
else borders[0] = img.getWidth() * 4 - imgCropped.getWidth();
if (Math.floor(i/2) == 0) borders[3] = img.getHeight() * 4 - imgCropped.getHeight();
else borders[2] = img.getHeight() * 4 - imgCropped.getHeight();
imgCropped = border (img, borders); // add borders to the imgCropped in order to make it biggest

constant = add (constant, imgCropped); // add images to the zero image, to get the whole image with the small corner of the original image in its corner
}

So, it works well... all of this works fine, but the problem is when the "idft" function is called, because after that i can't access to pixel values, whereas before "idft", i can...
Is there someone who can help me or tell me why I can't separate a dft image?
Thanks a lot.

Brian Burkhalter

On Sun, 12 Jun 2005 jai-interest@javadesktop.org wrote:

> So, it works well... all of this works fine, but the problem is when the "idft" function is called, because after that i can't access to pixel values, whereas before "idft", i can...
> Is there someone who can help me or tell me why I can't separate a dft image?

I am afraid that I do not grasp the meaning of "i can't access to pixel
values". Would you be able to explain that in different words?

Thanks,

Brian

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

toufou
Offline
Joined: 2005-06-10
Points: 0

After the IDFT, the image can't be written, nor be readed using Raster...
I tried to "filestore" it on harddrive, and tried to getSample with Raster, but each time, it freezes.
The image created on harddrive is a 0-size image (0 bytes),
and the image.getData() doesn't want to work fine: each time, it's like the getData() blocked (stailed?) the program

Message was edited by: toufou

bpb
Offline
Joined: 2004-06-23
Points: 0

Could you provide a complete, self-contained test case that reproduces the problem (not a code snippet)?

Thanks,

Brian

> After the IDFT, the image can't be written, nor be
> readed using Raster...
> I tried to "filestore" it on harddrive, and tried to
> getSample with Raster, but each time, it freezes.
> The image created on harddrive is a 0-size image (0
> bytes),
> and the image.getData() doesn't want to work fine:
> each time, it's like the getData() blocked (stailed?)
> the program
>
>
> Message was edited by: toufou