cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Help with creating locations of a regular pattern

Jbryant61
4-Participant

Help with creating locations of a regular pattern

I have create a set of random locations and then at each location I place an object to simualte an image.

im57.png

The delta just makes sure no objects are within 3 pixels of the image edge.

I know want to be able to change the locations now to represent the following regular pattern. I believe horizontallt there is a pitch of 8 pixels, and vertically a pitch of 9 pixels with a horiztonal shift of 4 pixels.

im58.png

Thnaks for any help

Jason

1 ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:Jbryant61)

Use the built-in convol2d function and the edge effect goes away (i could probably get it to go away using FTs as well, but the built-in function is a lot easier!).

View solution in original post

11 REPLIES 11
RichardJ
19-Tanzanite
(To:Jbryant61)

Something like this?

Jbryant61
4-Participant
(To:RichardJ)

Thanks Richard - its a while since we last spoke on this forum!!

Please see the attached, you  helped me before a couple of years ago place a point spread function of random amplitude at each of these locations.  I have tried to combine your previous work with this patterned location array and nearly have it, there's 3 issues that have arisen though and I'm not sure how to do them.


In particular:

1: How to count the number of objects, I tried the following but its not right.

im62.png

2: How to apply random amplitudes to the objects  using

                        

    amp=runif(n,0.1,1)         - but how to then apply it to the objects in M?

3: How to get rid of the strange edge effect ont he right hand side

im63.png

and lastly, how to allow for a random 0.5 pixel shift so that each psf is not necessarily centred exactly on a pixel.

Thanks

Jason

Jbryant61
4-Participant
(To:Jbryant61)

I've managed to answer my own questions, not sure if its the most elegant way.  I included the randomw amplitude and object count in Richards original function.image01.png

Im still getting a strange edge effects on the RHS once its convolved with the psf.

Jason

RichardJ
19-Tanzanite
(To:Jbryant61)

Use the built-in convol2d function and the edge effect goes away (i could probably get it to go away using FTs as well, but the built-in function is a lot easier!).

Jbryant61
4-Participant
(To:RichardJ)

Thansk Richard

Jbryant61
4-Participant
(To:Jbryant61)

Is it easy to modify this so the distance between the centres in x and y can be changed?   i.e. I need a pitch of 6pixles in x, and 5 pixels in y.

Thanks

Jason

RichardJ
19-Tanzanite
(To:Jbryant61)

Sure. I was lazy, so this only has one pitch value, but you can easily modify it to have different pitches for x and y.

Jbryant61
4-Participant
(To:RichardJ)

Thanks Richard. I think I've nearly done it, there just seems to be an issue of padding in the final array. Any suggestions please.

Thnaks

jason

RichardJ
19-Tanzanite
(To:Jbryant61)

Do you want to remove the bit at the bottom (i.e. the aspect ratio of the image will no longer be 1:1), or do you want to fill it with more pattern?

Jbryant61
4-Participant
(To:RichardJ)

Yes remove the bit at the bottom, so no longer have aspect ratio of 1:1.

Thanks

Jason

RichardJ
19-Tanzanite
(To:Jbryant61)

Remove the first line of the program.

Top Tags